I have run out of idea. 
If I come up with something useful, I'll inform you.

Shing

--- Joseph Hannon <[EMAIL PROTECTED]> wrote:

> Follow up: I can get the Visit object from my
> filter's ServletRequest 
> session.getAttribute("state:apply:Visit"), but I was
> attempting to 
> really use a proper HiveMind facility here.
> 
> Joseph
> 
> Joseph Hannon wrote:
> > Shing,
> > 
> > I very much appreciate your time on this by the
> way, and your website 
> > looks very handy. :)
> > 
> > I have gone back to the ApplicationServlet, and
> have written code as you 
> > show below into a static method in a singleton in
> my app.  When calling 
> > the method from a page class, Home, I get to my
> Visit object just as you 
> > did, so the method code is valid.  When calling
> the same method from my 
> > filter (non page class) I get the webRequest
> related exception, see 
> > below.  I did create a non page pojo from Home in
> which the pojo calls 
> > my method and it worked.  So non page pojos can do
> this but the filter 
> > can not. It definitely in not trivial to get to
> the Registry from a 
> > filter it would seem.  Not sure what to do now for
> the filter.  May have 
> > to look at HiveUtils.
> > 
> > Thanks,
> > Joseph
> > 
> > Exception:
> > java.lang.NullPointerException: Property
> 'webRequest' of <OuterProxy for 
> >
>
tapestry.globals.RequestGlobals(org.apache.tapestry.services.RequestGlobals)>
> 
> > is null. 
> >
>
$WebRequest_10c4ab9cc40._targetServiceProperty($WebRequest_10c4ab9cc40.java)
> 
> > 
> >        
>
$WebRequest_10c4ab9cc40.getSession($WebRequest_10c4ab9cc40.java)
> >        
>
$WebRequest_10c4ab9cc25.getSession($WebRequest_10c4ab9cc25.java)
> > 
> >
>
$WebRequest_10c4ab9cc24.getSession($WebRequest_10c4ab9cc24.java)
> 
> >
>
org.apache.tapestry.engine.state.SessionScopeManager.getSession(SessionScopeManager.java:48)
> 
> > 
> >
>
org.apache.tapestry.engine.state.SessionScopeManager.get(SessionScopeManager.java:64)
> 
> > 
> >
>
$StateObjectPersistenceManager_10c4ab9cc3b.get($StateObjectPersistenceManager_10c4ab9cc3b.java)
> 
> > 
> >
>
$StateObjectPersistenceManager_10c4ab9cc3a.get($StateObjectPersistenceManager_10c4ab9cc3a.java)
> 
> > 
> >
>
org.apache.tapestry.engine.state.StateObjectManagerImpl.get(StateObjectManagerImpl.java:50)
> 
> > 
> >
>
org.apache.tapestry.engine.state.ApplicationStateManagerImpl.get(ApplicationStateManagerImpl.java:60)
> 
> > 
> >
>
$ApplicationStateManager_10c4ab9cbfc.get($ApplicationStateManager_10c4ab9cbfc.java)
> 
> > 
> >
>
$ApplicationStateManager_10c4ab9cbfd.get($ApplicationStateManager_10c4ab9cbfd.java)
> 
> >       
>
foo.apply.utility.Utility.testASOService(Utility.java:61)
> 
> > 
>
foo.apply.application.SampleFilter.doFilter(SampleFilter.java:176)
> > 
> > 
> > Shing Hing Man wrote:
> >> The registry is stored in the servlet context.
> >> You can retreived it by :
> >>
> >>
> >>   String REGISTRY_KEY_PREFIX =
> >> "org.apache.tapestry.Registry:";
> >>     ServletContext context = getServletContext();
> >>     Registry registry = (Registry)
> >>        context.getAttribute(REGISTRY_KEY_PREFIX +
> >> "testPojoASO");
> >>     IInjectEnhancementWorker stateWorker =
> >> (IInjectEnhancementWorker)          
> >>
> registry.getService(IInjectEnhancementWorker.class);
> >>
> >> (In your case you need to replace  testPojoASO by
> the
> >> servlet name in web.xml.)
> >>
> >> In your orginal post, you have a custom
> ApplicationServlet.
> >> I have try the following approach with the code
> in
> >> your orginal post.
> >>
> >> Step 1) Use the framework ApplicationServlet.
> >>
> >> Step 2) Retrieve the registry as described above.
> >>
> >> Then I have no problem retrieving the stateWorker
> in
> >> the Home page  using the above method. (As long
> as you have access to the
> >> context servlet, you can get stateWorker.)
> >>
> >> Joseph : I am sending your a war file (binary and
> >> source) of the above example off the list.
> >>
> >> Shing
> >> --- Joseph Hannon <[EMAIL PROTECTED]> wrote:
> >>
> >>> Shing,
> >>>
> >>> Cool.  I did replace <set-object with the
> >>> <set-service and got the same exception.  If you
> will notice in my 
> >>> original post,
> >>> this was commented out, I uncommented it and
> commented the line with
> >>> <set-object .
> >>>
> >>> Would you mind showing some code where you are
> >>> getting your asoService class from a pojo?  I
> would like to see how 
> >>> you are
> >>> making the call that gets the service.  I
> suspect getting my registry
> >>> from my servlet is not the way to go.
> >>>
> >>> Thanks,
> >>> Joseph
> >>>
> >>> Shing Hing Man wrote:
> >>>>> How are you calling getAppStateManager(), from
> >>> what
> >>>>> class?  How are you getting access to the
> registry from a POJO?
> >>>>
> >>>> In my how-to, appStateManager is injected to
> >>>> the tapestry service asoSerivce by hivemind.
> >>>>
> >>>>
> >>>> The following piece of code is meant to be in
> the
> >>>> .java class of my asoService.
> >>>>   HelloMessage message = (HelloMessage)
> >>>> getAppStateManager().get("message");
> >>>>   
> >>>> Also, in the .java of my asoService, there is
> getter/setter method 
> >>>> for the property appStateManager.
> >>>>
> >>>>
> >>>> I have noticed that in your
> >>>> service-point id="InjectStateWorker", you have 
>  <set-object 
> >>>> property="applicationStateManager" 
> >>>>
> value="infrastructure:applicationStateManager"/>
> >>>>
> >>>> try replacing it by  <set-service
> property="applicationStateManager" 
> >>>>               
> >>
>
service-id="tapestry.state.ApplicationStateManager"/>
> >>>> Shing
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> --- Joseph Hannon <[EMAIL PROTECTED]>
> wrote:
> >>>>
> >>>>> Shing,
> >>>>>
> 
=== message truncated ===

Home page :
  http://uk.geocities.com/matmsh/index.html


        
        
                
___________________________________________________________ 
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease 
of use." - PC Magazine 
http://uk.docs.yahoo.com/nowyoucan.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to