Re: Connect To Java Servlet using c# windows forms

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



in java servlet documents i saw such things :

public static string TheSessionId() {
HttpSessionState ss = HttpContext.Current.Session;
HttpContext.Current.Session["test"] = "test";
HttpContext.Current.Response.Write(ss.SessionID);
return "ok";
}


------------
public class MyServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();

HttpSession session = request.getSession(true);

out.println("The session ID: " + session.getId() + "<BR>");



i may need that session id.
how can i get that session id from servlet ?



On Wed, 14 May 2008 06:01:03 -0700 (PDT), "Jon Skeet [C# MVP]"
<skeet@xxxxxxxxx> wrote:

On May 14, 1:19 pm, inpuarg <donteventh...@xxxxxxxx> wrote:
well. after login if i try to browse a page it says session is invalid
etc. (as a custom message in turkish)

i am capturing https traffic using fiddler. i didn 't see any session
or cookie in both request or response header or detail. there is only
a token string. and i am parsing and sending it also. and i am not
doing anything about session or cookie management.

I strongly suspect it's that token which is controlling the session.
How are you determining the URLs to open? It could well be that
they're autogenerated (in the response links) with the session token
on them.

Jon
.



Relevant Pages

  • Re: pls help w/cookies.......
    ... into a session object in the server side). ... the output of the handler servlet contains a link to a viewer ...
    (comp.lang.java.help)
  • Re: How to re-use existing classes in JSP/JavaBeans/Servlets
    ... I want to instantiate them and have the instance ... so the lifecycle is that of the client session. ... Process all data that comes in a HTTP request within a servlet -- they're ... are a good match with JSPs, and JSPs are good for creating HTML views. ...
    (comp.lang.java.programmer)
  • Re: Servlet design question
    ... don't put huge objects in the session, ... Concerning fields in the servlet class itself, no, you shouldn't do it, ... > for that request only (e.g. request-related stuff scooped out of ... > wrapper also contains a reference to my SessionState object, ...
    (comp.lang.java.programmer)
  • Re: TOMCAT PROBLEM: Establishing a session
    ... > I have a java applet running inside the html produced by the java ... > servlet, we have written a second servlet which implements a HashTable ... Do note that where sessions are maintained via a session cookie, ... You must also take care when trying to pass request parameters ...
    (comp.lang.java.programmer)
  • Re: Share a Session
    ... >> You could write the sessionID into the applet tag as a parameter. ... > How exactly do I use the session id from the applet? ... same name that the servlet normally uses which is "JSESSIONID" ... will let you set a cookie header - I don't remember the exact ...
    (comp.lang.java.help)