java

Accessing JSF SelectItem.Label and Value from XHTML without selectOneMenu

Hi, I'm struggling with a little internationalization issue in one of my apps. The story goes like this: I have a datatable which displays records, and a selectOneMenu in order to select a column of the dataTable to be filtered for. The selectOne is fed with SelectItems which are filled according to the actual locale in the backing be...

Changing subtopics in BlazeDS and Flex

I using messaging in Flex-BlazeDS. When the AIR client starts it connects to a destination and a specific subtopic. During runtime, the user can use a combo box to subscribe to different sets of live data coming in, this combo box change event changes the subtopic by: messagingConsumer.subtopic = subtopicComboBox.selectedLabel; messag...

What Java regular expression do I need to match this text?

Hi, I'm trying to match the following using a regular expression in Java - I have some data separated by the two characters 'ZZ'. Each record starts with 'ZZ' and finishes with 'ZZ' - I want to match a record with no ending 'ZZ' for example, I want to match the trailing 'ZZanychars' below (Note: the *'s are not included in the string - ...

Animated *.gif framerate is too high

Hello! I'm loading an animated gif into a JButton. Online the gif looks to move at a normal pace. But when I load it in java it looks like the animation is trying to run as quickly as possible! How can I atleast slow it down? Here is my code: public Icon getIcon(){ return new ImageIcon(getClass().getResource("images/working.gif"), ...

Java TelnetClient hangs at “press any key to continue”

I have a Java program that runs on Linux and telnets into a remote server using org.apache.commons.net.telnet.TelnetClient and performs a few commands. The problem is that it hangs intermittently when it gets to an output display that asks the users to “press any key to continue…” The program hangs on this about 1 out of every 10 tims ...

pass reflected enum to method.invoke java

If you have an enum that you are accessing via reflection how would you pass it's value into method.invoke call. Would it be something like (shown as a static method for simplicity) Class enumClazz = Class.forName("mypkg.MyEnum",true,MyClassLoader); Class myReflectedClazz = Class.forName("mypkg.MyClass",true,MyClassLoader); ...

How does the timeout work in Restlet's client class?

Here's some code: Client client = new Client(Protocol.HTTP); client.setConnectTimeout(1); //milliseconds Response response = client.post(url, paramRepresentation); System.out.println("timed out"); What I would expect to happen is that it prints "timed out" before the resource has time to process. Instead, nothing happens with the tim...

How do I configure tomcat to handle bad HTTP clients?

We're running jBoss 5.1, which in turn uses the Tomcat servlet container. We've been seeing some cases where bad HTTP clients will open a socket, make an HTTP request, fail to read all data and fail to close the connection. The outcome is that the tomcat threads block indefinitely trying to write to the output stream: SocketOutputStre...

inserting folder containing components into JList

Can anyone guide me or give an example of how to insert components, or files of components, or their folder into JList. This has being an issue pending, please assist. ...

How do you introspect web.xml from a servlet?

Is there a way for a servlet filter to get a list of all servlets and their mappings? ...

what value does null really have?

(I know what null is and what its is used for) Question: OK, say we make a reference to an object in whatever language. The computer makes a little 32-bit (or other size, depending on computer's design) space in memory for that reference. That memory can be assigned to a value that represents an object's location in memory. But when I s...

reading xstream generated xml into .net

We'd like to generate xml using xstream implemented with java. We'd then like to consume that xml in a .net application and have it deserialized into c# classes. has anyone had success in doing this? is there a framework available on the C# side that will make it easier and more robust than something we'd have to roll-up? ...

java lucene class not found problem

I keep getting this error: java.lang.NoClassDefFoundError: org/apache/lucene/index/memory/MemoryIndex Is there any way i can go about making sure java/tomcat can find this class? ...

JPA with TopLink: No META-INF/persistence.xml was found in classpath

public class LoginTest { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("IRCBotPU"); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); Login lg = new Login(); lg.setPassword("password"); lg.setUserName("Rocky"); em.persist...

Programmatically (in C#) get java application name from javaw.exe process?

Is there a way to get name of the java app associated with a javaw.exe? Basically I need to write a tool, to check (daily) if a specific java app is running on our server (and if not the tool will email me). I would like to do this in C#...but if there isn't a way I would be open to other suggestions. I have read this question 265794 ...

How do I start an IBM MQ channel in Java?

Hi guys, So my Java process communicates with a remote queue. What happens is at the end of every day, the sender channel on the receiving end is in a stopped state. Is there a way to start up that channel in Java, before accessing the remote queue? ...

Introducing Spring MVC

I'd like to introduce Spring MVC to an application that has up till now used simple direct access to JSP files i.e www.example.com/login.jsp which contains the business logic and presentation details. I'd like to strip out the business logic and keep only the presentation in the JSP. To do this, I've moved the jsp file from webapp/login...

PoolableConnectionFactory Invalid handle

I'm deploying an old app on a new box. When hitting the database for the first time I get File input error: Cannot create PoolableConnectionFactory (Invalid handle) I've set up my resource in context.xml, my dsn with unixODBC, and my resource-ref in web.xml. What else am I missing? from content.xml --> <Resource name="jdbc/MoleCo...

Why doesn't the -baseline option of jhat work?

How come every object appears to be marked new, instead of just objects that are in the second snapshot but not in my baseline snapshot? Looking around online, I see some suggestions that I need to use hprof instead of jmap to make my memory dumps, but it appears that hprof generates dumps in exactly the same format. This is JDK 1.6.0_...

Can I compare hprof/jmap dumps with VisualVM?

VisualVM crashes when I try to profile our application with it, but if I could load the jmap memory dumps I've done from our application into VisualVM, I could probably get the answers I need without having to attach VisualVM to our app while it is running. So, is there a way to do this? ...