beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Rohrlich" <rohrl...@bea.com>
Subject RE: inheriting pages in page flows
Date Fri, 24 Jun 2005 15:01:53 GMT
I understand that the forwards are not inherited. The case I'm
describing is a bit different from yours. I'll use yours as a starting
point.

Let's change 
    @Jpf.Action(
        forwards={
            @Jpf.Forward(name="complex2", path="derived_complex2.jsp")
        }
    )

to

    @Jpf.Action(
        forwards={
            @Jpf.Forward(name="complex2", path="base_complex2.jsp")
        }
    )

The important point here is that the action is overridden but the path
remains the same (still base_complex2.jsp). The behavior I want is
1 - if base_complex2.jsp is in the directory of the derived page flow it
is used
2 - if base_complex2.jsp is not in the directory of the derived page
flow it is located in the directory of the base page flow

If I understand your previous email the behavior I'm looking for isn't
possible. So, here is a question that might clear up my confusion. What
happens in each of these cases if you set inheritLocalPaths=true? I
believe the answer is that case 2 throws a PageNotFoundException.

Here is what I believe is the summary of what you are providing with
your solution:
- If inheritLocalPaths=false all pages must reside in the same package
as the extending page flow
- If inheritLocalPaths=true a page can reside in the package of the base
Controller if the action is not overridden.

This is certainly a big improvement over what we now have.

john

-----Original Message-----
From: Rich Feit [mailto:richfeit@gmail.com] 
Sent: Thursday, June 23, 2005 5:44 PM
To: Beehive Developers
Subject: Re: inheriting pages in page flows

I think the confusion is about what paths are inherited.  Forwards (and 
SimpleActions) are the only things that specify paths.  If you override 
an inherited action, you wouldn't be inheriting its forwards at all, so 
you'd only have the ones you defined on the inherited action.  Here's an

example:

/base/BaseController.jpf:
---
@Jpf.Controller(
    simpleActions={
        @Jpf.SimpleAction(name="simple1", path="base_simple1.jsp"),
        @Jpf.SimpleAction(name="simple2", path="base_simple2.jsp")
    }
)
public class BaseController
{
    @Jpf.Action(
        forwards={
            @Jpf.Forward(name="complex1", path="base_complex1.jsp")
        }
    )
    public Forward complex1()
    {
        ...
    }

    @Jpf.Action(
        forwards={
            @Jpf.Forward(name="complex2", path="base_complex2.jsp")
        }
    )
    public Forward complex2()
    {
        ...
    }
}

/derived/DerivedController.jpf:
---
@Jpf.Controller(
    simpleActions={
        @Jpf.SimpleAction(name="simple2", path="derived_simple2.jsp")
    },
    inheritLocalPaths=true
)
public class BaseController
{
    @Jpf.Action(
        forwards={
            @Jpf.Forward(name="complex2", path="derived_complex2.jsp")
        }
    )
    public Forward complex2()
    {
        ...
    }
}


Here's a table of actions/destinations (all actions being raised in the 
context of /derived):

    simple1       /base/base_simple1.jsp
    complex1      /base/base_complex1.jsp
    simple2       /derived/derived_simple2.jsp
    complex2      /derived/derived_complex2.jsp

Does this answer your question?

Rich  

John Rohrlich wrote:

>By at that level I mean in the directory of the page flow with the
>overriding action.
>
>also see inline comment
>
>- john
>
>-----Original Message-----
>From: Rich Feit [mailto:richfeit@gmail.com] 
>Sent: Thursday, June 23, 2005 2:59 PM
>To: Beehive Developers
>Subject: Re: inheriting pages in page flows
>
>I'm not sure what you mean by "at that level" -- are you asking whether

>overriding an action implies that you have to create a JSP that's 
>associated with the derived page flow?  If so, the answer is no -- 
>that's the whole point behind the idea of inheriting JSPs.  But I'm 
>probably misunderstanding what you're asking.  :)
>
>[JR] If the answer is no then I'm not sure how this is different from
>what I originally suggested. If you don't need to add a JSP if you
>override then how do you know if the local path is present? You are
>suggesting that the annotation be at the class level which leaves open
>the possibility that some JSPs will be local and some will be in the
>directory of the base class page flow.
>
>Suppose you have two actions that you override. In case one you forward
>to foo.jsp which is found local to the base page flow. In case two you
>forward to bar.jsp and you add a bar.jsp in the directory of the
>extending page flow
>
>baseFlow/
>		foo.jsp
>		bar.jsp
>extendingFlow/
>		bar.jsp
>
>>>From what you've said so far I'm not certain what happens. I belive
that
>if I set inheritLocalPaths=false then the action forwarding to foo.jsp
>will fail from the extending page flow. If I set inheritLocalPaths=true
>then I would expect foo.jsp to be found. But what about the action
>forwarding to bar.jsp? I assume that I get the one in the extending
flow
>directory in both cases (true or false). 
>
>If you don't follow this maybe you could set up your own example to
>better explain your design.
>
>thanks - john
>
>
>John Rohrlich wrote:
>
>  
>
>>So are you saying that overriding an action means also adding a jsp at
>>that level?
>>
>>- john
>>
>>-----Original Message-----
>>From: Rich Feit [mailto:richfeit@gmail.com] 
>>Sent: Thursday, June 23, 2005 2:44 PM
>>To: Beehive Developers
>>Subject: Re: inheriting pages in page flows
>>
>>Hi John,
>>
>>I agree that this would be ideal, but I don't think it's possible 
>>(should have made it clear in the original email).  There's no way at 
>>build time to know for certain whether a local path is "present", and 
>>there's also no way at runtime to know if it's "present" beyond trying

>>to hit it and looking for a 404 result.  This is true for JSPs as well

>>as for other arbitrary Servlet paths.
>>
>>Rich
>>
>>John Rohrlich wrote:
>>
>> 
>>
>>    
>>
>>>A good start Rich, but I'd like to see some additional behavior.
>>>
>>>Allow action overrides to use pages local to the overridden actions
>>>   
>>>
>>>      
>>>
>>page
>> 
>>
>>    
>>
>>>flow directory if the page is not found local to the overriding
class.
>>>This should work for n levels of inheritance. If class B extends
class
>>>C, and class A extends class B, and both extending classes override
>>>      
>>>
>the
>  
>
>>>same action then you would first look for a jsp in A's directory. If
>>>   
>>>
>>>      
>>>
>>you
>> 
>>
>>    
>>
>>>didn't find the jsp you would look in B's directory and then finally
>>>   
>>>
>>>      
>>>
>>C's
>> 
>>
>>    
>>
>>>directory.
>>>
>>>- john
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: Rich Feit [mailto:richfeit@gmail.com] 
>>>Sent: Thursday, June 23, 2005 11:13 AM
>>>To: Beehive Developers
>>>Subject: inheriting pages in page flows
>>>
>>>Hi all,
>>>
>>>I'd like some design feedback here.  
>>>http://issues.apache.org/jira/browse/BEEHIVE-400 deals with a
>>>   
>>>
>>>      
>>>
>>much-asked
>> 
>>
>>    
>>
>>>question: if you have a page flow that inherits from another page
>>>      
>>>
>flow,
>  
>
>>>   
>>>
>>>      
>>>
>> 
>>
>>    
>>
>>>how can you also inherit pages from the base page flow?  Currently, 
>>>there's no good way to do it, which is an obvious hole.  My thought
is
>>>      
>>>
>
>  
>
>>>to do something really simple (from the user's point of view :) ),
>>>      
>>>
>like
>  
>
>>>   
>>>
>>>      
>>>
>> 
>>
>>    
>>
>>>have a class-level annotation attribute:
>>>
>>>  inheritLocalPaths=true
>>>
>>>This would cause local paths in *inherited* actions to be used in the

>>>context of the current page flow.  I think this might be sufficient,
>>>   
>>>
>>>      
>>>
>>and
>> 
>>
>>    
>>
>>>even if it turns out it's not, it seems like a good start.  Any 
>>>thoughts/comments on this?
>>>
>>>Thanks,
>>>Rich
>>>
>>>
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>
>> 
>>
>>    
>>
>
>
>
>  
>



Mime
View raw message