servlets

Why is (javax.servlet.)SingleThreadModel deprecated?

Why is javax.servlet.SingleThreadModel deprecated? ...

Implementing logout function

Hi, I am working on my final year project which is an web based application. I want to implement logout function in that project. But don't know how to do that. Also I want to implement auto logout functionality i.e. after a particular time period say after 20 minutes a user will be automatically logged out if he/she does not perform any...

Why Java servlet can't get Paypal IPN messages everytime ?

I have a Java servlet running on my notebook with Windows Vista, I set up a static IP, did port forwarding and registered for a free DDNS service, now my servlet is running, I gave the url to Paypal to send me IPN messages, I went on to it's sandbox site got to the test tools page, tried to send test messages by clicking the "Send IPN" b...

When I mix JSTL 1.0 and JSTL 1.1 taglib declarations, it causes a ParseException on some of my servers, but not all of them. Why?

When I mix JSTL 1.0 and JSTL 1.1 taglib declarations, it causes a ParseException on some of my servers, but not all of them. Here is the block of code that's giving me trouble: <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%&gt; <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%&gt; <c:set var="TEXTVARIABL...

How to get login password in servlets

I've successfully implemented form based authentication, and now I want to get the username and password to initialize session object in javamail from servlets. How can I do that? I can getlogin username by using method request.getRemoteUser(), but I don't know how to get the password. If I create any session object like: authenticatio...

Google App Engine atomic section?

Say you retrieve a set of records from the datastore (something like: select * from MyClass where reserved='false'). how do i ensure that another user doesn't set the reserved is still false? I've looked in the Transaction documentation and got shocked from google's solution which is to catch the exception and retry in a loop. Any so...

Is getServletContext() officially supported in GAE?

Is getServletContext() officially supported in GAE? is it ok if servers are distributed among diff locations? performance? could I use 'synchronize' within the doPost or in a task queue before updating a value in the context? ...

javax.servlet.ServletException - how could i get to the cause?

Hi, i'm getting a very strange error while opening one of the pages in my web app. The application is built on Seam 2.2 and is using JSF (RichFaces) in the presentation layer. I run it on Tomcat 6. In logs everything looks fine - each next JSF Phase executes normally, and after the last one, there is this moment when the request starts...

Porting from GAE to TomCat or another servlet server

Hi guys, I'm unhappy from GAE because - One can't have a global variable and the 'synchronize' keyword. Instead one have to catch a basically DB transcational exception and retry in a while loop - which will eat all my free CPU time and will start costing me money as I reach the google's qouata. Is it safe to use synchronize inside ...

copying the request header from request object to urlConnection object

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { URL url = new URL("http://localhost:8080/testy/Out"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod("POST"); Pr...

GAE transaction exceptions

ServletA: retrieves in a query a set of objects (around 2000) and then runs a weight function to choose one object and update it. all that is within a trasaction so it'll get an exception if the objects were changed ServletB: each object is being updated every 15 secs by robot clients So the record set that has been retrieved in ...

What happens when several Java servlet apps running on the same port ?

Something strange happened to my servlets and I think I've figured out why, yet I'm more confused. I used Netbean6.7 to develop a Paypal IPN (Instant Payment Notification) message servlet, it listens on port 8080 by default for Paypal IPN messages. I used some sample Java code from it's web site, but when it ran, only about 1 in 10 messa...

null pointer exception in setting response header in servlet

response.setHeader(keys[i].toString(),value); in a servlet is throwing null pointer exception even though none of keys[i] or value are null why is it so? ...

How to add response headers based on Content-type; getting Content-type before the response is committed

I want to set the Expires header for all image/* and text/css. I'm doing this in a Filter. However: before calling chain.doFilter(..) the Content-type is not yet "realized" after calling chain.doFilter(..) the Content-type is set, but so is content-length, which forbids adding new headers (at least in Tomcat implementation) I can use...

Anyone up to creating a tomcat based alternative for GAE?

Hi, If we had the possibility to run GAE app without any code change on our servlet engine that would be great because: in case that google changes their billing policy we can just jump to our own server or in case their current policy doesn't fit our app needs we can do stuff which is not allowed in the GAE, compromising a 1 JVM, 1 D...

Can an applet communicate with an instance of a servlet

Hello everyone, I have an applet that communicates with a servlet using Http (Not sockets). Currently, each instance of the applet (i.e. when each applet is run by a different client on a different computer), all the instances communicate with the same servlet. What I want is that each instance of the applet communicate with different i...

How to initiate chatting between two clients and two clients only, using applets and servlets?

Hello everyone, I first need to apologize for my earlier questions. (You can check my profile for them)They seemed to ask more questions than give answers. Hence, I am laying down the actual question that started all them absurd questions. I am trying to design a chat applet. Till now, I have coded the applet, servlet and communication...

passing json from servlet to dojo

I am currently trying to pass a generated JSON string to dojo for parsing and am having some issues. The servlet simply writes it as a string as so: response.getWriter().append("{ \"data\": {"); response.getWriter().append("\"type\": \"facing\","); response.getWriter().append("\"score\": " + "\"" + score + "\","); response.getWriter()....

How to call javascript function when url variable is sent

Hello, heres basically what I need to get done. I have a jsp page which allows me to add/modify/delete an item. The items are stored in a database which I have controller classes to access(dont worry bout that part) When an item gets selected and deleted the id of the item gets sent to the controller to be processed. The item will no...

Servlet unit test

Currently I'm using TestNG framework for testing application business logic, i added some Servlet classes recently. How do I unit test these Servlet classes in TestNg framework? ...