http session and applet

A

autogoor

Hi:

I am writing a web app with Servlet and Jsp. The app requires user
login. The user information is saved to a session bean. I then check
all request to server for the login information. Request without right
login information in the session will be denied. All those are pretty
standard.

One part of the project is to develop a upload Applet. User first login
to my site, go to the upload page, and then upload files to the server
with my Applet. One the server end, I have a servelt, say
"ReceiveServlet", to parse the upload which is in MultiPart format.
Before the parsing, the servlet also check the request for user login
information and deny the request if user did not loged in. My applet is
embeded in a jsp page, say "upload.jsp". User has to login to visit
this page.

My question comes with the Applet. When I wrote the applet, I frist
create a conection with HttpURLConnection. Then I post the binary data
in mutlipart format to "ReceiverServlet". There are some examples
online about how to do this. My question is:

1. When I post the data to server, is the login information in the
request?
2. Should I construct a new HttpURLConnection in my applet? What is
the relationship between this connection and my jsp session?
3. Is there a way to get the jsp session information and jsp
connection inside a Applet?

Thanks,

Autogoor
 
V

Viator

When I post the data to server, is the login information in the
request?
The Login information may be any where. You have to be specific about
exactly where are you putting this information and how are you
authenticating the user. Well as far as I can guess you must be putting
it in HttpSession Object. You must also be knowing that Servlets, and
JSP for that matter, use JSESSIONIS cookie or url parameter for session
tracking. So the matter is whether your applet post cookie to the
server or does nesserary url adjustment or not.
Should I construct a new HttpURLConnection in my applet? What is
the relationship between this connection and my jsp session?
Yes you can. Whether this url sends the cookies to the server is
dependent on your applet container implementation. Most versions of
Java Pugins already do this.
Is there a way to get the jsp session information and jsp
connection inside a Applet?
If you applet container does not take care of this. You can use
HttpClient package from apache-commons. There are several other on the
net (try google to find them).
Enjoy

Viator :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top