You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by Erik Noren <en...@motive.com> on 2005/01/26 20:59:48 UTC

Wrapping a Control around a Page Flow

After having looked through the Beehive docs and the BEA WorkShop docs,
I am under the impression that this is not possible, but a BEA
representative alluded to it as though it was, so I figured I would ask
a larger group.  

 

Is it possible to create a JavaControl that wraps a page flow?  If so,
is there a control for this already available or would this be a custom
control?  If there is not one available by default, anyone have any
advice on how to create one from a custom control?  

 

The ultimate goal is to be able to write a page flow that references a
nested page flow where the nested page flow is not part of the current
application.  The nested page flow would be on the same server, however
we would want to be able to deploy each nested page flow as a separate
WAR/Application and therefore don't want the implementation of that page
flow to have to be embedded in the consuming page flow.  The
representative alluded to using a Java Control around the Page Flow to
do this, but I as I stated earlier, I am not sure how that would work.
Any help would be appreciated, thanks!

 

Erik


Re: Wrapping a Control around a Page Flow

Posted by Richard Feit <ri...@bea.com>.
Hi Erik,

Currently in Beehive there isn't a mechanism for sharing data between
user sessions in different webapps, which is what would be required to
make this work in the way you're suggesting.  When you hit a nested page
flow, the current page flow is pushed onto a stack in the session, and
when the nested page flow "returns", the original page flow is popped
from the stack.  With different webapps, it's harder to share the stack
between the two sessions (some servers do support this, but it's not
part of the Servlet spec).

That said, you may be able to accomplish what you want.  If you really
just want to go to the "nested" page flow in another webapp, and then
return to the original one, then session state is not an issue.  You can
send a "callback" URI to the second page flow, and it can redirect to
that URI when it's done.  You won't lose the state in the first page
flow because it's not in the same session.  I've attached an example --
to see it work, install the current beehive runtime and hit
webappOne/callToPseudoNested/Controller.jpf.

If you're trying to send data back and forth between the two page flows,
you run into the separate-sessions issue, in which case you would need
to hook into a server-specific state-sharing mechanism, or, if you can,
pass the data in the URL.

I'm curious to know if this is along the lines of what you need.

Rich

p.s. I apparently can't attach a file in a posting to this list, so here 
is the code for both page flows.  I can send you the entire example 
(with JSPs) if you'd like.


pageFlowOne
-----------
@Jpf.Controller(
     simpleActions={
         @Jpf.SimpleAction(name="begin", path="index.jsp"),
         @Jpf.SimpleAction(name="callback", 
navigateTo=Jpf.NavigateTo.currentPage)
     }
)
public class ControllerOne extends PageFlowController
{
     private String _state;

     @Jpf.Action(
         forwards={
             @Jpf.Forward(
                 name="pseudoNested",
                 path="/webappTwo/pseudoNested/Controller.jpf",
                 externalRedirect=true
             )
         }
     )
     public Forward goToPseudoNestedPageFlow()
         throws URISyntaxException
     {
         Forward fwd = new Forward( "pseudoNested" );

         // Here, we're creating a properly-rewritten callback URI
         // that will get executed when the other page flow is done.
         String actionURI = getRewrittenActionURI( "callback", null, true );
         fwd.addQueryParam( "callbackURI", actionURI );
         return fwd;
     }
}


pageFlowTwo
-----------
@Jpf.Controller()
public class Controller extends PageFlowController
{
     private String _callbackURI;

     @Jpf.Action(
         forwards={
             @Jpf.Forward(name="index", path="index.jsp")
         }
     )
     public Forward begin()
     {
         _callbackURI = getRequest().getParameter( "callbackURI" );
         return new Forward( "index" );
     }

     @Jpf.Action()
     public Forward returnToCaller()
         throws URISyntaxException
     {
         Forward fwd = new Forward( new URI( _callbackURI ), true );
         fwd.setExternalRedirect( true );
         return fwd;
     }
}


Erik Noren wrote:

>After having looked through the Beehive docs and the BEA WorkShop docs,
>I am under the impression that this is not possible, but a BEA
>representative alluded to it as though it was, so I figured I would ask
>a larger group.  
>
> 
>
>Is it possible to create a JavaControl that wraps a page flow?  If so,
>is there a control for this already available or would this be a custom
>control?  If there is not one available by default, anyone have any
>advice on how to create one from a custom control?  
>
> 
>
>The ultimate goal is to be able to write a page flow that references a
>nested page flow where the nested page flow is not part of the current
>application.  The nested page flow would be on the same server, however
>we would want to be able to deploy each nested page flow as a separate
>WAR/Application and therefore don't want the implementation of that page
>flow to have to be embedded in the consuming page flow.  The
>representative alluded to using a Java Control around the Page Flow to
>do this, but I as I stated earlier, I am not sure how that would work.
>Any help would be appreciated, thanks!
>
> 
>
>Erik
>
>
>  
>