----------------------------------------------------------------
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 would like the change the behavior of getRemoteUser in the
HttpServletRequest object that gets passed into the service call.

I extended the HttpServlet and overrided the service call (the users of my
class will be expected to provide doGet and doPost).  With the
HttpServletRequest object passed to it, I would like to change the remote
user.

I see two ways to accomplish this:
        A. inheritance
        B. Decorator Pattern (aka Wrapper)

The trouble with inheritance, I don't know what class to extend.
HttpServletRequest is an interface.

The annoying part of the decorator pattern is that I must define all of the
methods of the HttpServletRequest interface and all of its super interfaces.

Example of B:
public class MyHttpServletRequest implements HttpServletRequest {
        HttpServletRequest req;
        String remoteuser;
        public IntranetHttpServletRequest(HttpServletRequest r,String
remoteu) {      req=r; remoteuser=remoteu; }
        public String getRemoteUser()  { return remoteuser; }

      //that is all the functionality I want to change...
        //But now I have to define all the methods in the various interfaces


      public String getAuthType()  { return req.getAuthType(); }
        public String getQueryString()  { return req.getQueryString(); }
        //etc........ very tedious
}

Any advice?


--
--------------------------------------------------------------
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