----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

> I'm very interested in the resolution of this also because I
> have a similar problem.  First, the HTML people want to do
> their HREF links with their own tools.  But these links will
> have name/value pairs.  Is there an API for reading/writing
> these name/value pairs into/outof the querystring of the url?  Also,
> does this interfere with session management?  I noticed that some
> Servlet-containers use cookies by default, but if cookies are "turned off",
> they steal the URL for sessions. 

JSDK 2.0's implementation of URL encoding handles existing parameters in
a URL fine. 

> This would interfere with putting
> name/value pairs into the URL in the HREF of the document, wouldn't it?

Nope, it doesn't appear to.

> So how are you doing this, Andy?

I figured I had two options. One was to create a URLEncodingOutputStream
class that encodes
stuff written to it or provide an Encoder class which provides some
handy features such as a method that
encodes URL's (HREF's and ACTION's) embedded in HTML passed in to it.
The reason for my
e-mail was to see if anyone had a "canned" solution. What I've done is
only handle
([Hh][rR][eE][Ff]|[Aa][cC][tT][iI][oO][nN])=".*" since I know all my
HREF's are in that form. 
It's not very resilient because it doesn't cope with HREF = "xxx" or
HREF=xxxx.
 
> My other question is in-line with the first post, which is, how do you
> "process" the files to rewrite the links without "chaining"? 

I don't think servlet chaining is the answer. I think a better soln is
to either:

a) have a class that provides an encoding service for strings when you
want it. 
b) provide a servlet you derive from that does something like:


... doPost (....)
{
        URLEncodingOutputStream out = new URLEncodingOutputStream
(response.getOutputStream ());

        doWork (...,out,...);
}

where derivations override doWork ()

c) Abstract all your servlet functionality into a separate class
heirarchy and just use one servlet
as a gateway (with encoding functionality). Hidden fields in the form
would point the servlet at the
right class.



> What's the
> right JSP way to do this?  Forwarding?

Dunno. Haven't used JSP in anger.


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to