-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan,

Jonathan Mast wrote:
| | This is really the only way to do it. The other option is to create a
| | new request object and stuff your own parameters into it (or, better
| | yet, wrap the original request and add your parameters only to the
| wrapper).
|
| How would I do this?  This is basically what Jakarta Commons HTTPClient
| package (org.apache.commons.httpclient.*) offers, correct?

I'm pretty sure you don't want HTTPClient.

What you'd do is write your own new class called something like
AdditionalParameteHttpServletrsRequest and extend
HttpServletRequestWrapper. Override all methods that deal with
parameters and add your own parameters when appropriate.

| I thought such manipulation would be achievable without additional
packages.

It is. You just have to write some of your own code.

| | Why do you believe that adding parameters to the URL is not scalable?
| Well, its not scalegent, to coin a term;
| String munging is expensive (scalability), and
| StringBuffer sb = new StringBuffer();
|
sb.append("page.jsp?").append("foo=").append(bar).append("&color=").append(myColor).etc()
| is rough to look at (elegent).

String munging will be done whether you code it yourself or you delegate
it to some other utility (such as the JSP's version of the same code, or
to HTTPClient, or whatever).

If you don't want to look at the code, put it into a utility method with
an interface like MyParameterUtility.addParameter(String nanme, String
value). That will also give you the opportunity to properly URI-escape
both the parameter names and values.

| Why not just:
| HashMap myParams = new HashMap();
| myParams.put("foo", bar);
| ...
| pageContext.forward("page.jsp", myParams)   ?

Because that's not part of the interface, unfortunately. Feel free to
lobby a member of the JCP to add that method to the RequestDispatcher
(PageContext is a bad place to put something like that).

| much more efficient and elegent, imho.

No, it just hides the code you don't like to see behind an interface.
You are perfectly capable of writing an interface such as that: I
suggest you do it. <shrug>

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkibA3IACgkQ9CaO5/Lv0PAPxwCfVEbASNxwpcqDmwvFrfJu3BYF
4voAoJW5ZxuVUs88kgIghhVOL2pVLq0+
=5rcT
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to