java

PHP communicating with Java Server

G'day, I have a project where I need to build a "live" java application (server) to hold state about domain objects (it's a private auction system). The java server will be communicating to and from PHP classes that hold the main back-end business functionality. The PHP classes will be stateless. I need to communicate domain objects up...

Getting the actual jsp line number from a stack trace line number?

Here is the stacktrace: ... org.apache.jsp.showcustomer_jsp._jspService(showcustomer_jsp.java:128) org.apache.jasper.runtime.HttpJspBase.service(Unknown Source) This is what I do: Get the line number from the stacktrace, in this case 128. Find the showcustomer_jsp.java file (and it isn't exactly obvious to look in /var/run/tomcat-6/...

How to avoid dupicate request?

If i click a link ia m calling a servlet. Is there any possibility to track the duplicate request thru filter or something so that i can avoid hitting the servlet? ...

Hibernate deleting orphans when updating collection

Hi I'm finding that orphan records aren't being deleted when removing from a collection in Hibernate. I must be doing something simple wrong, (this is Hibernate-101!), but I can't find it.. Given the following: public class Book { @ManyToOne @NotNull Author author; } public class Author { @OneToMany(cascade={CascadeTy...

How to use the type parameter of a generic parent inside of local classes?

Why can't I reference the type parameter of a generic parent class inside of contained local classes? public class IsGeneric<T> { public void doSomething(T arg) { class A { T x; } A foo = new A(); foo.x = arg; T bar = foo.x; // error: found java.lang.Object, required T } } ...

Integration testing Spring web app

Hi, I need to do an integration tests on my web application on each build. Currently I have a set of JUnit tests, which tests various parts of an application before it constructed into war. What I need to do now is to test if application is in good shape after it is deployed into Web container. The application is written using Spring...

How can I replicate "SHOW TABLES" in Hibernate?

I'm trying to iterate over all of my tables so I can truncate each one (at the beginning of each of my JBehave tests). I thought I would be able to: List<String> allTables = session.createSQLQuery("SHOW TABLES").list(); But hibernate throws a SQLGrammarException, complaining that "Column 'TABLE_NAME' not found." I guess this is beca...

Wrapping BSD select() with JNA

I need to wrap a BSD-like C socket API to Java with JNA. It has basically the same functions as standard BSD socket API. Wrapping select() is problematic because of the fd_set-structure required in its arguments and the FD_* masking functions (macros) that are needed to handle fd_sets. I tried to crawl through the header files (e.g. sys...

Advantages of Java over Ruby/JRuby

I am learning Java. I have learned and used Ruby. The Ruby books always tell the advantages of Ruby over Java. But there must be some advantages, that's why lots of people (especially companies) use Java and not Ruby. Please tell the absolute(not philosophical!) advantages of Java over Ruby. ...

Hiding deleted objects

Hi I have the following use case: There's a class called Template and with that class I can create instances of the ActualObject class (ActualObject copies its inital data from the Template). The Template class has a list of Product:s. Now here comes the tricky part, the user should be able to delete Products from the database but thes...

Strategy for locale sensitive sort with pagination

Hi, I work on an application that is deployed on the web. Part of the app is search functions where the result is presented in a sorted list. The application targets users in several countries using different locales (= sorting rules). I need to find a solution for sorting correctly for all users. I currently sort with ORDER BY in my S...

Serialization of Entity classes using Xstream

I'm using Xstream to serialize a EJB entity class to be transferred by a web service, but it also writes the database specific information in this case the following code. Is it possible to omit this information? <oracle.toplink.essentials.internal.helper.DatabaseField> <scale>0</scale> ...

How to port web ui to desktop app?

I have seen a lot of people try to make a web ui looks like a desktop ui. However, most of the time i feel web ui is much more interesting than the desktop ui, with the help of javascript toolkit like jquery, gwt-ext etc. My question is, how to port the web ui to desktop ui? Do I need to embed a javascript engine in java? css engine? ht...

How to set list of parameters on prepared statement?

i have a list of names e.g.: List<String> names = ... names.add('charles'); ... and a statement: PreparedStatement stmt = conn.prepareStatement('select * from person where name in ( ? )'); how to do the following: stmt.setParameterList(1,names); Is there a workaround? can someone explain why this method is missing? using: ja...

Alternate solution for RSA security ID

Do we have any alternate solution to replace RSA Security ID for the web-application developed in JAVA-Servlet? More Details: The Current application uses RSA Security ID for authentication. Now we are planning to replace "RSA Security ID" technology. Is there any way to implement this authentication? (Simply db/ldap password are not ...

How To download web page using java as well preserve image files

How to download the page and the images given the url using java. A similar question was avaialble already, which when tried just saves the page and not the images. ...

The activator bundle is invalid

I'm trying to create a simple plugin in eclipse. When I run the application, i saw this error in log file.. org.osgi.framework.BundleException : The activator for bundle org.x.y.Activator for bundle org.x.y is invalid. Do you have any idea about this error? ...

How to get the current date and time of your timezone in Java?

I have my app hosted in a London Server. I am in Madrid, Spain. So the timezone is -2 hours. How can I obtain the current date / time with my time zone. Date curr_date = new Date(System.currentTimeMillis()); e.g. Date curr_date = new Date(System.currentTimeMillis("MAD_TIMEZONE")); With JODA DateTimeZone zone = DateTimeZone.forI...

eclipse plugin - treat non java extension file like a java file

Hi We are developing an eclipse plugin and we have an extension like say, ".xyz" but it actually contains java code. JavaCore.createCompilationUnitFrom() accepts only files with extension ".java". JavaCore has JAVA_SOURCE_CONTENT_TYPE which returns the extensions that it treats as Java source files. My questions is How do I add ".xyz" ...

playing flv videos in jsp/j2ee

i want to play flv videos on my website. The video files are not stored on my server but i only have the url of video . The url of video donot end with .flv. So my flv player( jw player) gives error "video not found " . only if the url is ending with .flv then it plays. How can i play the videos whose path dont end with .flv ?? I cant ...