I don't know in practise how to do this but in principle what you need to do
is send a cookie with the same session id with evey request, this means you
need to set a header variable using the following method of URLConnection:

public void setRequestProperty(String key, String value)

I am not quite sure what the key should be, try "sessionid" for starters
though. The value can be anything, as long as it consistent accross your
calls. The value should be inscrutably random for security purposes though.

Hopefully someone else can elaborate on this.

Cheers
Adrian

> -----Original Message-----
> From: randie ursal [SMTP:[EMAIL PROTECTED]]
> Sent: 03 February 2003 11:08
> To:   [EMAIL PROTECTED]
> Subject:      HttpClient to Servlet
>
> hi,
>
>    When i try to access my servlet from a Java Application using
> URLConnection, every request was considered as a new HttpSession. I was
> able to check this using the 'getSession(false)' and it result to not
> NULL which means that a new HttpSession was created. How can i implement
> my Java application so that when it request, my Servlet would not create
> a new HttpSession object.
>
>
> thanks.
>
>    randie
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com
--

It is the strict policy of Truworths that its e-mail facility and all
e-mail communications emanating therefrom, should be utilised for
business purposes only and should conform to high professional and
business standards.   Truworths has stipulated certain regulations in
terms whereof strict guidelines relating to the use and content of
e-mail communications are laid down. The use of the Truworths e-mail
facility is not permitted for the distribution of chain letters or
offensive mail of any nature whatsoever.   Truworths hereby distances
itself from and accepts no liability in respect of the unauthorised
use of its e-mail facility or the sending of e-mail communications
for other than strictly business purposes.   Truworths furthermore
disclaims liability for any  unauthorised instruction for  which
permission was not granted.    Truworths Limited accepts no liability
for any consequences arising from or as a result of reliance on this
message unless it is in respect of bona fide Truworths business for
which proper authorisation has been granted.

Any recipient of an unacceptable communication, a chain letter or
offensive material of any nature is requested to notify the Truworths
e-mail administrator ([EMAIL PROTECTED]) immediately in order that
appropriate action can be taken against the individual concerned.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to