java

WebSphere App Server Not Compiling JSP/Tag Libs

Hello This is a problem that only occurs on application update (only tested through Admin Console, not CLI). Also, this is only happening on our development environment, which is identical to our prod env. On uninstall/install, everything is compiled properly. However, this is a large application and it takes long enough to do an upd...

Reusing a resultMap for different column names

Is there a way of reusing the same resultMap multiple times in a single query. For example, suppose I have a "foo" resultMap: <resultMap id="foo" class="Foo"> <result property="Bar" column="bar" /> </resultMap> Is there a way to define another resultMap that reuses the above for different columns? Something like... <resultMap id="...

Encryption of SOAP message in Axis 2

Hi, I need to use encryption (and signature) for a web-service (server side). I use axis2 and successfully added the rampart module (for WS-Security implementation). But rampart page (http://ws.apache.org/axis2/modules/rampart/1_2/security-module.html) is missing examples and the sample file are not really documented. So my question is ...

Why can final constants in Java be overriden?

Consider the following interface in Java: public interface I { public final String KEY = "a"; } And the following class: public class A implements I { public String KEY = "b"; public String getKey() { return KEY; } } Why is it possible for class A to come along and override interface I's final constant? Tr...

Axis2 Web Service Client Generation - Types without modifying the client

Is it possible with Axis2 and Eclipse to generate a Web Service client and have it use java types that you already have in packages instead of creating it's own types. Reason being of course if I have type A already created and it creates it's own Type A I can't just assign variable of type A to variable of type B. The wsdl is being ge...

Transform a String to URL standard String in Java

I have a String such as: Cerepedia, una apliación web I would like to transform it into something URL valid such as: Cerepedia,unaaplicacionweb Note: the special character transformation and spaces removal. By the way, are commas allowed in URLs? ...

Named blocks to limit variable scope: good idea?

For years, I've been using named blocks to limit the scope of temporary variables. I've never seen this done anywhere else, which makes me wonder if this is a bad idea. Especially since the Eclipse IDE flags these as warnings by default. I've used this to good effect, I think, in my own code. But since it is un-idiomatic to the point...

The most sophisticated way for creating comma-separated Strings from a Collection/Array/List?

During my work with databases i noticed that i write query strings and in this strings i have to put several restrictions in the where-clause from a list/array/collection. Should looks like this: select * from customer where customer.id in (34, 26, ..., 2); You can simplify this by reducing this to the question that you have collecti...

Java: At runtime, find all classes in app that extend a base class

I want to do something like this: List<Animal> animals = new ArrayList<Animal>(); for( Class c: list_of_all_classes_available_to_my_app() ) if (c is Anamal) animals.add( new c() ); So, I want to look at all of the classes in my application's universe and when I find one that descends from Animal, I want to create a new objec...

Class with single method -- best approach?

Say I have a class that's meant to perform a single function. After performing the function, it can be destroyed. Is there any reason to prefer one of these approaches? // Initialize arguments in constructor MyClass myObject = new MyClass(arg1, arg2, arg3); myObject.myMethod(); // Pass arguments to method MyClass myObject = new MyClass...

Java XML Binding

What are you using for binding XML to Java? JAXB, Castor, and XMLBeans are some of the available choices. The comparisons that I've seen are all three or four years old. I'm open to other suggestions. Marshalling / unmarshalling performance and ease of use are of particular interest. Clarification: I'd like to see not just what framewor...

How do you get the length of a list in the JSF expression language?

How would I get the length of an ArrayList using a JSF EL expression? "#{MyBean.somelist.length}" does not work. ...

Object(Output|Input)Stream binary protocol

I was wondering if anyone had some resources that describe the binary protocol used by ObjectOutputStream. I realize of course that objects themselves can specify what their data by implementing the Externalizable interface, so I guess I'm looking more toward the structure of the object graph - the metadata if you will. I am writing a C...

Raw Java 2D implementation of a scrollbar

How would I go about writing my own scrollbar using standard Java 2D. I really don't want to use swing, and I've already made up my own component parts for everything else such as buttons etc. I'm not really looking for code, rather the math involved in the event changes and the drawing. ...

Build Eclipse Java Project from Command Line

Is there a way to compile an Eclipse-based Java project from the command line? I'm trying to automate my build (using FinalBuilder not ant), and I'm neither a Java nor Eclipse expert. I can probably figure out how to do this with straight java command line options, but then the Eclipse project feels like a lot of wasted effort. In th...

Java IDE market share?

Is there an up-to-date survey of Java IDE market share published on the web? I found stats from five years ago when I searched. NB This question is not designed to be a poll of the stackoverflow community for favorite Java IDE. However, that poll does exist. ...

Exact state of committed memory in java

Im curious what the exact meaning of "committed" memory is when the value is queried from the MemoryUsage class. That class explains it as "committed represents the amount of memory (in bytes) that is guaranteed to be available for use by the Java virtual machine." Does this mean that the memory is in use by the jvm process and NOT ava...

How do you develop Java Servlets using Eclipse?

I would like to program Java servlets using Eclipse and I plan on deploying them using Tomcat. I think I can build the projects using Ant which is bundled with Eclipse. I have the standard Eclipse IDE. What options do I have for doing Servlet development in Eclipse? What changes do I need to make to Eclipse? Do I need to install a plug-i...

How to map sorted index back to original index for collection I'm sorting.

I've got a collection (List<Rectangle>) which I need to sort left-right. That part's easy. Then I want to iterate through the Rectangles in their original order, but easily find their index in the sorted collection. indexOf() won't work, since I may have a number of equal objects. I can't help feeling there should be an easy way to do th...

Can an ArrayList of Node contain non-Node type?

Can an ArrayList of Node contain a non-Node type? Is there a very dirty method of doing this with type casting? ...