java

Recommendations... JavaServer Faces (JSF), Struts, model2, other

We are looking at reworking a java business management web service that has been in use for over 4 years now. The software's internal architecture has been all custom built and with a bad separation of of the presentation layer and business logic. As well the overall model layer has proven it can't effectively keep up with changing busin...

Get the Raw Request String from HttpServletRequest.

Is it possible to get the raw HTTP Request from the HttpServletRequest object? I want to see the raw request as a String if at all possible. I need to get the full text of the request, in this case it's a POST request, so the URL doesn't help. It's also part of a multi-part form, so I can't just call the "getParameterNames()" or "getPar...

JDK-7 SwingWorker deadlocks?

I have a small image processing application which does multiple things at once using SwingWorker. However, if I run the following code (oversimplified excerpt), it just hangs on JDK 7 b70 (windows) but works in 6u16. It starts a new worker within another worker and waits for its result (the real app runs multiple sub-workers and waits fo...

What is good Open source, Java based Shopping cart framework

I am looking for a simple, Open Source, Java based Shopping cart Framework. I am not looking for konakart or Offbiz which are huge and not just a framework. I am sure there should be some small framework or Jar etc for shopping cart. ...

Creating Strings from Bytes/Ints in Java

I'm wondering why the following code doesn't work: String test = new String(new byte[] {92, 92, 92, 92, 92}); System.out.println(test); String compare = "\\\\\\\\\\"; System.out.println(compare); if (test == compare) { System.out.println("Yes!"); } The output is: \\\\\ \\\\\ Where is a data type conversion happening that I'm not un...

Trying to set up Amazon S3 filesystem in Apache Commons VFS in java

I'm trying to use VFS S3 a plugin for the Apache Commons VFS for Amazon S3. I've included the jar and it's recognising the s3 schema. However when I try to open a file (which is public, I can open it on my web browser), I get this error: Could not create a file system manager of class "org.apache.commons.vfs.impl.StandardFileSystemMan...

Regular Expression for Parsing Hashtags in Java

I realize there are a couple of questions on this on the site, but none of them actually do a great job. They miss on some pretty typical use cases. Here is the Twitter message I am trying to parse (as you can see, some of these are not tags, just part of URLs, etc.): #anothertag Arrogance and bad PR http://www.adobe.com/index.html#anch...

HttpClient ThreadSafeClientConnManager throws "Connection reset"

I define HttpClient in 2 different ways: 1. Plain vanilla: client = new DefaultHttpClient(); 2. Thread safe: DefaultHttpClient getThreadSafeHttpClient() { HttpParams params = new BasicHttpParams(); params .setParameter( "http.useragent", "Mozilla/5.0 (Linux; U; Android 1.1; en...

C++ or Java for general programming?

Possible Duplicates: Why should i learn C++. Which one: C++ or Java? Hello. I only know Java and Assembly currently but was thinking of learning C++. However, I would like to hear from someone more experienced in the programming field which language should I dive into the most for general programming purposes (as in, the most ...

Find a class somewhere inside dozens of JAR files?

This isn't exactly a programming question, but it is indirectly related to CLASSPATH errors. I am unsure of the dependencies for this project. What is a good tool to search for a particular class name inside lots of jars files? Thank you. ...

How to wait until JComponent is fully painted?

I need a way to wait until a (Swing) JComponent is fully painted. This actual problem arises from an openmap application: The task is to draw a map (mapBean) with a couple of layers and create an image from that map. Unfortunatly, and it's clearly documented, the image formatter takes the current state from the map to create the picture...

hibernate mapping class

I have a project which it's domain contain following classes: Courier Customer Food Order Customer PrimitiveElement ResturantCustomerFacade ResturantOrderFacade And My database also has these tables: Courier Customer CustomizedFood CustomizedPrimitivePrice FoodType Order PrimitiveType ValueType and the classes which hibernate makes...

Double-spaced Java stacktrace in Matlab errors

In Matlab, when a Java exception is thrown by a Java method invoked from M-code, it is converted to a Matlab error or MException, and the Java stacktrace is included in the MException's message. On Windows, the stacktrace is displayed double spaced. Here's an example. package test; public class Bummer { public static void a() { b();...

Java Locale issue in vendor Applet

I have a vendor Applet that is trying to use no longer supported locale settings. De compiled Code is as follows String s1 = System.getProperty("java.version"); String s2 = System.getProperty("user.language"); String s; if(s1.regionMatches(true, 0, "1.4", 0, 3)) s = System.getProperty("user.country"); else s...

Programmatically close a JDialog

Is there a way to close a JDialog through code such that the Window event listeners will still be notified? I've tried just setting visible to false and disposing, but neither seem to do it. thanks, Jeff ...

How do I get <jsp:include /> functionality in a standard class?

Background: Migrating an application from ball of mud to MVC. Many classes contain HTML building methods. Refactoring as I add features, I'm not looking for a complete rewrite. I'd like to build some smaller views but need to render them in between some serious string building. To compose my views is a jsp I would use <jsp:include ...

Resolve JNDI lookups from Spring application context?

In our Spring application we use clustered Hibernate Search with ActiveMQ which sets up some objects via JNDI. These objects are configured via the Spring application context and I am looking for a way to resolve JNDI calls to these objects. All I could find was the JNDI lookups from the Spring context. We need it the other way around...

Java VM suddenly exiting without apparent reason

I have a problem with my Java progam suddenly exiting, without any exception thrown or the program finishing normally. I'm writing a program to solve Project Euler's 14th problem. This is what I got: private static final int INITIAL_CACHE_SIZE = 30000; private static Map<Long, Integer> cache = new HashMap<Long, Integer>(INITIAL_CACHE_S...

BigInteger.valueOf() for very big numbers?

What would be the best way to convert a 50-digit String to a BigInteger in Java? It doesn't have a valueOf(String) method, and I can't convert to Long because it's too small. ...

DBUnit and SQL Server getting a socket closed

I keep getting this exception with DBUnit in the same place: org.dbunit.dataset.DataSetException: com.microsoft.sqlserver.jdbc.SQLServerException: Socket closed at org.dbunit.database.DatabaseTableMetaData.getColumns(DatabaseTableMetaData.java:359) etc. Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Socket closed at co...