java

Spring, db and property file configuration.

I have some JDO objects that I want to spring to configure with info from a property file. But since spring isn't used to create (i.e these objects are not listed as beans in the xml. Should they, how would it look?) these objects how can I get it to configure those objects? Only solution I can come up with is to have the property fil...

Where are the javadocs for Lotus' Notes.jar?

I need to use Lotus Notes/Domino as a data source from a Java application. The documentation at IBM says that the Notes.jar contains everything I will need, but where are the javadocs? ...

Assigning "null" to objects in every application after their use

Do you always assign null to an object after its scope has been reached? Or do you rely on the JVM for garbage collection? Do you do it for all sort of applications regardless of their length? If so, is it always a good practice? ...

dom4j cdata (keep whitespace)

Hello, I'm trying to get cdata text from a node using dom4j java. My issue here is that all of the line breaks are removed. Essentially, I need to read the contents of the CDATA as if it were a <pre> tag in HTML. Do you have any ideas? I have a very small time to get this done unfortunately so any help would be appreciated. Tha...

Caveats to watch for in transition from Sun JVM to JRockit?

We are thinking of transitioning a large product from relying on Sun's JVM to JRockit. I'm not naive enough to believe that this is going to be a smooth transition (though I'd love to be wrong). What issues should we watch out for or focus our regression testing on? ...

jnlp unaivalable service exception

I am trying to use the FileOpenSerivce, but I always get an UnaivableServiceException regardless of whether I run it from Eclipse, or from my local webserver using the jnlp file. I am using an unsigned jar, which from what I understand is ok. I got a debugger connected, and when running under Webstart, everything seems to succeed just...

How do you write unit tests for your java servlets?

Hi, what are the best practices to unit test java servlets? By the way: this is a topic in which I have some dificulty: how do you unit test your java servlets? ...

Restlet ClientResource Post Chunked Encoding - WCF Unsuported

Hello All, I'm developing a product that will use extensively of Restlet for consume WCF Rest Services. I had created a method to post a XML of a class containing 2 attributes. Restlet post my xml with Transfer-Encoding: chunked, and my WCF service, can't to interpret posted content, unfortunately WCF continues can't to deserialize my ...

Where is WebLogic Jar containing javax.servlet in 10.3?

I am trying to configure my path to include javax.servlet with WebLogic. WebLogic has split out the Jar files, so which one contains javax.servlet? ...

Jpa query pulling from cache instead of database?

I am hitting an issue with my Hibernate backed Jpa queries returning data that is not up to date. I assume it is an issue with pulling data from the cache instead of the database itself. For example, I will change and persist an object on one page and then go back to the previous page, which lists rows of the database, and it will show ...

Can a transaction have many threads?

Generally We have some business logic that is causing a bottle neck within a transaction. The business logic queries the database for a set of data (read only), processes it, and returns an object. This must be done many times with varying parameters in a given request. Can we theoretically break off each business logic call into a sepa...

Change encoding of HttpServletResponse

Hi, I have an API that returns XML, it actually returns it using the default encoding (I believe it's UTF-8), but now requirements have changed and we need to return everything in UTF-16LE. My question is: is there an easy way of doing this? I have access to the response just before the calls complete so I was wondering if I could do s...

get to the HttpServletRequest (request) object from java code

Hey guys, This is probably a very beginner level question. But I need to get hold of the request object in java code. I can't pass this object down to my code for certain reasons. Is there any way I can say something like: getCurrentHTTPServletRequest? It is safe for me to assume that I am in a Servlet Context. ...

Remove files using a unix-like pattern

Hello, I would like to implement something equivalent to the unix command 'rm foo*' using Java. Obviously, I want it to be multi platform. I know that this can be done using the FilenameFilter class and File.delete() method, but I was wondering if I can perform this simple operation in a less verbose way. Thanks in advance. ...

Numerical computation in Java.

Ok so I'm trying to use Apache Commons Math library to compute a double integral, but they are both from negative infinity (to around 1) and it's taking ages to compute. Are there any other ways of doing such operations in java? Or should it run "faster" (I mean I could actually see the result some day before I die) and I'm doing somethi...

When executing batch file from Java Runtime, native DOS commands fail to run

When I execute the batch file directly in DOS, everything runs as expected. But when I execute the batch file from Java runTime, it will run only the commands that invoke jar files (ie. invoke the JVM). It does not run any native dos commands. One problem is that I have no console to know why this is happening. I'm wondering if it's...

Is there a way to get the number of places after the decimal point in a java double?

I'm working on a Java/Groovy program. I have a double variable that holds a number that was typed in by a user. What I really want to know is how many numbers the user typed to the right of the decimal place. Something like: double num = 3.14 num.getPlaces() == 2 Of course, you can't do this with a double since that's using IEEE flo...

Escapse url GET parameters in URL with Java/ICEFaces

Hi, I have a JAVA with JSF/ICEFaces application. I need to pass parameters from one page to another so I user something like: <f:param name="eventName" value="#{item.event_name}" /> And then get it in the constructor using: eventName = request.getParameter("eventName"); While works fine unless there is a '/' character in the strin...

Force clear EJB3 cache in Glassfish

I have application written in Java that is using EJB3 + Toplink. I'm using Glassfish as my app. server. Sometimes the data that has been cached is old and I need to clear my cache manually. I know that we can set time to clear it, but I would like to make a button that will manually clear it for me. Is is possible to do? ...

Usage of Static variables in Java Servlets (e.g. in AppEngine)

I have an application where Servlet has a method called Update(ReqIn, ReqOut). I call it from doGet & doPost and pass the Request and Response variables, and it is then up to Update(...) to fill out the following static variables: ... public class Server extends HttpServlet { public static HttpServletRequest In = null; public s...