java

Using HTTP OPTIONS to retrieve information about REST resources

This problem relates to the Restlet framework and Java When a client wants to discover the resources available on a server - they must send an HTTP request with OPTIONS as the request type. This is fine I guess for non human readable clients - i.e. in code rather than a browser. The problem I see here is - browsers (human readable) ...

How can the no. of pages in an OpenOffice.org spreadsheet be obtained programmatically?

I want to count the no. of pages that would be produced if I printed out an OpenOffice.org document. I can already do it for ODT files using the following code: public short getPageCount() { XModel model = (XModel) UnoRuntime.queryInterface(XModel.class, getDocument()); XTextViewCursorSupplier s...

Making life better by not using Java web frameworks?

I'm so tired of having to learn yet another Java web framework every other day. JSP, Struts, Wicket, JSF, JBoss Seam, Spring MVC to name just a few - all this countless frameworks out there try to address the same issues. However, none of them really solves the fundamental problems - that's why there are still coming up more and more new...

Unexpected java SimpleDateFormat parse exception

I can't understand why this few lines Date submissionT; SimpleDateFormat tempDate = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy"); public time_print(String time) { try { submissionT=tempDate.parse(time); } catch (Exception e) { System.out.println(e.toString() + ", " + tim...

How to hide midlet icon in sonyericsson

help me on this issue which you have stated here "Some newer Sony-Ericsson phones (with the JP8.3 platform onward) have a proprietary java application management API that can only be accessed if your MIDlet is signed by Sony-Ericsson, along with jad properties that allow you to hide your MIDlet icon from the user." I have developed an...

How to implement a JSR Specification

I'm considering implementing one or two JSR APIs. I have not yet read the entire specification (the plan is to read them as I code the implementation) but I am very familiar with them. I have read that the JSR process includes implementing a Test Compatibility Kit (TCK) for testing said JSR implementations. Before I start writing a bunc...

Parsing Large Text Files in Real-time (Java)

Hi all, I'm interested in parsing a fairly large text file in Java (1.6.x) and was wondering what approach(es) would be considered best practice? The file will probably be about 1Mb in size, and will consist of thousands of entries along the lines of; Entry { property1=value1 property2=value2 ... } etc. My first instinc...

Problem running a servlet.

I'm seeing a problem while attempting to run a java servlet under eclipse (Ganymede), I'm running Java 1.6 and Apache Tomcat 6.0. Here is what i am doing: Stop Tomcat. New Dynamic webproject. Call the project TestProject Use default options: Context = "TestProject", Context Directory = "WebContent", Java Source Directory = "src" Right...

Convert Java GUI Builder .form files to Source Code?

I have created a fairly substantial Java GUI application with many form windows where the settings are locked up in .form files. I am wondering is there any way to convert or refactor these .form files into real Java source code that I can modify? The GUI was created using Netbeans 6.5. ...

How does Java's Dynamic Proxy actually work?

I understand how to use Dynamic Proxies in Java but what I don't understand is how the VM actually creates a dynamic proxy. Does it generate bytecode and load it? Or something else? Thanks. ...

Free JSP hosting

Hi, I am looking for some free JSP hosting, that have support for: 1.Struts 2.JDK 1.6 3.Can have Apache Tomcat 4.one or two MySQL databases 5.Subdomains Thanks for your help BTW. Sorry for my english (I am from Czech) ...

interfaces in Java

In C#, it's common to have methods like this: public IPerson GetPerson() { // do stuff return new Person(..); } where "IPerson" is an interface used by Person, SpecialPerson, etc. In other words, although the method above returns a Person, a strategy pattern could be implemented such that a SpecialPerson is returned in lieu of a P...

hibernate lazy initilization problem

I want to manage a Transaction in my persistence layer, But when I try to fetch the results lazily I get this error: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role Can I use LockMode or any other way to solve this problem? Can a find a Object by its id without any Transaction? ...

Defining a class while a Java application is running.

In Java, is it possible to create a class definition on the fly while an application is running, and then create an object of that class? For example, a running application would read in a text file that contains a list of class members to include in the new class. The application would then define a class definition based on the list o...

How to collect logs in jboss related to a single request?

Hi! I am developing a Java EE web application that is run under JBoss. I want to do the following: When a user sends an http request (by opening a page or through AJAX) all the logs that are related to this request are collected and then saved into the database. By related I mean that they are being logged during the process of handlin...

log4j prints all levels

Hello, I've got log4j configured on my Java project with the following log4j.properties: log4j.rootLogger=WARNING, X log4j.appender.X=org.apache.log4j.ConsoleAppender log4j.appender.X.layout=org.apache.log4j.PatternLayout log4j.appender.X.layout.ConversionPattern=%p %m %n log4j.logger.org.hibernate.SQL=WARNING log4j.logger.com.****.s...

Hibernate Queries

Using Named Queries (located in your hibernate mapping xml file) is a nice way to separate your queries from your buisness logic. But what are the alternatives if your are using Hibernate Annotations for mapping? ...

How do I convert a String to an InputStream in Java?

Given a string: String exampleString = "example"; How do I convert this to an InputStream? ...

ColdFusion Query to java.sql.ResultSet

I've looked in the "undocumentation", and I can see how to create a coldfusion.sql.QueryTable from a ResultSet, but not the other way around. So, how can I extract the java.sql.ResultSet from a ColdFusion ( coldfusion.sql.QueryTable ) query object? ...

How do I use SwingWorker in java?

Hi all With regards my question (http://stackoverflow.com/questions/772713/call-repaint-from-another-class-in-java). I'm new to java, and I've had a look at some tutorials on SwingWorker, but I'm unsure how to implement it with the example code i gave in the previous question. Can anyone explain how to use SwingWorker with regards my li...