servlets

Difference between getLocalPort() and getServerPort() in servlets..

Hi I am studying servlets, I have come up with a doubt difference between getLocalPort() and getServerPort(). Here the getLocalPort() means server side only then whats the meaning of getServerPort()? Thanks. ...

A Java web project created with Maven is not recognized as such by Eclipse

I created a web project with maven like this: mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp Then I run mvn eclipse:eclipse so that an eclipse project is built. Eclipse recognizes all the features of the project but it doesn't recognize it as a web project. Therefor...

Java - How do I keep a user logged into my site for months?

I'm using OpenID. How do I make it so that the user stays logged in for a long time even after closing the browser window? How do I store and get access to the user's User object? Basically, I guess I just don't really understand how sessions work in java. ...

Consuming WebServices in Java

We are building a web-application and a significant portion of the project will be making real time calls from our servlets to some back end webservices. Some of these calls will be cached depending on the context. We will also have a reqiurement to handle incoming double byte character strings for languages such as Hebrew and CJK. ...

Any tool to view web session attributes?

I use jsp/Servlets for my web layer. Is there any tool to examine session attributes in a web session? ...

WebSockets served by a Servlet Container

I was taking a look at WebSockets last week and made a few thoughts on how to implement the server side with the Java Servlet API. I didn't spend too much time, but ran into the following problems during a few tests with Tomcat, which seem impossible to solve without patching the container or at least making container specific modificati...

Java Servlet Filter redirect problem

Hello, I'm having a problem with my authentication filter. When the filter redirects to the login page, no images gets displayed in the login JSP. However, if I go to the login page manually after I'm logged in, the images are displayed. I don't understand why this is happening! I appreciate any help. :-) AuthFilter: if (authorized...

Is ServletContext one per web-app or one per JVM?

Here is the doubt I have come up with ServletContext is one per web-app and one per JVM. But if I am running more than one web-app on the same JVM. Then it has 2 ServletContext per JVM. Is it Possible? Can anybody elaborate on this? ...

Troubleshoot JSP nullpointer exception problem

I am looking at a very old project and trying to fix some problems that this project is facing with related to its JSP pages throwing nullpointer exception. The JSP page is throwing a null pointer exception like the sample below. /e2fo/tools/user/search/searchUser.jsp. Exception thrown : java.lang.NullPointerException at com.ibm._...

Java Servlet Container on a small VPS

A while back I was using Virtual Private Server (VPS) that had very limited RAM. I used it to host Jetty. It was so slow that it became completely unusable. I believe the main problem was memory-related. I switched the project over to PHP and the problems disappeared. Needless to say, I'm very hesitant to try Java again in a VPS. E...

Multi part upload file servlet

How can I upload files and get other paramaters of a form? I want to handle multi part requests in Java servlet. ...

Getting Exception for Spring File upload

Hi , I am getting following Exception at the time of uploading the file using spring file upload functionality. trying to uplaod 291 KB jpg file. For less than 50 kb file it works properly. Following are bean entries <bean id="fileUploadController" class="com.businesscaliber.controller.FileUploadController"> <property name="...

Servlets returning information by setHeaders()

I have a (A) servlet listening for GETS from another Servlet (B). B is using an HTTPClient to do gets back to A as follows. get.setRequestHeader("name",job.getName().toString()); get.setRequestHeader("age",job.getAge()); get.setRequestHeader("sex",job.getSex()); Ordinarily I would have used the query string but I am not the dev on B ...

GWT app - deploying on Tomcat or any other servlet container

Hello Is there a plugin for Eclipse GWT or any other method to automatically deploy and run GWT app on Tomcat (or any other Serlvet container)? For the moment the only method I know is copying the compiled classes into WEB-INF directory but this is an arduous work. Additionally you have to configure Apache Tomcat manually. I'd like to h...

html report in jsp

My client have given me a HTML template for billing and I have to incorporate in my ongoing JSP/Servlet project. It is a raw HTML file and the output should be exactly same with page breaks and so on. It has one header table and one details table like our normal invoice. Any idea how to display the details in the report from Servlet/JSP?...

How do I pass an argument to a Google App Engine servlet?

I created a servlet that sends email alerts on a specified condition. the users can set alerts through the gui on the main page, but i want to give them the option of unregistering in each email thats sent. i want to include something like this in the email: If you'd like to unregister for this alert, please go to http://mysite.com/m...

Creating Java Web Service using Google AppEngine

I'm trying to create a simple web service application where I can retrieve a collection of strings and store them into a data store on the AppEngine server. I have knowledge in Java and barely any knowledge of Java Servlets and its WAR standards. I would like to at least have some direction on how to create a web service using the Java...

Eclipse JEE IDE not supporting javax.servlet package

I downloaded Eclipse JEE IDE to build Java Web Applications (servlets and jsp pages). But it still not supporting javax.servlet package. Why? What's the reason? Is there any plugin that I need to install? ...

HttpServletRequest to complete URL

I have an HttpServletRequest object. How do I get the complete and exact URL that cause this call to arrive at my servlet? Or at least as accurately as possible, as there are perhaps things that can be regenerated (the order of the parameters, perhaps). ...

Help with first spring MVC page using annotations

I'm trying to get http://localhost:8080/test to map to the index.jsp page. The jsp file is stored in the folder: /web-inf/jsp/index.jsp what I have so far: @Controller public class HomeController { @RequestMapping(value = "/test") public String Test(){ return "index"; } } My web.xml: <?xml version="1.0" ...