java

Why may `@In(create = true)` not create the object in Seam?

I have a very simple piece of code that reads like: @In(create = true) OutletHome outletHome; It was working fine (using Seam 2.2.0.GA), and the object was being created and injected without any problems. But when I tried changing it to: @In(create = true) OutletHome deactivationOutletHome; It suddenly stopped working, causing the ...

Add Response Header to JAX-RS Webservice

I am trying add some response headers to some of my webservice calls. I wrote my webservice using CXF 2.1.2 and JAX-RS. I need to return an object and I also want to add some headers to the Response. Without returning a javax.ws.rs.core.Response object, how do I add a header to the response and still return my javabean? ...

Java synchronization problem

Hello everyone. I'm having hard time to make my program work correctly. In brief, my program consists of several initial threads: Main, MessageReceiver, Scheduler (used Quartz package) and two types of threads scheduled by the Scheduler thread: TraceReader and ScheduledEvent. Now, when TraceReader is fired, it reads a special trace file ...

Input string compressed as string

Hi, I want to compress/transform a string as new string. i.e.: input string: USERNAME/REGISTERID output string after compress: <some-string-in-UTF8-format> output string after decompress: USERNAME/REGISTERID There are some compress or hash method for this transformation? I prefer some solution using Java or an algorithm with ...

Conversion from javascript-escaped Unicode to Java Unicode

I have a query string passed in through an HTTP request that has this character in it: %u54E6 And I'd like to generate a string that contains the actual Chinese character so I can use it in a different part of the application, I've tried using this code: String foo = "%u54E6"; String ufoo = new String(foo.replaceAll("%u([a-zA-Z0-9]{4}...

Integrating an existing Java Swing component into a QT widget

We have two massive applications,lets name them "A_app" and "B_app". Both A_app and B_app come with rich editors. A_app's editor is written using Java-Swing and B_app's editor is written using QT. Now we need to be able to integrate A_app's editor in B_app's editor, which would effectively mean that we need to integrate an existing Swi...

Best method of triggering a shell script from Java

I have a shell script which I'd like to trigger from a J2EE web app. The script does lots of things - processing, FTPing, etc - it's a legacy thing. It takes a long time to run. I'm wondering what is the best approach to this. I want a user to be able to click on a link, trigger the script, and display a message to the user saying tha...

Looking for a Java User Agent String Parser

Does anyone know of a great library in java for parsing user agent strings? We have written a custom one, but this seems like a common problem for many people. I would guess there is a good library available somewhere. For example, the user agent string... "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like...

Credentials ignored with maven scmchangelog-plugin

When I configure the scmchangelog-plugin, as written in the examples/tutorial, and run the site-generation, the username and password I have set are ignored. The documentation says that username and password which should be used to access the SCM can be configured in the plugin-configuration. This looks like this: <reporting> <plugins...

Drools Flow Human Task example: How do I prevent 'Named query not found' exception being thrown?

I'm trying to follow the Drools Flow example code in the Human Task documentation and I have the following code: import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import org.drools.task.service.TaskService; // ... EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.task")...

how to make java enum elements configurable

hello guys i'm not sure if the title is descriptive enough.what i mean is creating an enum like so public enum Test{ ONE, TWO ,THREE } this looks like hard coded.if for some reason i need to add the FOUR some certain business rules evolution reasons.should i code it and deploy it again? isn't a way to let it pick the elements from ...

How to set the maximum memory usage for JVM?

I want to limit the maximum memory used by the JVM. Note, this is not just the heap, I want to limit the total memory used by this process. ...

Is there an elegant way to do partial regex matches in Java?

What I need is to check whether a given string partially matches a given regex. For example, for the regex ab[0-9]c, the strings "a", "ab", "ab3", and "b3c" would "match", but not the strings "d", "abc", or "a3c". What I've been doing is the clunky a(?:b(?:[0-9](?:c)?)?)? (which only works for some of the partial matches, specifically ...

java rmi client exceptions

I'm writing an rmi application. Everything works perfectly fine when i put the all classes in one directory(one single package). However, when i try to split the server part and the client part, exceptions happens to the client. Server works normally. Here is part of the stack trace of after exception happens: Exception in thread "main"...

Design: When the line between domain objects and service objects isn't clear

This question is, at it's core, a design question. I'll use a Java/JEE example to illustrate the question. Consider a web-mail application which is built using JPA for persistence and EJB for the services layer. Let's say we have a service method in our EJB like this: public void incomingMail(String destination, Message message) { ...

jpa version cascade

JSR 220: Enterprise JavaBeansTM,Version 3.0 section 3.4.2 paragraph 3 All non-relationship fields and properties and all relationships owned by the entity are included in version checks. My Question: What does "owned by the entity" mean? ...

Can groovy's swingbuilder get more than one look and feel in a Java swing application?

Via this question, it would seem that normally you can't mix-and-match look and feels in the same swing app. However, we've been using groovy's swingbuilder to handle all of our GUI code, and groovy seems to do enough black magic that this seemed in the Realms of the Possible. Can swingbuilder set the LaF at, say, the Frame level? (Sp...

Java + XML Question

Hi everibody. I'm kinda new to this of XML parsing. So I'll appreciate if you can help me with this. I need to extract some data that's inside an XML document whose structure is: <DWDocument DW5BasketFileName="DOCU0001.001"> <FileInfos> <ImageInfos> <ImageInfo id="0,0,0" nPages="0"> <FileInfo fileName="PATH_1" dwFi...

Can HTML-Style Links be added to SWT StyledText?

I know SWT has a Link class to create HTML a href style links as widgets, but I wast trying to find a way to make certain text in a StyledText control appear and function as a link. I feel like Eclipse does this in their code editor if you hold down control and hover over a method name, but I know the Eclipse java editor is much more ...

How do I join tables on non-primary key columns in secondary tables?

I have a situation where I need to join tables on an object in an ORM class hierarchy where the join column is NOT the primary key of the base class. Here is an example of the table design: CREATE TABLE APP.FOO ( FOO_ID INTEGER NOT NULL, TYPE_ID INTEGER NOT NULL, PRIMARY KEY( FOO_ID ) ) CREATE TABLE APP.BAR ( FOO_ID IN...