You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Fang Lin <Fa...@u.washington.edu> on 2011/11/15 22:31:04 UTC

Issue with migrating to 1.5.2

The following is my code running with Wicket 1.4.15.  In my class that handles the Logout link which extends the Wicket Link, I have
@Override
  public void onClick ()
  {
    ...
     getRequestCycle().setRequestTarget (new RedirectRequestTarget (logoutPageUrl(isGuest)));
}

private String logoutPageUrl(boolean isGuest)
  {
    return ( getRequest().getRelativePathPrefixToContextRoot() +
             (isGuest
              ? getString ("guest_logout_url")
              : getString ("logout_url")));
  }

And in the properties file I have:
logout_url=servlet/LOGOUT-CLEARLOGIN
guest_logout_url=logout.html

With 1.5.2, I have got two issues:

1.       getRelativePathPrefixToContextRoot method no longer exists. So I changed the properties to

logout_url=/servlet/LOGOUT-CLEARLOGIN

guest_logout_url=/logout.html


2.       As the RedirectRequestTarget  is replaced by RedirectRequestHandler, I changed the code to :
        new RedirectRequestHandler (logoutPageUrl(isGuest)).respond (getRequestCycle());

Then I got HTTP Status 500 when clicking on the Logout link:
The server encountered an internal error () that prevented it from fulfilling this request.
Exception
java.lang.IllegalStateException
        org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435)
org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:230)
org.apache.wicket.protocol.http.BufferedWebResponse$SendRedirectAction.invoke(BufferedWebResponse.java:392)
     org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:580)
org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:89)
        org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:172)
        org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)

I have googled and checked the 1.5 migration guide but could not find any answer.
Any advice would be appreciated!

Fang Lin
_______________________________________________
Software Engineer
UW-IT, Academic and Collaborative Applications
Box 354845
4518 University Way, Suite 200
206.221.4514 | fanglin@uw.edu<ma...@uw.edu>



RE: Issue with migrating to 1.5.2

Posted by Fang Lin <Fa...@u.washington.edu>.
I have found the solution.
getRequestCycle().replaceAllRequestHandlers(new RedirectRequestHandler (logoutPageUrl(isGuest)));
Works!

-----Original Message-----
From: Fang Lin [mailto:Fanglin@u.washington.edu] 
Sent: Tuesday, November 15, 2011 1:31 PM
To: users@wicket.apache.org
Subject: Issue with migrating to 1.5.2

The following is my code running with Wicket 1.4.15.  In my class that handles the Logout link which extends the Wicket Link, I have @Override
  public void onClick ()
  {
    ...
     getRequestCycle().setRequestTarget (new RedirectRequestTarget (logoutPageUrl(isGuest))); }

private String logoutPageUrl(boolean isGuest)
  {
    return ( getRequest().getRelativePathPrefixToContextRoot() +
             (isGuest
              ? getString ("guest_logout_url")
              : getString ("logout_url")));
  }

And in the properties file I have:
logout_url=servlet/LOGOUT-CLEARLOGIN
guest_logout_url=logout.html

With 1.5.2, I have got two issues:

1.       getRelativePathPrefixToContextRoot method no longer exists. So I changed the properties to

logout_url=/servlet/LOGOUT-CLEARLOGIN

guest_logout_url=/logout.html


2.       As the RedirectRequestTarget  is replaced by RedirectRequestHandler, I changed the code to :
        new RedirectRequestHandler (logoutPageUrl(isGuest)).respond (getRequestCycle());

Then I got HTTP Status 500 when clicking on the Logout link:
The server encountered an internal error () that prevented it from fulfilling this request.
Exception
java.lang.IllegalStateException
        org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435)
org.apache.wicket.protocol.http.servlet.ServletWebResponse.sendRedirect(ServletWebResponse.java:230)
org.apache.wicket.protocol.http.BufferedWebResponse$SendRedirectAction.invoke(BufferedWebResponse.java:392)
     org.apache.wicket.protocol.http.BufferedWebResponse.writeTo(BufferedWebResponse.java:580)
org.apache.wicket.protocol.http.HeaderBufferingWebResponse.flush(HeaderBufferingWebResponse.java:89)
        org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:172)
        org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:218)

I have googled and checked the 1.5 migration guide but could not find any answer.
Any advice would be appreciated!


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org