• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to restore a session in a Servlet created in another Servlet on Glassfish (v4)?  RSS feed

 
Greenhorn
Posts: 4
Java Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Community,

I stuck with a problem I can't find a solution to and I already tried to get help on stackoverflow (https://stackoverflow.com/questions/49572255/how-to-restore-a-session-in-a-servlet-created-in-another-on-glassfishv4) but because nobody could help me there I would like to ask here too, maybe here are the experts that can point out what I am doing wrong.
I am using Servlets to provide a webservice to an android app. My problem is that I create two objects in my LogonServlet which I would like to restore in my other servlets:

What I am aiming to do:

I want to create different servlets. One of these is my LogonServlet which creates and Object which deals with RFCs to a SAP. This object I want to restore on my other servlets for the same session.

What I have done so far:

LogonServlet: (no real user authentification because I am still testing functionality)


The code of a different servlet to restore the session variables:



The problem is that it always returns "null" for the session.

This is my web.xml


I have no clue what I am doing wrong. It could be some setup I need to activate in glassfish v4 or something I have to do in the client that the server knows I would like to continue the session. This is my first project with javaEE, glassfish and servlets.

Thank you very much in advance.
 
Author and ninkuma
Marshal
Posts: 66542
160
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mentioned that your client is an Android app. You need to check if the Android services support cookies or not -- I have no idea. Cookies are the default means by which sessions are maintained across requests.

If not, and there's no way to enable that, you might look into URL re-writing.
 
Ranch Foreman
Posts: 375
10
Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell me what this API is from : HttpServletStream hss = new GsonServletStream()
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!