This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Applet to Servlet Call redirecting to Login page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Applet to Servlet Call redirecting to Login page" Watch "Applet to Servlet Call redirecting to Login page" New topic
Author

Applet to Servlet Call redirecting to Login page

Pathikreet Dutta
Greenhorn

Joined: Jan 22, 2014
Posts: 2
Hi All,

I have a situation wherein im calling a servlet from an Applet using the HTTPUrlConnection class.
But whenever im trying to hit the servlet i can see in the Java Console that the call to the Servlet URL is automatically redirected to the login page of the application as it is secured.

Any pointers on how i can make it work?
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2615
    
    9

So what were you expecting? Not the login page? Does the desired page have special privileges (eg require login) to access?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Pathikreet Dutta
Greenhorn

Joined: Jan 22, 2014
Posts: 2
Actually my requirement is to upload some files chunk by chunk to the server side code and this shud happen in the backend. So if a user is already logged in , then the applet should be able to go into the servlet. Moreover the login page that it is redirecting to also does not pop up , i just saw it in the Java Console.
for e.g;
Networking : Connecting to "..../Servlet" with JsessionID
Netwroking : Connecting to "..../login.html"
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2615
    
    9

Try printing the jsessionid to the console or something.

Another question I have is does applet know about session?? Because they are not the same as web apps/pages.

EDIT: Did a bit of googling and found that the session ID needs to pass to the applet in order for it to "know" it has a session. Answering my own question is I guess not.

Assuming you got the session ID, how are you initializing the applet?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet to Servlet Call redirecting to Login page