java

Configure web.xml (Tomct 5) for one servlet to handle all incoming requests?

Basically I want one servlet to handle all incoming request regardless of the path. I'm on shared hosting environment with access to configure my own web.xml file. I have the following configured in web.xml, but it doesn't work on Tomcat 5: <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http:/...

Java Generic Question: Any better way?

[Update]: my initial example doesn't reflect my problem. Updated the sample, hopfully it is better now. Java Generic and overloading don't play well together. public interface Request<E> { E getValue(); } I have a generic parameterized Request interface as above, and I would like write a DataStore class to save the payload request ...

Event listener in Java without app having focus? (Global keypress detection)

I've been searching for a while and everybody seems to think this is not possible using just Java, so I'll give SO a shot ;) Is there any way to have my Java application listen for events (key events in particular) while another unrelated application has window focus? In my situation, I'm looking to detect when the user has pressed the ...

Best way to convert xml to have CDATA around text (in java)

I have a weird requirement where I need to take some xml and re-write it so that the text nodes are wrapped in CDATA (this is for a client that won't allow normal escaping). It doesn't seem like any of the normal XML libraries dom4j, jdom, java xml, have any built in support for this. Any ideas? Can I use XSLT for this? I wasn't very...

DecimalFormat and doubles

DecimalFormat parses Double.toString() representation (which could be in scientific and financial format). Why Sun has chosen this approach, instead of direct converting double to String? PS: To be more concrete. Why DecimalFormat internally uses Double.toString() in order to format Double, instead of formatting internal representation...

java impersonation to connect to sql server using windows authentication

right now I have the following architecture built with classic asp and visual basic 6 I have a COM+ component developed in VB6 which connects to the dabatase. I set the DB conf thru an .udl file configured with integrated security. At the web server (IIS) I register the componente with the com+ manager, and configure it to be run under...

Should I look at the bytecode that is produce by a java compiler?

No The JIT compiler may "transform" the bytecode into something completely different anyway. It will lead you to do premature optimization. Yes You do not know which method will be compiled by the JIT, so it is better if you optimize them all. It will make you a better Java programmer. I am asking without really knowing (obviou...

Delete Content of a File in Java

Hi, I'm writing bytes to temp.fls file. After completing the operation, I want to delete the last 256 bytes from the temp.fls file. How can I achieve this? Please help me. Thanks in advance. ...

Compression and Decompression in java doesnot work fine for different programming language

If i compress and decompress data using java then it works fine My if friend uses C#.NET to compress data while i am using java SO inthis case I can not decompress the same data. I am using inflatter and deflater in java. Thanks Bapi ...

Android schema validation

hi, I have created an XML and i am having an XSD file and i have to validate the xml with this schema ,can i get any example for doing that . And where i have to place the xsd file in my project so that i can validate with that schema. ...

Struts LookUpDispatchAction redirect

Hi all, We are migrating our web applications which use struts 1.2 and running on Weblogic 8.1 to Weblogic 10.3. Some action classes in our applications extend LookUpDispatchAction class. For these action classes if the redirect attribute in 'struts-config.xml' is set to true they are giving problem in Weblogic 10. I understood that ...

mapping data in properties files

I have the following data: User System SubSystem user1 System1 SubSystem1 user2 System1 SubSystem2 user3 N/A N/A and i need to be able to determine the system/subsystem tuple from the user. I must be able to add users at any time without rebuilding and redeploying the system I know the database would be the best option ...

call 2 or more views with one controller in spring java

hi guys and girls. i want to call 2 views within one controller in spring with java. for example this.controller.view('header'); this.controller.view('body'); this.controller.view('footer'); how can i do that? or it is possible in spring? or can you suggest any other way to do it? and can i call a view inside a view. for example in v...

how to create a secure licensed j2ee application?

We are developing a j2ee application backed by any database of customer choice. We will sell to customers based on per user license price. How do I make sure, the application is getting used as per our conditions, i.e., not easily hackable? Are there any tutorials available? ...

CPU Usage Spikes in WebSphere 6.1

First, just a bit of background: One of our customers is experiencing CPU usage spikes for WebSphere instances running one of our web apps (other instances with other apps are fine). They have a test environment and a live environment (both iSeries) which both experience the problem - with a single app per instance setup. We have deploy...

Create Custom Hashtable

Hi there.. I need to create a Custom Hashtable extends java.lang.Hashtable and i need to override the get method to achieve the following behavior : if the key == null, it will return a new object of the type V if the super.get(key) == null, it will also return a new object of type V. Can anyone help me. I try to do this but I know ...

disable "Rename" menuitem in eclipse

I have defined my own project nature . I need to disable right-click->"Rename..." and Refactor->"Rename..." menuitems for projects which are associated with "MyProjectNature". Any clues as to how it can be achieved in eclipse plugins ? ...

Block repeat problem with Java XMODEM implementation

I'm implementing XMODEM protocol in Java. In this protocol same block will repeat if packet doesn't match (when I send NAK again and again) but I'm getting it only 5 times. What might be the problem? ...

Java ProcessBuilder process.destroy() not killing child processes in winXP

Hello, I have a java app that uses ProcessBuilder to prepare an operating system command and gives me a Process object. (The actual os command is rsync over ssh using cygwin). This is working well in wondows, however if I want to stop the process using process.destroy() it will not kill the child ssh and rsync processes..... I have to m...

Android schema

hi, In java there is class SchemaFactory which is used for schema validation but it is not available in android is there any other option available ...