Package org.apache.wicket.protocol.https
Class HttpsMapper
- java.lang.Object
-
- org.apache.wicket.protocol.https.HttpsMapper
-
- All Implemented Interfaces:
org.apache.wicket.request.IRequestMapper,org.apache.wicket.request.mapper.IRequestMapperDelegate
public class HttpsMapper extends java.lang.Object implements org.apache.wicket.request.mapper.IRequestMapperDelegateAIRequestMapperthat will issue a redirect to secured communication (over https) if the page resolved by delegate is annotated with @RequireHttpsTo setup it:
public class MyApplication extends WebApplication { public void init() { super.init(); getRootRequestMapperAsCompound().add(new MountedMapper("secured", HttpsPage.class)); mountPage(SomeOtherPage.class); // notice that in most cases this should be done as the // last mounting-related operation because it replaces the root mapper setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(80, 443))); } }any request to http://hostname:httpPort/secured will be redirected to https://hostname:httpsPort/secured- Author:
- igor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttpsMapper.RedirectHandlerHandler that takes care of redirecting
-
Constructor Summary
Constructors Constructor Description HttpsMapper(org.apache.wicket.request.IRequestMapper delegate, HttpsConfig config)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.wicket.request.IRequestHandlercreateRedirectHandler(java.lang.String url)Creates theIRequestHandlerthat will be responsible for the redirectprotected java.lang.StringcreateRedirectUrl(org.apache.wicket.request.IRequestHandler handler, org.apache.wicket.request.Request request, Scheme scheme)Constructs a redirect url that should switch the user to the specifiedschemeintgetCompatibilityScore(org.apache.wicket.request.Request request)HttpsConfiggetConfig()org.apache.wicket.request.IRequestMappergetDelegateMapper()protected SchemegetDesiredSchemeFor(java.lang.Class<? extends IRequestablePage> pageClass)Determines whichSchemeshould be used to access the pageprotected SchemegetDesiredSchemeFor(org.apache.wicket.request.IRequestHandler handler)Figures out whichSchemeshould be used to access the request handlerprotected SchemegetSchemeOf(org.apache.wicket.request.Request request)Determines theSchemeof the requestorg.apache.wicket.request.UrlmapHandler(org.apache.wicket.request.IRequestHandler handler)org.apache.wicket.request.IRequestHandlermapRequest(org.apache.wicket.request.Request request)
-
-
-
Constructor Detail
-
HttpsMapper
public HttpsMapper(org.apache.wicket.request.IRequestMapper delegate, HttpsConfig config)Constructor- Parameters:
delegate-config-
-
-
Method Detail
-
getDelegateMapper
public org.apache.wicket.request.IRequestMapper getDelegateMapper()
- Specified by:
getDelegateMapperin interfaceorg.apache.wicket.request.mapper.IRequestMapperDelegate
-
getCompatibilityScore
public final int getCompatibilityScore(org.apache.wicket.request.Request request)
- Specified by:
getCompatibilityScorein interfaceorg.apache.wicket.request.IRequestMapper
-
mapRequest
public final org.apache.wicket.request.IRequestHandler mapRequest(org.apache.wicket.request.Request request)
- Specified by:
mapRequestin interfaceorg.apache.wicket.request.IRequestMapper
-
mapHandler
public final org.apache.wicket.request.Url mapHandler(org.apache.wicket.request.IRequestHandler handler)
- Specified by:
mapHandlerin interfaceorg.apache.wicket.request.IRequestMapper
-
createRedirectHandler
protected org.apache.wicket.request.IRequestHandler createRedirectHandler(java.lang.String url)
Creates theIRequestHandlerthat will be responsible for the redirect- Parameters:
url-- Returns:
- request handler
-
createRedirectUrl
protected java.lang.String createRedirectUrl(org.apache.wicket.request.IRequestHandler handler, org.apache.wicket.request.Request request, Scheme scheme)Constructs a redirect url that should switch the user to the specifiedscheme- Parameters:
handler- request handler being accessedrequest- current requestscheme- desired scheme for the redirect url- Returns:
- url
-
getDesiredSchemeFor
protected Scheme getDesiredSchemeFor(org.apache.wicket.request.IRequestHandler handler)
Figures out whichSchemeshould be used to access the request handler- Parameters:
handler- request handler- Returns:
Scheme
-
getSchemeOf
protected Scheme getSchemeOf(org.apache.wicket.request.Request request)
Determines theSchemeof the request- Parameters:
request-- Returns:
Scheme.HTTPSorScheme.HTTP
-
getDesiredSchemeFor
protected Scheme getDesiredSchemeFor(java.lang.Class<? extends IRequestablePage> pageClass)
Determines whichSchemeshould be used to access the page- Parameters:
pageClass- type of page- Returns:
Scheme
-
getConfig
public final HttpsConfig getConfig()
- Returns:
- config with which this mapper was created
-
-