Hi Robert,
I think this could be of interest to the larger group. If you have some
time, I'd be happy to commit your patch (feel free to open a JIRA issue and
attach a patch against the latest CVS).
You mentioned that you patched your local copy. Actually it's possible for
you to have this feature without touching the Cactus codebase, which is
better I think as it allows you to upgrade seamlessly.
The solution is to write a custom wrapper around HttpServletRequestWrapper.
This custom wrapper would add the setUserPrincipal() method. In your test
you would write:
public void testXXX()
{
MyWrapper request2 = new MyWrapper(request);
[...]
// use request2 instead of request in all calls requiring a request
}
Thanks
-Vincent
> -----Original Message-----
> From: Robert Koberg [mailto:[EMAIL PROTECTED]
> Sent: mercredi 26 janvier 2005 23:20
> To: Cactus Users List
> Subject: Re: add setUserPrincipal(Principal) to HttpServletRequestWrapper?
>
> Vincent Massol wrote:
> > Hi Robert,
> >
> > What is your need?
>
> In my webapp I wrap the servlet request (in a filter) and put a custom
> Principal in there. (sounds similar to the message you reference below)
>
>
> >
> > Is it because you'd like to test code using servlet security API but you
> do
> > not wish to configure the security features of the container?
>
> Correct. I have patched HttpServletRequestWrapper in my working copy. I
> just figured it was not of interest to the larger group since there was
> no reply.
>
> no biggie,
> -Rob
>
>
> >
> > Some past thoughts on this:
> > http://www.mail-archive.com/[email protected]/msg00164.html
> >
> > -Vincent
> >
> >
> >>-----Original Message-----
> >>From: Robert Koberg [mailto:[EMAIL PROTECTED]
> >>Sent: jeudi 20 janvier 2005 04:49
> >>To: [email protected]
> >>Subject: add setUserPrincipal(Principal) to HttpServletRequestWrapper?
> >>
> >>Hi,
> >>
> >>Would it be generally useful to add a method like:
> >>
> >>private Principal principal;
> >>
> >>public void setUserPrincipal(Principal principal) {
> >> this.principal = principal;
> >>}
> >>
> >>
> >>public Principal getUserPrincipal() {
> >> return this.principal;
> >>}
> >>
> >>to HttpServletRequestWrapper?
> >>
> >>
> >>Or how would you suggest using a custom request wrapper in cactus? Is
> >>there a property I can set (I did not see one, but I might not know what
> >>I am looking for...)?
> >>
> >>best,
> >>-Rob
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Yahoo! Mail : http://fr.mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]