Package org.spincast.plugins.routing
Class RedirectRuleBuilderDefault<R extends RequestContext<?>,W extends WebsocketContext<?>>
java.lang.Object
org.spincast.plugins.routing.RedirectRuleBuilderDefault<R,W>
- All Implemented Interfaces:
RedirectRuleBuilder<R,
W>
public class RedirectRuleBuilderDefault<R extends RequestContext<?>,W extends WebsocketContext<?>>
extends Object
implements RedirectRuleBuilder<R,W>
Default implementation for the RedirectRuleBuilder interface.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRedirectRuleBuilderDefault
(Router<R, W> router, String oldPath, SpincastRouterConfig spincastRouterConfig, SpincastRoutingUtils spincastRoutingUtils) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addRedirectHandler
(Handler<R> handler) protected String
protected int
protected SpincastRouterConfig
protected SpincastRoutingUtils
protected boolean
The redirection will be permanent (301).pos
(int position) The position where the filter will be run.The redirection will be temporarily (302).protected void
throwRedirect
(R context, String newPathOrFullUrl) void
The new path or full URL to redirect to.void
to
(RedirectHandler<R, W> handler) Will called the specifiedRedirectHandler
to generate the path to redirect to.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
RedirectRuleBuilderDefault
public RedirectRuleBuilderDefault(Router<R, W> router, String oldPath, SpincastRouterConfig spincastRouterConfig, SpincastRoutingUtils spincastRoutingUtils)
-
-
Method Details
-
getRouter
-
getOldPath
-
getSpincastRouterConfig
-
getSpincastRoutingUtils
-
isPermanently
protected boolean isPermanently() -
getPosition
protected int getPosition() -
permanently
Description copied from interface:RedirectRuleBuilder
The redirection will be permanent (301).This is the default.
- Specified by:
permanently
in interfaceRedirectRuleBuilder<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
temporarily
Description copied from interface:RedirectRuleBuilder
The redirection will be temporarily (302).- Specified by:
temporarily
in interfaceRedirectRuleBuilder<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
to
Description copied from interface:RedirectRuleBuilder
The new path or full URL to redirect to.This ends the creation of the redirection rule and save it to the router.
- Specified by:
to
in interfaceRedirectRuleBuilder<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
to
Description copied from interface:RedirectRuleBuilder
Will called the specifiedRedirectHandler
to generate the path to redirect to.This ends the creation of the redirection rule and save it to the router.
- Specified by:
to
in interfaceRedirectRuleBuilder<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
pos
Description copied from interface:RedirectRuleBuilder
The position where the filter will be run.By using a position below
0
, the redirection will occures even if a main handler would be found.Defaults to -1000.
- Specified by:
pos
in interfaceRedirectRuleBuilder<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
addRedirectHandler
-
throwRedirect
-