java

JAX-WS Consuming web service with WS-Security and WS-Addressing

I'm trying to develop a standalone Java web service client with JAX-WS (Metro) that uses WS-Security with Username Token Authentication (Password digest, nonces and timestamp) and timestamp verification along with WS-Addressing over SSL. The WSDL I have to work with does not define any security policy information. I have been unable to...

Representing char as a byte in Java

Hi all, I must convert a char into a byte or a byte array. In other languages I know that a char is just a single byte. However, looking at the Java Character class, its min value is \u0000 and its max value is \uFFFF. This makes it seem like a char is 2 bytes long. Will I be able to store it as a byte or do I need to store it as ...

Hiding a "local" type parameter in Java

Suppose I'm using an interface with a generic type parameter interface Foo<T> { T getOne(); void useOne(T t); } The intention is that the type T is abstract: it enforces a type constraint on implementations of Foo, but the client code doesn't care exactly what T is. This is no problem in the context of a generic method: public <...

What happens to a branch of an OS project covered by software patents?

I was looking through patents authored by Lars Bak, when I realized a lot of them cover components of the the Sun JVM, HotSpot, etc. Now that parts Sun's stack is being released under FLOSS licenses, how does this affect people who are forking or using forks of this open source software? Are they not in violation of Sun's patents? ...

A good solution to include some template text into a source file using SVN?

I have a Java project in a SVN repository, with a bunch of .java files, each of those files has a licence agreement flower box at the top of the file (I have customers which have licenced the source as well as running the product). Is there a good way to be able to modify / maintain the licence text in one place rather than having to up...

Sync (oswego) vs Lock (JDK5)

Just to be sure, can experts confirm that java.util.concurrent.locks.Lock and Doug Lea's original Sync are basically the same thing but with different names. acquire vs lock release vs unlock Thanks. ...

Can I run java programs in a Windows Mobile 6 device?

I need to run a java program in a Windows Mobile 6 device. Is this possible? I need to do some tcp/ip programming with that so I can communicate to other computers. It's a simple computer class project, nothing fancy. Just sending messages and small files. Any suggestions? ...

Is there an easy way to output two columns to the console in Java?

As the title says, is there an easy way to output two columns to the console in Java? I'm aware of /t, but I haven't found a way to space based on a specific column when using printf. ...

Why this java link checker code does not compile?

I already read the link checker question posted in SO. If there are more questions of this kind and I missed them, my apologies. We need to find broken links in a website in a very easy way and scriptable way, so we can document the links that are broken. I found a blog post with some code written in java that will do exactly what I ne...

Java Web Application: How to implement caching techniques?

I am developing a Java web application that bases it behavior through large XML configuration files that are loaded from a web service. As these files are not actually required until a particular section of the application is accessed, they are loaded lazily. When one of these files are required, a query is sent to the webservice to retr...

Java Socket Programming

Java Socket Program did not work for WAN I have written a TCP IP socket program which works fine in my LAN. One of my friend is at bangalore He ran the server and I ran the client with the host name of my friend's IP. In this case my socket program did not work. ...

What is the best way to concatenate multiple PDFs into a single PDF in Java?

I have three PDF files. The first is a hand-craft marketing cover for a book, the second is rendered content from a DocBook --> XSLT --> FOP --> PDF process, and the third is some back cover content. Looking for the best way to concatenate these three PDFs into a single PDF. Anyone have any suggestions? ...

Java Socket Programming does not work for 10,000 clients

I can create multiple threads for supporting multi-client feature in socket programming; that's working fine. But if 10,000 clients want to be connected, my server cannot create so many threads. How can I manage the threads so that I can listen to all these clients simultaneously? Also, if in this case the server wants to send somethin...

Xstream object serialization

Given a class like this: public class Person { private String firstname; private String lastname; private PhoneNumber phone; private PhoneNumber fax; // ... constructors and methods private void calculate() { } } And an Xstream object like this: XStream xstream = new XStream(new DomDriver()); Person joe = new Person...

How do I argue against Duck-typing in a strongly typed language like Java?

I work on a team of Java programmers. One of my co-workers suggests from time-to-time that I do something like "just add a type field" (usu. "String type"). Or code will be committed laden with "if (foo instanceof Foo){...} else if( foo instanceof Bar){...}". Josh Bloch's admonition that "tagged classes are a wan imitation of a proper ...

How do we get back a specific session using sessionId?

I work on a task that involves moving/traversing from one application to another. The applications are in separate JVMs. While traversing to the other application, I keep track of the session ID. However, as I traverse back and forth, a new session gets created. Is there any way for me to get back the same session, using the sessionId...

Java Socket Programming behind proxy

I have written a TCP IP socket program which works fine. But my socket program did not work if my server or client is behind proxy. So how to overcome from this type of issue. Thanks Bapi ...

How can I handle Java object serialization with JavaScript?

public class Person { private String firstname; private String lastname; private PhoneNumber phone; private PhoneNumber fax; // ... constructors and methods private void calculate() { } } I have serialized the Java object located on the server side and sent it to the client XStream xstream = new XStream(new DomDriver()...

What is the use of Container in Swing?

What is the use of Container in Swing? ...

how add different shapes partially on JPanel+image which is on JPanel

My Project is in Java Swing. I have a JPanel on which I am adding some images with .png extension (which are on JLabels) at center. Now I want to add a line which will be partially on the JPanel & partially on that image. Currently when I am adding a line, JPanel shows the line but when I resize the image & drag it to the image, the i...