>>> Geoff Soutter <[EMAIL PROTECTED]> 6/21/99 10:13:36 AM >>>
>Does anyone know _when_ it is supposed to do it.
>That is, under what conditions the URL will be encoded (in whatever
format
>the engine decides to use).
When you call:
HttpServletResponse.sendRedirect(string)
The servlet engine is supposed to drop any existing output (that may
be buffered) and send a redirect response.
A redirect response is:
response code
response header with the Location header field given the value of the
URL to redirect to
a response body with HTML in it like the following:
<html>
<body>
Sorry that page does not exist.
You are being moved to <a href="_url_">a new location</a>.
If it doesn't work click on the link.
</body>
</html>
One of the major reasons the redirect URL needs to be encoded is for
insertion into the <A> tag.
So a code snippet for a session based servlet doing a redirect might
be:
public doGet(HttpServletRequest req,HttpServletResponse resp)
throws IOException
{
...
//decide to do a redirect to "http://someloc.org/myplace"
String target="http://someloc.org/myplace";
String enc_target=resp.encodeRedirectURL(target);
resp.sendRedirect(enc_target);
...
}
The encoded location is used by the engine to output the necessary
HTML response for the redirect.
It is always predictable.
I don't understand what you problem is here.
Perhaps you could explain what you are trying to do a bit more.
Nic Ferrier
Tapsell-Ferrier Ltd
www.tapsellferrier.co.uk
___________________________________________________________________________
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