servlets

how to pass objects between two servlets?

hi, i am new to servlet programming. i want to know that... is it possible to pass objects between two servlets residing on different application servers??? say two tomcat servers... means what i want to do is: [browser]--> [app server 1 performs some operation on data]--> [server 2 does some operation on data] i am sure it is possibl...

What are the possible values of load_on_startup in a servlet entry on web.xml?

Obviously, load_on_startup value of 0 means don't, and 1 means do. But what does a value of 2 mean? EDIT: Obviously, I shouldn't assume things before I check them. A value of 0 still means load on startup. Thanks stacker. The servlet specification is surprisingly hard to reach. (Here's where I saw 2 as a possible value). ...

jQuery autocomplete works with a local string but not when the same String is called off the server

This is related to the question I asked at http://stackoverflow.com/questions/2802948/how-to-make-an-ajax-call-immediately-on-document-loading I am trying to get a String delimited by | characters from the server to use as input for jQuery's .autocomplete() plugin. If I have a local variable declared in the code then it works fine, but ...

Using a javax.servlet.Filter with Compojure

I'm trying to build a simple web site using Clojure / Compojure and want to feed apply a servlet filter to the request / response (i.e. a standard javax.servlet.Filter instance). e.g. if the current source code is: (defroutes my-app (GET "/*" (html [:h1 "Hello Foo!!"])) ) I would like to add a filter like this: (defroutes my-a...

How to create Chat application using Servlets & JSP

I want to create chat application using Servlets & JSP. May I know how can I create chat application as I have never created before? How much knowledge I need to have to create chat application? Is there any need of networking API to create chat application? What's the design pattern I need to follow to create that application? Is...

Java: Tracking a user login session - Session EJBs vs HTTPSession

If I want to keep track of a conversational state with each client using my web application, which is the better alternative - a Session Bean or a HTTP Session - to use? Using HTTP Session: //request is a variable of the class javax.servlet.http.HttpServletRequest //UserState is a POJO HttpSession session = request.getSession(true); Us...

does Jsp runs under the Servlet code?

if we write a code in jsp that will convert to servlet code and get runs. is it true? your suggestions are more thankful. ...

"session" bean scope in a web application - reliable ?

Can you rely on this scope and be sure that every time 1) a new session starts, the Spring bean will be initialized with default values 2) while session is kept alive, the current object will store its state during session life, will never be lost or corrupted and can always be got with [webappcontext].getBean ? ...

Adding an HTTP Header to the request in a servlet filter

I'm integrating with an existing servlet that pulls some properties out of the HTTP header. Basically, I'm implementing an interface that doesn't have access to the actual request, it just has access to a map of k->v for the HTTP headers. I need to pass in a request parameter. The plan is to use a servlet filter to go from parameter t...

Asynchronous Processing = Spanning Threads = Valid?

Hello Experts, am I allowed (without any sideeffects) to create and start a new Thread() from within a doGet() Method of a servlet? Or does this somehow leak ressources? Is it valid to also pass the "Session" Object into the Thread to later save the result of my asynchronous processing (I will synchronized correctly) in the session? Or...

Where to store a DataSource resource in a Java web app?

This is a rookie question. What's the best place to put @Resource private DataSource ds; in a web application? Do I put it in a servlet, context listener or maybe there's a better place for it? Also, do I create a new Connection object in my doGet()/doPost() or should I do it somewhere else? What's the best practice for stuff like thi...

RequestDispatcher forward between Tomcat instances

I have a scenario where I have single entry point Servlet and further Servlets that requests are forwarded to that undertake heavy processing. I am looking at options to distribute this load and I would like to know if it is possible using Tomcat or another platform to forward requests between Servlets sitting on different servers using...

What's the easiest way to add Java servlets to a WAMP configured machine?

I have WAMP installed on my local machine and am looking to serve up charts using jFree's Eastwood charting, which requires me to use servlets. So basically I will insert images with src tags that have URLs pointing to my servlet on the same machine. What's the easiest way to enable servlets on the same machine? Do I need to install a s...

Where does Tomcat append / to directory paths?

Suppose my Tomcat webapps directory looks like this: webapps/ webapps/fooapp/ webapps/fooapp/WEB-INF/ webapps/fooapp/WEB-INF/web.xml webapps/fooapp/bardir/ When I make a GET request for /fooapp/bardir, Tomcat sees that webapps/fooapp/bardir is a directory and sends back a 302 to /fooapp/bardir/ (with a slash at the end). Here is my q...

Struts2 combine with domain specific servlet

I have struts2 web application. Right now I need embed with help of iframe some functionality from stand-alone servlet. But according to following rule, servlet is never get calling. <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> Unfortunately I cannot change it to /prefix/...

Changing Tomcat Set-Cookie header

Is there any way to change the Set-Cookie header to something other than JSESSIONID? To something like ASP.NET_SessionId? ...

how to check if session exists or not

I am creating the session using HttpSession session=request.getSession(); before creating session i want to check if session is existing or not,how would i do this? ...

download large files using servlet

I am using Apache Tomcat Server 6 and Java 1.6 and am trying to write large mp3 files to the ServletOutputStream for a user to download. Files are ranging from a 50-750MB at the moment. The smaller files aren't causing too much of a problem but with the larger files it and getting socket exception broken pipe. File fileMp3 = new File(o...

Uploadify uploadSettings with scripData does not work

Hi everyone, I am sending a file to my Java Servlet via jQuery Uploadify, there are no problems while sending the actual file. But when I try to send some scriptData with file along, to process on Servlet it just does not send anything. Here is the JS code: $("button").click(function(){ $("#uploadify").uploadifySettings('scri...

Download dynamic file with GWT

I have a GWT page where user enter data (start date, end date, etc.), then this data goes to the server via RPC call. On the server I want to generate Excel report with POI and let user save that file on their local machine. This is my test code to stream file back to the client but for some reason I think it does not know how to stream...