In my application(applet-servlet) I am using Http connection to communicate between applet & servlet
(object based) & I have to open and close the connection for every request.
Is there any way to re-use the http connection without closing the connection & Is it possible to maintain session
in this applet-servlet communication.
thanks in advance
Discussions
Web tier: servlets, JSP, Web frameworks: applet-servlet communication with persistent connection?
-
applet-servlet communication with persistent connection? (4 messages)
- Posted by: krishna kishore
- Posted on: April 16 2004 10:23 EDT
Threaded Messages (4)
- applet-servlet communication with persistent connection? by Mircea Crisan on April 16 2004 11:31 EDT
- more about applet-servlet communication - query ? by krishna kishore on April 20 2004 08:09 EDT
- applet-servlet communication by Paulo Benfatti on April 29 2004 08:38 EDT
- Applet Servlet Communication by Mohamed Sayed Ahmed on May 05 2004 04:58 EDT
-
applet-servlet communication with persistent connection?[ Go to top ]
- Posted by: Mircea Crisan
- Posted on: April 16 2004 11:31 EDT
- in response to krishna kishore
Hi,
The answer is: yes, you can mainiant the connection open. But I would not recommend this because mainianing an open connection for every client might need a many resources on yur server. I imagine that you want to keep the connection open so that the server could notify the client about some events. A simmillar behaviour can be obtained by periodically polling the server for new events.
Best regards, Mircea -
more about applet-servlet communication - query ?[ Go to top ]
- Posted by: krishna kishore
- Posted on: April 20 2004 08:09 EDT
- in response to Mircea Crisan
thanks Mircea Crisan
I want to use persistent connection only because
the no. of Users of my application are less & number of
request's by each User are more, so how can I use a
persistent between applet & servlet, please help
me in this regard
thanks in advance
krishna kishore -
applet-servlet communication[ Go to top ]
- Posted by: Paulo Benfatti
- Posted on: April 29 2004 08:38 EDT
- in response to krishna kishore
Hi,
I also need to make a connection to communicate between applet & servlet.
Can you send me some source code about how you are doing this communication?
Tks in adv,
Paulo Benfatti -
Applet Servlet Communication[ Go to top ]
- Posted by: Mohamed Sayed Ahmed
- Posted on: May 05 2004 04:58 EDT
- in response to krishna kishore
In My Application , i need to open a connection between Applet And Servlet using URlConnection
So in the Applet when the user press on the button , i want just to open a coonection with the servlet which just print ant statement , by using the following code
private void Send_actionPerformed(ActionEvent e)
{
try{
URL url_base = getCodeBase();
String strHost = url_base.getHost();
String strPath = url_base.getPath();
int inPort = url_base.getPort();
URL ServletURL = new URL("http://"+strHost+":"+inPort+strPath+"servlet/ServletServer");
URLConnection conn = ServletURL.openConnection();
conn.setUseCaches(false);
conn.setDoOutput(true);
OutputStream out = conn.getOutputStream();
ObjectOutputStream objOut = new ObjectOutputStream(out);
objOut.writeObject(new String("Just Test"));
objOut.flush();
objOut.close();
}
catch(MalformedURLException mue){
mue.printStackTrace();
System.out.println(mue.toString());
}
catch(IOException ioe){
ioe.printStackTrace();
}
}
so when i execute the prev code no action happen in the servlet , i print the url and it return the right servlet url but i don't know why the servlet didn't response so please help me