avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: [RT] Containers and Components Adapting to Environments
Date Fri, 24 Oct 2003 08:24:42 GMT
Interesting RT.

Would it be possible to have a InvocationContextProvider
object:

    public interface InvocationContextProvider {
        public Context getContext ();
    }

    public interface InvocationContextAware {
        public void setInvocationContextProvider (
            InvocationContextProvider provider);
    }

Now, the idea is that the object returned by the 
InvocationContextProvider is dependent on the current service
method invocation. The proxy would, before invoking the target 
method, set the InvocationContextProvider to return the
current InvocationContext (by storing it in a thread-local variable).

To be servlet-specific:

    public interface RequestContextProvider {
        public Request getRequest ();
        public Session getSession ();
    }

    public interface RequestContextAware {
        public void setRequestContextProvider (
            RequestContextProvider provider);
    }

So you get this:

 1. Incoming call to component proxy.

 2. Component proxy knows request & session, since container knows.

 3. Component proxy knows the RequestContextProvider for component.

 4. Proxy tells RequestContextProvider about current request and
    session.

 5. RequestContextProvider puts the request and session info into
    a ThreadLocal variable.

 6. Proxy invokes target method on component.

 7. Component uses RequestContextProvider.getRequest() and .getSession()
    to get at the request and session.

/LS

> From: Berin Loritsch [mailto:bloritsch@apache.org] 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message