java

Does DWR support method calls with GET?

Does DWR support method calls with GET? So I can use http caching to cache the result of the call... Is that possible? ...

dynamic combo-box list in java swt table

I create a Combo-box control in org.eclipse.swt.widgets.Table The code snippet is below ... TableEditor editor = new TableEditor (table_LLSimDataFileInfo); CCombo combo = new CCombo (table_LLSimDataFileInfo, SWT.NONE); combo.setText("CCombo"); combo.add("item 1"); combo.add("item 2"); editor.grabHorizontal = true; ...

How does "static reflection" work in java? (ex. in mockito or easymock)

I'm a .NET guy - and I mainly code in C#. Since C# 3.0, we can leverage lambda expressions and expression trees to use static reflection. For example, it is possible to implement GetMethodName in the following snippet to return the name of the method passed in parameter: string methodName = GetMethodName( o => o.DoSomething()); Console...

How do I pipe the Java console output to a file?

I found a bug in an application that completely freezes the JVM. The produced stacktrace would provide valuable information for the developers and I would like to retrieve it from the Java console. When the JVM crashes, the console is frozen and I cannot copy the contained text anymore. Is there way to pipe the Java console directly to ...

Itext embed font in a PDF

I have a pdf that has been created using the Foxit form designer. On my design system, I have the barcode font installed. The barcode font is used in one of the AcroFields. It appears that foxit does not embed the font in the document. I also have customers that do not have the barcode font installed in their computers, and thus I w...

How can I handle Castor unmarshaling of SOAP messages when the namespace is defined inside the operation tag?

I am developing a contract-first web service based on Spring-WS. I'm relying on Castor marshaling, and I have run into the following issue. Requests are being accepted when the "xmlns" namespace is defined in the Envelope tag, such as: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="h...

W/o function pointers, what's a recommended way to implement Callback in Java - other than interfaces?

I have a couple of classes that want to pass each other some information and be called back later, using that information (Callback pattern). Within my application, this mechanism serves two purposes: scheduled / delayed execution asynchronous execution involving messaging My objects basically say to each other "when you're finished...

Java: How to remove elements from a list while iterating over/adding to it

Hi! This question is a more special case of the problem described (and solved) in this question. I have two methods, stopAndRemove(ServerObject server) and a close() method. The later should close all servers and remove them from the server list. The list is defined as List<ServerObject> server. I do not want to have almost the same...

Most elegant way to clip a line?

I have a Rectangle2D and a Line2D. I want to "clip" the line so that only the part of the line which is within the rectangle remains. If none of the line is within the rectangle I want the line to be set to (0,0,0,0). Basically something along the lines of a Rectangle2D.intersect(Line2D src, Line2D dest) or something similar. Is ther...

How to run a NetBeans project in command prompt?

...

In Java what should I use for a PriorityQueue that returns the greatest element first?

Java's PriorityQueue places the least element at the head of the list, however I need it to place the greatest element at the head. What what's the neatest way to get a priority queue that behaves like that. Since I wrote the class stored in this queue I could simply reverse the results of compareTo, its not used outside this queue. H...

FindBugs not accepting bcel.jar in ANT script

I installed findbugs into my ant lib directory and added the following code into my main ANT script: <target name="findbugs" depends="init"> <findbugs home="C:\\findbugs\\" output="html outputFile="C:\\findbugs\\out.html" jvmargs="-Xms512M"> <sourcePath path="${messageaggregator.src}" /> <class location="${messageag...

Locating Serialization Issue in Complex Bean

I have a large bean graph that I'm trying to serialize. Getting serialization exception (a non-specific one). Anyone have a class that will help locate the issue? ...

What is scalable, fast, application server to use for developing services written in java

I am trying to develop some web services. I want to know a application server that is scalable, fast, has high throughput, and is not too complex. Also it doesn't need to implement J2EE, but the services will be written in java. ...

Java RegExp problem - .*(www).* vs. (www)

A buddy of mine is currently tinkering around with JpCap in Java and we found some interesting (maybe?) problem regarding regular expressions in Java. Only HTTP traffic is being captured and subsequently analyzed. For this purpose he is using a pattern like this one: Pattern p = Pattern.compile("(www)"); But what both of us have not ...

drawImage in Java applet flickers in Safari

I'm having a flicker problem in a Java applet in Safari (Mac). However, it's not the usual double buffering problem. I have isolated it down to one single drawImage call (no redundant repaint, no clear is called), which gives a white flicker before painting the image but not on every repaint. In fact, I measured the duration of the draw...

How do I include JavaHelp with my Eclipse project?

I am writing some applications that require to have a Help Contents system tied to it. I came across JavaHelp which seems perfect for what I need. The issue I am having is that when you download JavaHelp, it comes with its own bin folder which looks like you are suppose to use separately. However, I am pretty sure if I just copy some of...

How do I import the Host directive for Tomcat Server.xml from another file?

My company wants to be able to add other Hosts directives into our server.xml (configuration file for Tomcat). This Host directive goes inside the Engine directive. I will like to import a second file, example hosts.xml, so I can define the hosts in that separate files. <Host name="localhost" ...> ... <Valve className="org.apache.c...

What are some Java memory management best practices?

I am taking over some applications from a previous developer. When I run the applications through Eclipse, I see the memory usage and the heap size increase a lot. Upon further investigation, I see that they were creating an object over-and-over in a loop as well as other things. I started to go through and do some clean up. But the mor...

Doesn't Spring's dependency injection break information hiding?

Coming from a C++ background I have to master the complexity of the Java world and its frameworks. Looking at the spring framework for DI I am finding it difficult to believe that I have to make each setter function which will be subject for DI public. Doesn't that requirement break the principle of information hiding? Of course I...