« Return to Thread: How to programmatically add parameters to ServletRequest objects?

Re: How to programmatically add parameters to ServletRequest objects?

by awarnier :: Rate this Message:

Reply to Author | View in Thread

Christopher Schultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> André,
>
> André Warnier wrote:
> | I am a real beginner at Java and Tomcat, and not so good at it.
> | But maybe that causes my explanation below to be useful.
>
> Don't forget to override getDateHeader and getIntHeader in your wrapper
> class. Also, don't forget that some headers can have multiple values,
> which your code does not allow:
>
> http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/HttpServletRequest.html#getHeaders(java.lang.String)
>
Yes, I know, shame on me.  It is mentioned as a limitation in the sample
filter code however.  For the real filter this one comes from, I know
the application that follows, so I know I can afford to do this.

>
> Note that your strategy is the same as my original suggestion to the OP.
>
I know that too.
It's just that you evidently are a much better Java and Tomcat
programmer than many of us, and sometimes your responses seem to be
overly concise for guys like me.  So I tried an explanation for the masses.

I am very pleased and proud by the way that my explanation elicited only
the two remarks above, and was not shown down infamously.
;-)

After making that filter, I thought that it would have been more elegant
to check if the header requested by getHeader() was one I added, return
it in that case, and otherwise just call the getHeader() method of the
underlying HttpRequest object.  But considering it was my first filter,
and that it worked, I was just too lazy and scared to go change it again.

André

---------------------------------------------------------------------
To start a new topic, e-mail: users@...
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: How to programmatically add parameters to ServletRequest objects?