I had a similar problem
I decided not to use that RequiredSSL method.
Instead i maintain an array of page classes that require https
and used the following code. It worked fine for me. Hope it helps you.
protected IResponseStrategy newResponseStrategy()
{
return new IResponseStrategy() {
@SuppressWarnings("unchecked")
public void respond( RequestCycle requestCycle )
{
IRequestTarget requestTarget = requestCycle.getRequestTarget();
if( requestTarget != null ) {
Application.get().logResponseTarget( requestTarget );
WebRequest webRequest = (WebRequest) requestCycle.getRequest();
WebResponse webResponse = (WebResponse) requestCycle
.getResponse();
HttpServletRequest httpServletRequest = webRequest
.getHttpServletRequest();
Class pageClass = null;
if( requestTarget instanceof IPageRequestTarget ) {
IPageRequestTarget pageTarget = (IPageRequestTarget) requestTarget;
pageClass = pageTarget.getPage().getClass();
}
else if( requestTarget instanceof IBookmarkablePageRequestTarget ) {
IBookmarkablePageRequestTarget bookmarkableTarget = (IBookmarkablePageRequestTarget) requestTarget;
pageClass = bookmarkableTarget.getPageClass();
}
boolean isSecurityRequired = false;
if( pageClass != null ) {
for( int i = 0; i < secureClasses.length
&& !isSecurityRequired; i++ ) {
isSecurityRequired = secureClasses[i]
.isAssignableFrom( pageClass );
}
}
if( pageClass != null && !httpServletRequest.isSecure()
&& isSecurityRequired ) {
StringBuffer url = "" StringBuffer( "https://"
+ httpServletRequest.getServerName() );
url.append( ":" + getSslPortNumber() );
String q = RequestCycle.get().urlFor( requestTarget )
.toString();
url.append( q );
webResponse.redirect ( url.toString() );
}
else if( httpServletRequest.isSecure() && !isSecurityRequired ) {
StringBuffer url = "" StringBuffer( "http://"
+ httpServletRequest.getServerName() );
url.append( ":" + getNormalPortNumber() );
String q = RequestCycle.get().urlFor( requestTarget )
.toString();
url.append( q );
webResponse.redirect( url.toString() );
}
else {
requestTarget.respond( requestCycle );
}
}
};
}
Shams.
On 7/10/06,
Johan Compagner <[EMAIL PROTECTED]> wrote:
then you are doing the redirect wrong.
How and when do you do the redirect??On 7/7/06, Joe Toth <[EMAIL PROTECTED] > wrote:Weird...I'm only getting the error in Jetty 6 (Beta17).
wicket.WicketRuntimeException: Internal Error: Could not render error page class wicket.markup.html.pages.InternalErrorPage
at wicket.request.compound.DefaultExceptionResponseStrategy.respond (DefaultExceptionResponseStrategy.java:109)
at wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond(AbstractCompoundRequestCycleProcessor.java:76)
at wicket.RequestCycle.step(RequestCycle.java :1000)
at wicket.RequestCycle.steps(RequestCycle.java:1034)
at wicket.RequestCycle.request(RequestCycle.java:453)
at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:215)
at javax.servlet.http.HttpServlet.service (HttpServlet.java:747)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:423)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter (ServletHandler.java:966)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter.java:77)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:957)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:353)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:567)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java :126)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.mortbay.jetty.Server.handle(Server.java:248)
at org.mortbay.jetty.HttpConnection.handlerRequest(HttpConnection.java :360)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:614)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:487)
at org.mortbay.jetty.HttpParser.parseAvailable (HttpParser.java:197)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:288)
at org.mortbay.jetty.nio.SelectChannelConnector$HttpChannelEndPoint.run(SelectChannelConnector.java:805)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run (BoundedThreadPool.java:475)
Caused by: wicket.WicketRuntimeException: Already redirecting to 'https://localhost:8443/app '. Cannot redirect more than once
at wicket.protocol.http.BufferedWebResponse.redirect (BufferedWebResponse.java:92)
at wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:225)
at wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:60)
at wicket.request.compound.DefaultResponseStrategy.respond (DefaultResponseStrategy.java:49)
at wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond(AbstractCompoundRequestCycleProcessor.java:66)
at wicket.RequestCycle.respond(RequestCycle.java:905)
at wicket.RequestCycle.step(RequestCycle.java:975)
... 23 moreOn 7/6/06, Johan Compagner < [EMAIL PROTECTED]> wrote:Redirect to a full url or use an ExternalLink (pointing to your own site but then with ssl)
Do that redirect with a IRequestTarget.I don't know how you do it now but doing a redirect should always be done
through request targets.
johanOn 7/6/06, Joe Toth < [EMAIL PROTECTED]> wrote:How can I implement a way switch over to https?
Depending on how the user navigates I need to swich over to https from
a form submit. Every time I try a different way to implement this
transparently I receive "Caused by: wicket.WicketRuntimeException:
Already redirecting to '/app/Checkout'. Cannot redirect more than
once"
At first I tried to annotate a class with @RequiredSSL and created a
new IResponseStrategy that would test if the request was secure, if
not, WebResponse.redirect to the https version of the requested url.
Second I tried to do the same in the constructor of my Base Class for
all my pages and throw an AbortException, but I had the same problem.
Any ideas?
Also, are there any plans to add a https feature in 2.0 core or extensions?
Thanks!Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user