> > because if it is automatically included i might as well just access the
> > response parameter name, in order for my java application to get the
> > session id generated by my servlet, i just don't know the parameter name
> > to use.
> >


That name should be different for dífferent containers...

> It's included in a cookie, the url or a request parameter.  It's up to the
> servlet container you are using what it is named and which one to use.  So
> you'll probably have to do some investigation on your own to figure it
out.


This works for CauchoResin:
try {
   URLConnection ucon = new URL("http://host/aServlet";).openConnection();
    String line = ucon.getHeaderFields().get("Set-Cookie").toString();
    int start = line.indexOf("JSESSIONID=")+"JSESSIONID=".length();
    String sessID = line.substring(start, line.indexOf(";", ++start));
}

But I'd prefer
a) To use a full-blown HttpClient (see jakarta) which handles cookies for
you
b) To let my servlet "give" me the ID (e.g. by including it somewhere hidden
in the response's content, or in a special header field)

That way you're indepedent of the servlet container you use.

HTH!

-mw

[TOFU deleted]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to