setResponsePage((Page)null) or setResponsePage((Class)null)
-Igor
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> David Liebeherr
> Sent: Sunday, August 14, 2005 3:54 PM
> To: wicket-user@lists.sourceforge.net
> Subject: Re: [Wicket-user] Redirecting to external URL with 
> HTTP-Header Location
> 
> In wicket-1.1b2 it doesn't work with
> 
>                 setResponsePage(null);
>                 getResponse().redirect("/");
> 
> bc setResponsePage(null) causes the compiler to fail bc there 
> are ambigous references to setResponsePage ( one with 
> (wicket.Page page) and one with (Class class) ) and since 
> this the compiler will not know wich one to call bc null fits 
> boths methods.
> 
> Any idea for this problem?
> 
> Thanks,
> Dave
> 
> Johan Compagner wrote:
> 
> > you are right. sending youre self a redirect shouldn't be 
> done on most 
> > places.
> > Always use one of the setResponsePage methods.
> >
> > I think you can use the setResponsePage now in all places i 
> know off:
> > a few problem area's are fixed like:
> >
> > Page constructor (home page that is redirecting in the 
> constructor to 
> > another page
> > Page.checkAcces() you don't have to send a redirect, you can do it 
> > with setResponse, only redirectToInterceptPage is still usefull)
> >
> >
> > youre problem:
> >   public Testing() {
> >       add(new Link("go") {
> >           public void onClick() {
> >              setResponsePage(null)
> >               getResponse().redirect("/");
> >           }
> >       });
> >   }
> >
> > or
> >
> > setRedirect(true)
> > setResponsePage(new RedirectPage("/"));
> >
> >
> > i thnk both should work..
> >
> >
> > David Liebeherr wrote:
> >
> >> Hi all,
> >>
> >> i have some problems to understand the redirecting 
> mechanism of wicket.
> >> When i try something like this:
> >> public class Testing extends WebPage {
> >>
> >>    public Testing() {
> >>        add(new Link("go") {
> >>            public void onClick() {
> >>                getResponse().redirect("/");
> >>            }
> >>        });
> >>    }
> >>
> >> }
> >> I get that:
> >> javax.servlet.ServletException: Internal Error: Could not 
> redirect to 
> >> exception error page.  Was trying to display exception for 
> page [Page 
> >> class = Testing, id = 0]:
> >> wicket.WicketRuntimeException: Already redirecting to '/'. Cannot 
> >> redirect more than once
> >>    at
> >> 
> wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse
> >> .java:96)
> >>
> >>    at
> >> 
> wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:
> >> 249)
> >>
> >>    at wicket.RequestCycle.respond(RequestCycle.java:771)
> >>    at wicket.RequestCycle.request(RequestCycle.java:406)
> >>    at 
> wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:304)
> >>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> >>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >>    at
> >> 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> >> icationFilterChain.java:252)
> >>
> >>    at
> >> 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> >> ilterChain.java:173)
> >>
> >>    at
> >> 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> >> alve.java:213)
> >>
> >>    at
> >> 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> >> alve.java:178)
> >>
> >>    at
> >> 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> >> ava:126)
> >>
> >>    at
> >> 
> org.apache.catalina.cluster.tcp.ReplicationValve.invoke(ReplicationVa
> >> lve.java:145)
> >>
> >>    at
> >> 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> >> ava:105)
> >>
> >>    at
> >> 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> >> ve.java:107)
> >>
> >>    at
> >> 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
> >> a:148)
> >>
> >>    at
> >> 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> >> :856)
> >>
> >>    at
> >> 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
> >> ssConnection(Http11Protocol.java:744)
> >>
> >>    at
> >> 
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
> >> int.java:527)
> >>
> >>    at
> >> 
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
> >> lowerWorkerThread.java:80)
> >>
> >>    at
> >> 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
> >> ool.java:684)
> >>
> >>    at java.lang.Thread.run(Thread.java:595)
> >>    ...
> >>
> >> So i found out that response.redirect should not be used 
> by the user
> >> (btw: why isn't it private when it should not be used?).
> >> Then i found out you can redirect with
> >>
> >> setResponsePage(new RedirectPage("/"));
> >>
> >> But the problem is that there is a HTML-Page with a 
> Meta-Refresh send.
> >>
> >> Is there a possibility to use HTTP-Header Location with wicket?
> >>
> >> Thanks,
> >> Dave
> >>
> >>
> >> -------------------------------------------------------
> >> SF.Net email is Sponsored by the Better Software Conference & EXPO 
> >> September 19-22, 2005 * San Francisco, CA * Development Lifecycle 
> >> Practices Agile & Plan-Driven Development * Managing 
> Projects & Teams 
> >> * Testing & QA Security * Process Improvement & Measurement * 
> >> http://www.sqe.com/bsce5sf 
> >> _______________________________________________
> >> Wicket-user mailing list
> >> Wicket-user@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference & EXPO 
> > September 19-22, 2005 * San Francisco, CA * Development Lifecycle 
> > Practices Agile & Plan-Driven Development * Managing 
> Projects & Teams 
> > * Testing & QA Security * Process Improvement & Measurement * 
> > http://www.sqe.com/bsce5sf 
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & 
> EXPO September 19-22, 2005 * San Francisco, CA * Development 
> Lifecycle Practices Agile & Plan-Driven Development * 
> Managing Projects & Teams * Testing & QA Security * Process 
> Improvement & Measurement * http://www.sqe.com/bsce5sf 
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 
> 




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to