java

How to get the hash algorithm name using the OID in Java?

I am trying to compute the hash of a byte array in Java. To get a MessageDigest instance, I need to inform the hash name, but I only have the hash OID. Is there another way to do this or an existing map from hash OID to hash names? String oid = "1.2.3.4.5"; String digestAlgorithmName = getDigestAlgorithmName(oid); MessageDigest message...

Are there any Java-compilers that leverage an OSGi-environment instead of using the classpath?

Are there any ways to make javac use an existing OSGi-environment for the resolution of build-time dependencies instead of setting the classpath explicitely? I know I could write an OSGi-component that uses the Compiler-API of the JDK, but I think there should be a more straightforward solution. Alternatively, if no such extension is av...

How to implement a custom ColumnSorter with ScrollTable (GWT-incubator)

I've implemented my custom column sorter which is used to sort the elements in my table. class FileColumnSorter extends SortableGrid.ColumnSorter { @Override public void onSortColumn(SortableGrid sortableGrid, TableModelHelper.ColumnSortList columnSortList, SortableGrid.ColumnSort...

HttpServletRequest and getHeader(): How to handle case insensive headers properly?

Hi! Since is made aware of the fact that HTTP headers are case-insensive according to the RFC, i wonder how to handle this problem with Servlets. There is a #getHeader(String) method to obtain a header but it turned out that this method treats the header fields case sensive which is quite... annoying? Is there a proper way to obtain ...

Components not appearing in window

I am writing a program that has multiple text area separated by tabs. It works fine, except that when I first compile it none of the components appear on the window; it is solid grey. When I resize the window, though, they appear and the program runs fine. Any suggestions as to why this occurs and how to fix it? ...

Is there an open source tool, for exposing an existing database as a set of WebServices

I have an existing database (PostgreSQL in my case), and would like to access its data (Create, Read, Update, Delete, Query) through SOAP Web Services. What we are doing now, have JPA implementation of each Entity, and have an implementation of a generic CRUD interface. Then we expose these beans as JaxWS web services. The problem with t...

How do you automate Javascript minification for your Java web applications?

Hello SO, I'm interested in hearing how you prefer to automate Javascript minification for your Java web apps. Here are a few aspects I'm particularly interested in: How does it integrate? Is it part of your build tool, a servlet filter, a standalone program post-processing the WAR file, or something else? Is it easy to enable and dis...

Domain name interpretation utility for java

I find myself with a need for a java utility for taking a fully-qualified hostname, and producing the domain name from that. In the simple case, that means turning host.company.com into company.com, but this gets rapidly more complicated with host.subdomain.company.com, for example, or host.company.co.uk, where the meaning of "domain n...

JPA Instrumentation

Is it somehow possible to see the DDL produced when opening a EntityManagerFactory in JPA? I seem to be having some problems but no errors are produced. I don't see any sort of log file and no output is written to StdOut or StdErr. I have a log4j.properties in src/main/resources: log4j.appender.stdout=org.apache.log4j.ConsoleAppende...

Java properties - .properties files vs xml?

I'm a newbie when it comes to properties, and I read that XML is the preferred way to store these. I noticed however, that writing a regular .properties file in the style of foo=bar fu=baz also works. This would mean a lot less typing (and maybe easier to read and more efficient as well). So what are the benefits of using an XML file?...

java wait for dialog to be closed

Hi, i have a small program where an element is draged and dropped, when the drop is performed i open a dialog (extends Jframe) where some text should be entered. The Problem is, that i want to wait for this dialog to be closed (actually the ok button to be pressed so i can read out the data from the textfield), than analyse what the us...

Java Syntax: byte f()[] vs. byte[] f()

Just noticed in ByteArrayOutputStream, the toByteArray() is declared as, public synchronized byte toByteArray()[]; What's the difference between this declaration and the following one? public synchronized byte[] toByteArray(); ...

Parse Map from properties files

This is a follow-up to my previous question (found here). My properties files so far consists of simple key-value pairs, like ints and Strings. I would now like to use it to place some more advanced structures in it, more specifically I need a Map<A, Integer> where A is a class i have defined, for example like so: foo=bar,5;baz,10 Is ...

javax.jws.WebService.wsdlLocation with jboss 4.2.2

How specifically can you use the javax.jws.WebService.wsdlLocation in JBoss 4.2.2? (This is for an EJB3 bean deployed as a web service). There is some documentation around that it is supported, but what exactly is the format? I have tried an http, I have tried a relative URL. How does JBoss look for it, a URL, something on the classpath...

Error adding auto-complete component to ICEFaces screen

I am trying to create a pretty straight forward screen that has a text field with auto-complete functionality. I have been following the examples found on the ICEFaces website here. No matter what I try I keep getting this error: java.lang.ClassCastException: java.lang.String cannot be cast to javax.faces.model.SelectItem at co...

Java Media Player Error

I am trying to use javax.media.Player but it always throws CannotRealizeException. I have checked my URL and it seems to be right. I am using eclipse IDE and I have installed JMF2.1.1e in my programme files. I have also included JMF jars in external archives/referenced libraries of my projects. I am using 64bit windows Vista. Am I mis...

Best Practices for Patching Enterprise Java Systems?

As much as I've searched, I've not been able to find a single set of best practices for patching production enterprise java systems. I've even heard it described as a black art by one person. So, my question is, are there defined best practices for providing patches to production systems? What are they? References to any such practices ...

Using .class files in Eclipse for Java Developers

For a Java class assignment I was given a file named LogReader.class to use. How can I make Eclipse recognize that this compiled class exists so that I can use it? I tried putting it into my src folder but that did not work. I'd rather not go back to compiling with the command line. I do not have access to the source of LogReader.cla...

commandline equivalent to reverse engineering in Hibernate tools?

Is there a relatively simple way to reverse engineer a database from the command line and generate Hibernate artifacts based on the database? the only info I've been able to find on doing this requires jumping through lots of hoops with Hibernate tools that weren't designed for command line use, and ant build files. ...

Create a subset of a Java Eclipse project based on dependencies of one source file

I have a library Eclipse project/workspace containing functionality that is occasionally delivered to a customer. We're all researchers so this is done very informally; I make a JAR and a Word file with documentation, and send it to them. I prefer to send them a JAR file that only contains what they actually need, to simplify things. ...