You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eli Doran <el...@gmail.com> on 2005/09/15 00:46:24 UTC
RedirectException issues
anyone else having trouble with RedirectExceptions when called from a
listener method? mine are being caught and displayed in the exception
page. i'm using the most recent TP4 source. it works fine from
pageValidate methods.
~eli
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: RedirectException issues
Posted by Andreas Andreou <an...@di.uoa.gr>.
Howard Lewis Ship wrote:
>Many have stated that using exceptions for this purpose (redirecting)
>is a mistake.
>
>They are right.
>
>In the meantime, add a bug and I'll check the affected code to
>properly throw the RedirectException (currenlty, there are
>catch/rethrows for PageRedirectException).
>
>
???
That was
http://issues.apache.org/jira/browse/TAPESTRY-647 ,
which is already fixed in beta-8
>On 9/14/05, Eli Doran <el...@gmail.com> wrote:
>
>
>>anyone else having trouble with RedirectExceptions when called from a
>>listener method? mine are being caught and displayed in the exception
>>page. i'm using the most recent TP4 source. it works fine from
>>pageValidate methods.
>>
>>~eli
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>
>
>
>--
>Howard M. Lewis Ship
>Independent J2EE / Open-Source Java Consultant
>Creator, Jakarta Tapestry
>Creator, Jakarta HiveMind
>
>Professional Tapestry training, mentoring, support
>and project work. http://howardlewisship.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: RedirectException issues
Posted by Joseph Hannon <ja...@gmail.com>.
Howard- thanks.
In the meantime, have any suggestions to get any kind of redirect working so
I don't end up with page navigation as POSTs instead of GETs? I had this
working in Tap 3 and just moved to 4. I am attempting redirects from
validate listeners and other listeners like for image submits. I am throwing
a PageRedirectException from my Home.pageValidate() and it seems to work,
such that when I refresh this new page(call it PlaceOrder), there is no POST
warning dialog from my browser. Throwing a PageRedirectException from a
listener in the PlaceOrder page does go to the next page (call it PayOrder)
and leaves it so that a refresh gives me the post warning dialog. I am
attempting to do the same as a the POST Redirect GET pattern.
Thanks,
Joseph
On 9/28/05, Howard Lewis Ship <hl...@gmail.com> wrote:
>
> On 9/28/05, Howard Lewis Ship <hl...@gmail.com> wrote:
> > Many have stated that using exceptions for this purpose (redirecting)
> > is a mistake.
> >
> > They are right.
>
> To be clear; I meant the Tapestry API is flawed, not the way people
> are using it.
>
> >
> > In the meantime, add a bug and I'll check the affected code to
> > properly throw the RedirectException (currenlty, there are
> > catch/rethrows for PageRedirectException).
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
Re: RedirectException issues
Posted by Howard Lewis Ship <hl...@gmail.com>.
On 9/28/05, Howard Lewis Ship <hl...@gmail.com> wrote:
> Many have stated that using exceptions for this purpose (redirecting)
> is a mistake.
>
> They are right.
To be clear; I meant the Tapestry API is flawed, not the way people
are using it.
>
> In the meantime, add a bug and I'll check the affected code to
> properly throw the RedirectException (currenlty, there are
> catch/rethrows for PageRedirectException).
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: RedirectException issues
Posted by Howard Lewis Ship <hl...@gmail.com>.
Many have stated that using exceptions for this purpose (redirecting)
is a mistake.
They are right.
In the meantime, add a bug and I'll check the affected code to
properly throw the RedirectException (currenlty, there are
catch/rethrows for PageRedirectException).
On 9/14/05, Eli Doran <el...@gmail.com> wrote:
> anyone else having trouble with RedirectExceptions when called from a
> listener method? mine are being caught and displayed in the exception
> page. i'm using the most recent TP4 source. it works fine from
> pageValidate methods.
>
> ~eli
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
Professional Tapestry training, mentoring, support
and project work. http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: RedirectException issues
Posted by Joseph Hannon <ja...@gmail.com>.
Tapestry 4.0 beta 6, 7, and 8. I implemented what you discussed in returning
an ILink from a listener, but but it resulted in a
Hivemind.ApplicationRuntimeException. Failure invoking listener method
...ILink ...fooListener(...IRequestCycle) Parameter parameter is of type
$Foo... which is not compatible with java.lang.String.
Template:
<form jwcid="form">
...
</form>
Page:
<component id="form" type="Form">
<binding name="listener" value="listener:fooListener"/>
</component>
I added the page injection and the public abstract accessor method. Compiles
and runs until this listener is called.
Did I miss something??
Thanks,
Joseph
On 9/16/05, Eli Doran <el...@gmail.com> wrote:
>
> you're right, the way to do it is return an ILink which will cause
> getRequestCycle().sendRedirect(link.getAbsoluteURL())
>
> What I've been doing until beta-7 source is my BasePage class has
> redirectTo/externalRedirectTo methods and I inject PageService or
> ExternalService into any page that uses these methods; which most do
> because I do a redirect from my listener methods.
>
> so, i'll change my listeners to return ILink and change the BasePage
> methods to provide the ILink.
>
> Thank you,
> ~eli.
>
> Tomás( Drenc(ák wrote:
>
> >I'm not sure if you can throw a RedirectException from listener
> >method. If you need redirect, just return ILink from listener method
> >which redirects your request.
> >
> >@InjectObject("engine-service:page")
> >public abstract IEngineService getPageService();
> >
> >@InjectPage("SomePage")
> >public abstract IPage getSomePage();
> >
> >public ILink doSmth() {
> > return getPageService().getLink(getRequestCycle(), false,
> getSomePage());
> >}
> >
> >2005/9/15, Eli Doran <el...@gmail.com>:
> >
> >
> >>anyone else having trouble with RedirectExceptions when called from a
> >>listener method? mine are being caught and displayed in the exception
> >>page. i'm using the most recent TP4 source. it works fine from
> >>pageValidate methods.
> >>
> >>~eli
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
> >
>
>
Re: RedirectException issues
Posted by Eli Doran <el...@gmail.com>.
you're right, the way to do it is return an ILink which will cause
getRequestCycle().sendRedirect(link.getAbsoluteURL())
What I've been doing until beta-7 source is my BasePage class has
redirectTo/externalRedirectTo methods and I inject PageService or
ExternalService into any page that uses these methods; which most do
because I do a redirect from my listener methods.
so, i'll change my listeners to return ILink and change the BasePage
methods to provide the ILink.
Thank you,
~eli.
Tomás( Drenc(ák wrote:
>I'm not sure if you can throw a RedirectException from listener
>method. If you need redirect, just return ILink from listener method
>which redirects your request.
>
>@InjectObject("engine-service:page")
>public abstract IEngineService getPageService();
>
>@InjectPage("SomePage")
>public abstract IPage getSomePage();
>
>public ILink doSmth() {
> return getPageService().getLink(getRequestCycle(), false, getSomePage());
>}
>
>2005/9/15, Eli Doran <el...@gmail.com>:
>
>
>>anyone else having trouble with RedirectExceptions when called from a
>>listener method? mine are being caught and displayed in the exception
>>page. i'm using the most recent TP4 source. it works fine from
>>pageValidate methods.
>>
>>~eli
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
Re: RedirectException issues
Posted by Tomáš Drenčák <to...@gmail.com>.
I'm not sure if you can throw a RedirectException from listener
method. If you need redirect, just return ILink from listener method
which redirects your request.
@InjectObject("engine-service:page")
public abstract IEngineService getPageService();
@InjectPage("SomePage")
public abstract IPage getSomePage();
public ILink doSmth() {
return getPageService().getLink(getRequestCycle(), false, getSomePage());
}
2005/9/15, Eli Doran <el...@gmail.com>:
> anyone else having trouble with RedirectExceptions when called from a
> listener method? mine are being caught and displayed in the exception
> page. i'm using the most recent TP4 source. it works fine from
> pageValidate methods.
>
> ~eli
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org