You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Stéphane Poirier <st...@gmail.com> on 2007/06/21 16:37:20 UTC
Navigation between applications
Hi,
I'm wondering if it's possible, using navigation-cases, to add communication
between different JSF applications (or even from a JSF application to a
non-JSF app)? I know an getExternalContext().redirect can be used but if
there is a more standard and clean way to do this, I'd be glad to know.
Thanks in advance!
RE: Navigation between applications
Posted by "Kito D. Mann" <km...@virtua.com>.
From: Stéphane Poirier [mailto:stephane.poirier01@gmail.com]
Sent: Thursday, June 21, 2007 10:37 AM
To: MyFaces Discussion
Subject: Navigation between applications
Hi,
I'm wondering if it's possible, using navigation-cases, to add communication
between different JSF applications (or even from a JSF application to a
non-JSF app)? I know an getExternalContext().redirect can be used but if
there is a more standard and clean way to do this, I'd be glad to know.
Im assuming that youre mostly interested in talking to apps outside of the
current application context, correct? Things are easier, obviously, if
everything is inside of the same web application (which is entirely possible
with non-JSF applications). In this scenario, you can either do an
ExternalContext.dispatch() or simply use the navigation rules to forward to
a JSP that talks to your non-JSF application.
If you need to communicate between different web application contexts,
redirect is your friend. You can, however, make things easier for developers
by decorating the ViewHandler. That way you can translate a specialized
viewId (lets say otherapp:index.jsp) into a redirect.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann - Author, JavaServer Faces in Action
<http://www.virtua.com/> http://www.virtua.com - JSF/Java EE consulting,
training, and mentoring
<http://www.jsfcentral.com/> http://www.JSFCentral.com - JavaServer Faces
FAQ, news, and info
* Sign up for the JSF Central newsletter!
<http://oi.vresp.com/?fid=ac048d0e17> http://oi.vresp.com/?fid=ac048d0e17 *
Re: Navigation between applications
Posted by Matthias Wessendorf <ma...@apache.org>.
FacesContext.getCurrentInstance().getExternalContext().redirect("
http://www.google.com");
?
On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> True, forgot the redirect... yet I still get an error :
>
> javax.servlet.ServletException: Illegal view ID http://www.google.com. The
> ID must begin with /
> javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
> org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:210)
> org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:167)
> org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:140)
> org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:93)
>
> I'll see what I can do with ViewHandler.
>
>
> On 6/21/07, Andrew Robinson <andrew.rw.robinson@gmail.com > wrote:
> > Did you have redirect set in the navigation rule (it is required)?
> >
> > Have a look at the NavigationHandlerImpl.java for the exact code to
> > determine the behavior.
> >
> > On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> > > Full URL doesn't work, I just get a load of error (See bellow). The
> ViewId
> > > solution sounds like a great solution. BTW, what is the
> > > ExternalContext.dispatch() doing?
> > >
> > > Thanks!
> > >
> > > (...)
> > > 2007-06-21 11:14:47
> > > org.apache.myfaces.trinidad.context.RenderingContext
> attach
> > > ATTENTION: Trying to attach RenderingContext to a thread that already
> had
> > > one.
> > > (...And many, many more)
> > >
> > > at javax.faces.webapp.FacesServlet.service
> > > (FacesServlet.java:245)
> > > at
> > >
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> > > at
> > >
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java
> > > :206)
> > > at
> > >
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
> > > at
> > >
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
> > > at
> > >
> org.apache.catalina.core.ApplicationDispatcher.doForward
> > > (ApplicationDispatcher.java:403)
> > > at
> > >
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> > > at
> > >
> com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
> > > at
> > >
> org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
> > > at
> > >
> org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch
> (FacesContextFactoryImpl.java
> > > :259)
> > > at
> > >
> com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:439)
> > > at
> > > com.sun.faces.application.ViewHandlerImpl.renderView
> (ViewHandlerImpl.java:114)
> > > at
> > >
> org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView
> > > (ViewHandlerImpl.java:182)
> > > at
> > > com.sun.faces.lifecycle.RenderResponsePhase.execute
> (RenderResponsePhase.java:106)
> > > at
> > >
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
> > > at com.sun.faces.lifecycle.LifecycleImpl.render
> > > (LifecycleImpl.java:144)
> > >
> > >
> > >
> > >
> > > On 6/21/07, Andrew Robinson <an...@gmail.com> wrote:
> > > > I believe a full url (with the scheme) as a view ID will navigate to
> that
> > > page
> > > >
> > > > for example, use:
> > > > http://somehost/somecontext/somepage.jsp
> > > >
> > > > If that doesn't work for you (having to put that in there), you may
> > > > have to use a custom navigation handler or view handler and catch the
> > > > external link and send a redirect from inside those components.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> > > > > Hi,
> > > > >
> > > > > I'm wondering if it's possible, using navigation-cases, to add
> > > communication
> > > > > between different JSF applications (or even from a JSF application
> to a
> > > > > non-JSF app)? I know an getExternalContext().redirect can be used
> but if
> > > > > there is a more standard and clean way to do this, I'd be glad to
> know.
> > > > >
> > > > > Thanks in advance!
> > > > >
> > > >
> > >
> > >
> >
>
>
--
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org
Re: Navigation between applications
Posted by Stéphane Poirier <st...@gmail.com>.
True, forgot the redirect... yet I still get an error :
javax.servlet.ServletException: Illegal view ID http://www.google.com. The
ID must begin with / javax.faces.webapp.FacesServlet.service(
FacesServlet.java:256)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter
(TrinidadFilterImpl.java:210)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(
TrinidadFilterImpl.java:167)
org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(
TrinidadFilterImpl.java:140)
org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(
TrinidadFilter.java:93)
I'll see what I can do with ViewHandler.
On 6/21/07, Andrew Robinson <an...@gmail.com> wrote:
>
> Did you have redirect set in the navigation rule (it is required)?
>
> Have a look at the NavigationHandlerImpl.java for the exact code to
> determine the behavior.
>
> On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> > Full URL doesn't work, I just get a load of error (See bellow). The
> ViewId
> > solution sounds like a great solution. BTW, what is the
> > ExternalContext.dispatch() doing?
> >
> > Thanks!
> >
> > (...)
> > 2007-06-21 11:14:47
> > org.apache.myfaces.trinidad.context.RenderingContext attach
> > ATTENTION: Trying to attach RenderingContext to a thread that already
> had
> > one.
> > (...And many, many more)
> >
> > at javax.faces.webapp.FacesServlet.service
> > (FacesServlet.java:245)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:290)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java
> > :206)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.invoke(
> ApplicationDispatcher.java:687)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.processRequest(
> ApplicationDispatcher.java:469)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.doForward
> > (ApplicationDispatcher.java:403)
> > at
> > org.apache.catalina.core.ApplicationDispatcher.forward(
> ApplicationDispatcher.java:301)
> > at
> > com.sun.faces.context.ExternalContextImpl.dispatch(
> ExternalContextImpl.java:408)
> > at
> > org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(
> ExternalContextDecorator.java:44)
> > at
> >
> org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch
> (FacesContextFactoryImpl.java
> > :259)
> > at
> > com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(
> ViewHandlerImpl.java:439)
> > at
> > com.sun.faces.application.ViewHandlerImpl.renderView(
> ViewHandlerImpl.java:114)
> > at
> >
> org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView
> > (ViewHandlerImpl.java:182)
> > at
> > com.sun.faces.lifecycle.RenderResponsePhase.execute(
> RenderResponsePhase.java:106)
> > at
> > com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
> > at com.sun.faces.lifecycle.LifecycleImpl.render
> > (LifecycleImpl.java:144)
> >
> >
> >
> >
> > On 6/21/07, Andrew Robinson <an...@gmail.com> wrote:
> > > I believe a full url (with the scheme) as a view ID will navigate to
> that
> > page
> > >
> > > for example, use:
> > > http://somehost/somecontext/somepage.jsp
> > >
> > > If that doesn't work for you (having to put that in there), you may
> > > have to use a custom navigation handler or view handler and catch the
> > > external link and send a redirect from inside those components.
> > >
> > >
> > >
> > >
> > >
> > > On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > I'm wondering if it's possible, using navigation-cases, to add
> > communication
> > > > between different JSF applications (or even from a JSF application
> to a
> > > > non-JSF app)? I know an getExternalContext().redirect can be used
> but if
> > > > there is a more standard and clean way to do this, I'd be glad to
> know.
> > > >
> > > > Thanks in advance!
> > > >
> > >
> >
> >
>
Re: Navigation between applications
Posted by Andrew Robinson <an...@gmail.com>.
Did you have redirect set in the navigation rule (it is required)?
Have a look at the NavigationHandlerImpl.java for the exact code to
determine the behavior.
On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> Full URL doesn't work, I just get a load of error (See bellow). The ViewId
> solution sounds like a great solution. BTW, what is the
> ExternalContext.dispatch() doing?
>
> Thanks!
>
> (...)
> 2007-06-21 11:14:47
> org.apache.myfaces.trinidad.context.RenderingContext attach
> ATTENTION: Trying to attach RenderingContext to a thread that already had
> one.
> (...And many, many more)
>
> at javax.faces.webapp.FacesServlet.service
> (FacesServlet.java:245)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java
> :206)
> at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
> at
> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
> at
> org.apache.catalina.core.ApplicationDispatcher.doForward
> (ApplicationDispatcher.java:403)
> at
> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
> at
> com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
> at
> org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
> at
> org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java
> :259)
> at
> com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:439)
> at
> com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:114)
> at
> org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView
> (ViewHandlerImpl.java:182)
> at
> com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
> at
> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
> at com.sun.faces.lifecycle.LifecycleImpl.render
> (LifecycleImpl.java:144)
>
>
>
>
> On 6/21/07, Andrew Robinson <an...@gmail.com> wrote:
> > I believe a full url (with the scheme) as a view ID will navigate to that
> page
> >
> > for example, use:
> > http://somehost/somecontext/somepage.jsp
> >
> > If that doesn't work for you (having to put that in there), you may
> > have to use a custom navigation handler or view handler and catch the
> > external link and send a redirect from inside those components.
> >
> >
> >
> >
> >
> > On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> > > Hi,
> > >
> > > I'm wondering if it's possible, using navigation-cases, to add
> communication
> > > between different JSF applications (or even from a JSF application to a
> > > non-JSF app)? I know an getExternalContext().redirect can be used but if
> > > there is a more standard and clean way to do this, I'd be glad to know.
> > >
> > > Thanks in advance!
> > >
> >
>
>
Re: Navigation between applications
Posted by Stéphane Poirier <st...@gmail.com>.
Full URL doesn't work, I just get a load of error (See bellow). The ViewId
solution sounds like a great solution. BTW, what is the
ExternalContext.dispatch() doing?
Thanks!
(...)
2007-06-21 11:14:47 org.apache.myfaces.trinidad.context.RenderingContextattach
ATTENTION: Trying to attach RenderingContext to a thread that already had
one.
(...And many, many more)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(
ApplicationDispatcher.java:687)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(
ApplicationDispatcher.java:469)
at org.apache.catalina.core.ApplicationDispatcher.doForward(
ApplicationDispatcher.java:403)
at org.apache.catalina.core.ApplicationDispatcher.forward(
ApplicationDispatcher.java:301)
at com.sun.faces.context.ExternalContextImpl.dispatch(
ExternalContextImpl.java:408)
at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch
(ExternalContextDecorator.java:44)
at
org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch
(FacesContextFactoryImpl.java:259)
at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(
ViewHandlerImpl.java:439)
at com.sun.faces.application.ViewHandlerImpl.renderView(
ViewHandlerImpl.java:114)
at
org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(
ViewHandlerImpl.java:182)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(
RenderResponsePhase.java:106)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
On 6/21/07, Andrew Robinson <an...@gmail.com> wrote:
>
> I believe a full url (with the scheme) as a view ID will navigate to that
> page
>
> for example, use:
> http://somehost/somecontext/somepage.jsp
>
> If that doesn't work for you (having to put that in there), you may
> have to use a custom navigation handler or view handler and catch the
> external link and send a redirect from inside those components.
>
>
>
>
>
> On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> > Hi,
> >
> > I'm wondering if it's possible, using navigation-cases, to add
> communication
> > between different JSF applications (or even from a JSF application to a
> > non-JSF app)? I know an getExternalContext().redirect can be used but if
> > there is a more standard and clean way to do this, I'd be glad to know.
> >
> > Thanks in advance!
> >
>
Re: Navigation between applications
Posted by Andrew Robinson <an...@gmail.com>.
I believe a full url (with the scheme) as a view ID will navigate to that page
for example, use:
http://somehost/somecontext/somepage.jsp
If that doesn't work for you (having to put that in there), you may
have to use a custom navigation handler or view handler and catch the
external link and send a redirect from inside those components.
On 6/21/07, Stéphane Poirier <st...@gmail.com> wrote:
> Hi,
>
> I'm wondering if it's possible, using navigation-cases, to add communication
> between different JSF applications (or even from a JSF application to a
> non-JSF app)? I know an getExternalContext().redirect can be used but if
> there is a more standard and clean way to do this, I'd be glad to know.
>
> Thanks in advance!
>