java

How does debug level (0-99) in the Tomcat server.xml affect speed?

The server.xml which controls the startup of Apache Tomcat's servlet container contains a debug attribute for nearly every major component. The debug attribute is more or less verbose depending upon the number you give it, zero being least and 99 being most verbose. How does the debug level affect Tomcat's speed when servicing large nu...

Method that returns the line number for a given JTextPane position?

I'm looking for a method that computes the line number of a given text position in a JTextPane with wrapping enabled. Example: This a very very very very very very very very very very very very very very very very very very very very very very long line. This is another very very very very very very very very very very very very v...

Not supported platforms for java.awt.Desktop.getDesktop()

Since Java 6 there is a class java.awt.Desktop. There are some nice methods but the class is not supported on all platforms. The methods java.awt.Desktop.getDesktop() throw an java.lang.UnsupportedOperationException: Desktop API is not supported on the current platform on some platforms. Or the method java.awt.Desktop.isDesktopSupported(...

Protect embedded password

I have a properties file in java, in wich i store all information of my app, like logo image filename, database name,database user and database password. I can store the password encrypted on the properties file. But, the key or passphrase can be read out of the jar using a decompiler. Is there a way to store the db pass in a properties ...

Reuse Spring Webflow definitions with different action implementations

Hi, I got pretty big webflow definition, which I do not want to copy/paste for reusing. There are references to action bean in XML, which is kind natural. I want to use same flow definiton twice: second time with actions configured differently (inject different implementation of service to it). Is there easy way to do this? ...

Apache and J2EE sharing security realms/logins, single sign-on

Here is the situation I'd like to create: www.blah.com/priv - protected by Apache HTTP Basic Auth, realm "foo" www.blah.com/application - protected by Tomcat/Servlet HTTP Basic Auth, realm "foo" User access /priv, apache requests login info, they provide and are given access Same user then requests /application. Since they have authen...

Get Form request with Seam/JSF

I have a query form that I would like to submit as a GET request so the result page may be bookmarked and otherwise RESTful. It's your classical text field with a submit button. How do I induce Seam/JSF to use GET and include the query expression as a parameter rather than POST, the default? ...

JSTL collection iteration

Hi, I have a java bean like this: class Person { int age; String name; } I'd like to iterate over a collection of these beans in a JSP, showing each person in a HTML table row, and in the last row of the table I'd like to show the total of all the ages. The code to generate the table rows will look something like this: <c:forEa...

How do I set an Application's Icon Globally in Swing?

I know I can specify one for each form, or for the root form and then it'll cascade through to all of the children forms, but I'd like to have a way of overriding the default Java Coffee Cup for all forms even those I might forget. Any suggestions? ...

Is there a Macro Recorder for Eclipse?

Anybody know of a good eclipse plugin for recording and playing back macros? I've tried this one, but it didn't do me any good- seemed like it wasn't ready for primetime. I know about editor templates, but I'm looking for something that I can use to record my keystrokes and then apply multiple times against a wad of text. This seems li...

How would you implement a secure static login credentials system in Java?

We recently had a security audit and it exposed several weaknesses in the systems that are in place here. One of the tasks that resulted from it is that we need to update our partner credentials system make it more secure. The "old" way of doing things was to generate a (bad) password, give it to the partner with an ID and then they ...

Does Weblogic 9.x support the 2.4 Servlet standard?

Seems like a simple enough question but I can't seem to find the answer. And hey, dead simple questions like this with dead simple answers is what Joel and Jeff want SO to be all about, right? ...

Best way of restarting a jetty instance

I'm using start.jar and stop.jar to stop and start my jetty instance. I restart by calling stop.jar, then start.jar. The problem is, if I don't sleep long enough between stop.jar and start.jar I start getting these random ClassNotFoundExceptions and the application doesn't work correctly. Sleeping for a longer period of time between sto...

Junit output and OutOfMemoryError

Hi! I'm running some JUnit tests on my applications. Every test has a for loop calling respective method 10000 times. The tested methods produce a lot of log. These logs are also automatically collected by JUnit as test output. This situation takes to OutOfMemoryError because the string buffer where JUnit keeps the output becomes too la...

The performance impact of using instanceof in Java

I am working on an application and one design approach involves extremely heavy use of the instanceof operator. While I know that OO design generally tries to avoid using instanceof, that is a different story and this question is purely related to performance. I was wondering if there is any performance impact? Is is just as fast as ==? ...

Tools to view/solve Windows XP memory fragmentation

We have a java program that requires a large amount of heap space - we start it with (among other command line arguments) the argument -Xmx1500m, which specifies a maximum heap space of 1500 MB. When starting this program on a Windows XP box that has been freshly rebooted, it will start and run without issues. But if the program has run ...

How do you add a button to the email message window toolbar in Lotus Notes 8.5+ ?

A coworker has been struggling with this problem. The desired result is an installable plugin for Notes that will add a button emails with attachments that will let users save the attachment to a document management system. Finding documentation on doing this for Notes has been an uphill battle to say the least. Writing the actual jav...

What is Your Favourite Area of the Java API?

I'm curious to know what other Java programmers feel is their favorite part of the language, why they feel that way, and why other programmers should want an intimate knowledge of it as well. I'm looking for reasons like simplicity, performance, etc. Thanks. ...

Communicating between Java and Flash without a Flash-specific server

I have Java and Flash client applications. What is the best way for the two to communicate without special Flash-specific servers such as BlazeDS or Red5? I am looking for a light client-only solution. ...

ResultSet not closed when connection closed?

I ve been doing code review (mostly using tools like FindBug) of one of our pet projects and FindBug marked following code as errorneus (pseudocode): Connection conn = dataSource.getConnection(); try{ PreparedStatement stmt = conn.prepareStatement(); //initialize the statement stmt.execute(); ResultSet rs = stmt.getRes...