public.javadoc.org.spincast.plugins.routing.SpincastRouter.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spincast-website Show documentation
Show all versions of spincast-website Show documentation
Source code for the https://www.spincast.org website.
SpincastRouter (org.spincast:spincast-framework 0.9.25 API)
org.spincast.plugins.routing
Class SpincastRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- java.lang.Object
-
- org.spincast.plugins.routing.SpincastRouter<R,W>
-
- All Implemented Interfaces:
- IRouter<R,W>
- Direct Known Subclasses:
- DefaultRouter
public class SpincastRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
extends Object
implements IRouter<R,W>
Spincast router
-
-
Field Summary
Fields
Modifier and Type
Field and Description
protected org.slf4j.Logger
logger
-
Fields inherited from interface org.spincast.core.routing.IRouter
DEFAULT_ROUTE_PATH
-
Constructor Summary
Constructors
Constructor and Description
SpincastRouter(SpincastRouterDeps<R,W> spincastRouterDeps)
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
protected void
addDefaultFilters()
protected IRouteBuilder<R>
addFilterDefaultRoutingTypes(IRouteBuilder<R> builder)
void
addRoute(IRoute<R> route)
Adds a route, directly.
void
addRouteParamPatternAlias(String alias,
String pattern)
Adds an alias for a path pattern.
void
addStaticResource(IStaticResource<R> staticResource)
Adds a static resource
route, directly.
void
addWebsocketRoute(IWebsocketRoute<R,W> websocketRoute)
Adds a Websocket route, directly.
void
after(IHandler<R> handler)
Creates an "after" filter.
void
after(String path,
IHandler<R> handler)
Creates an "after" filter.
IRouteBuilder<R>
ALL(String path)
Starts the creation of a route matching any HTTP method.
void
before(IHandler<R> handler)
Creates a "before" filter.
void
before(String path,
IHandler<R> handler)
Creates a "before" filter.
void
beforeAndAfter(IHandler<R> handler)
Creates a "before" and an "after" filters.
void
beforeAndAfter(String path,
IHandler<R> handler)
Creates a "before" and an "after" filters.
void
cors()
Enables Cross-Origin Resource Sharing (Cors) on all
matching requests (except the static resources,
for whom cors has to be activated directly!)
void
cors(Set<String> allowedOrigins)
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
void
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
void
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
void
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
void
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods)
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
void
cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods,
int maxAgeInSeconds)
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
void
cors(String path)
Enables Cross-Origin Resource Sharing (Cors) on all
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
void
cors(String path,
Set<String> allowedOrigins)
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
void
cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
void
cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
void
cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
void
cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods)
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
void
cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods,
int maxAgeInSeconds)
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
protected IRouteHandlerMatch<R>
createHandlerMatchForBeforeOrAfterFilter(IRouteHandlerMatch<R> mainRouteHandlerMatch,
IHandler<R> beforeOrAfterMethod,
int position)
Creates a new match for a "before" or "after" handler specific
to a route.
protected IRoute<R>
createHttpRouteFromWebsocketRoute(IWebsocketRoute<R,W> websocketRoute)
protected IRouteHandlerMatch<R>
createNoMatchingParamsHandlerMatch(IRoute<R> route,
String id,
IHandler<R> handler,
int position)
Creates an handler match with no matching params.
protected List<IRouteHandlerMatch<R>>
createRegularHandlerMatches(RoutingType routingType,
IRoute<R> route,
HttpMethod httpMethod,
List<String> acceptedContentTypes,
URL url,
int position)
Get the matches (filters and main handle) if the route matches the URL and
HTTP method, or returns NULL otherwise.
protected IRoutingResult<R>
createRoutingResult(List<IRouteHandlerMatch<R>> routeHandlerMatches)
IRouteBuilder<R>
DELETE(String path)
Starts the creation of a DELETE
route.
IStaticResourceBuilder<R>
dir(String url)
Start the creation of a static resource
directory.
void
exception(IHandler<R> handler)
Creates a route considered during an "Exception" routing process.
void
exception(String path,
IHandler<R> handler)
Creates a route considered during an "Exception" routing process.
IStaticResourceBuilder<R>
file(String url)
Start the creation of a static resource
file.
IRouteBuilder<R>
GET(String path)
Starts the creation of a GET
route.
protected Map<Integer,List<IRoute<R>>>
getGlobalAfterFiltersPerPosition()
List<IRoute<R>>
getGlobalAfterFiltersRoutes()
Gets the global "after" filters.
protected Map<Integer,List<IRoute<R>>>
getGlobalBeforeFiltersPerPosition()
List<IRoute<R>>
getGlobalBeforeFiltersRoutes()
Gets the global "before" filters.
List<IRoute<R>>
getMainRoutes()
Gets the main routes.
protected Pattern
getPattern(String patternStr)
protected String
getPatternFromAlias(String alias)
Get a path pattern from its alias.
protected IRedirectRuleBuilderFactory<R,W>
getRedirectRuleBuilderFactory()
IRoute<R>
getRoute(String routeId)
Gets a route using its routeId
.
protected IRouteBuilderFactory<R,W>
getRouteBuilderFactory()
protected IRouteFactory<R>
getRouteFactory()
protected IRouteHandlerMatchFactory<R>
getRouteHandlerMatchFactory()
Map<String,String>
getRouteParamPatternAliases()
The path patterns' aliases.
protected IServer
getServer()
protected ISpincastConfig
getSpincastConfig()
protected ISpincastDictionary
getSpincastDictionary()
protected ISpincastFilters<R>
getSpincastFilters()
protected ISpincastRouterConfig
getSpincastRouterConfig()
protected ISpincastRoutingUtils
getSpincastRoutingUtils()
protected IStaticResourceBuilderFactory<R,W>
getStaticResourceBuilderFactory()
protected IStaticResourceFactory<R>
getStaticResourceFactory()
protected IWebsocketRouteBuilderFactory<R,W>
getWebsocketRouteBuilderFactory()
protected IWebsocketRouteHandlerFactory<R,W>
getWebsocketRouteHandlerFactory()
IRouteBuilder<R>
HEAD(String path)
Starts the creation of a HEAD
route.
void
httpAuth(String pathPrefix,
String realmName)
Creates HTTP authentication protection (realm) for the
specified path prefix.
protected void
init()
protected boolean
isCreateStaticResourceOnDisk()
protected boolean
isRouteMatchAcceptedContentType(IRoute<R> route,
List<String> requestContentTypes)
protected boolean
isRouteMatchHttpMethod(IRoute<R> route,
HttpMethod httpMethod)
Validate if a route matches the given HTTP method.
protected boolean
isRoutingTypeMatch(RoutingType routingType,
IRoute<R> route)
void
notFound(IHandler<R> handler)
Creates a route considered during an "Not Found" routing process.
void
notFound(String path,
IHandler<R> handler)
Creates a route considered during an "Not Found" routing process.
IRouteBuilder<R>
OPTIONS(String path)
Starts the creation of a OPTIONS
route.
IRouteBuilder<R>
PATCH(String path)
Starts the creation of a PATCH
route.
IRouteBuilder<R>
POST(String path)
Starts the creation of a POST
route.
IRouteBuilder<R>
PUT(String path)
Starts the creation of a PUT
route.
IRedirectRuleBuilder
redirect(String oldPath)
Starts the creation of a redirection rule.
void
removeAllRoutes()
Removes all routes.
void
removeRoute(String routeId)
Removes a route using its routeId
.
IRoutingResult<R>
route(R requestContext)
Find the route to use to handle the current request.
IRoutingResult<R>
route(R requestContext,
RoutingType routingType)
Find the route to use to handle the current request, given the
specified routing type.
IRoutingResult<R>
route(R requestContext,
String fullUrl,
RoutingType routingType)
IRouteBuilder<R>
SOME(String path,
HttpMethod... httpMethods)
Starts the creation of a route matching the specified
HTTP methods.
IRouteBuilder<R>
SOME(String path,
Set<HttpMethod> httpMethods)
Starts the creation of a route matching the specified
HTTP methods.
IRouteBuilder<R>
TRACE(String path)
Starts the creation of a TRACE
route.
protected void
validateId(String id)
protected void
validatePath(String path)
Validate the path of a route.
protected Map<String,String>
validatePath(String routePath,
URL url)
Validate if url matches the path of the route and if so, returns the
parsed parameters, if any.
protected void
validation()
IWebsocketRouteBuilder<R,W>
websocket(String path)
Starts the creation of a Websocket route
.
-
-
Constructor Detail
-
SpincastRouter
@Inject
public SpincastRouter(SpincastRouterDeps<R,W> spincastRouterDeps)
-
Method Detail
-
init
@Inject
protected void init()
-
validation
protected void validation()
-
addDefaultFilters
protected void addDefaultFilters()
-
getSpincastRouterConfig
protected ISpincastRouterConfig getSpincastRouterConfig()
-
getRouteFactory
protected IRouteFactory<R> getRouteFactory()
-
getSpincastConfig
protected ISpincastConfig getSpincastConfig()
-
getSpincastDictionary
protected ISpincastDictionary getSpincastDictionary()
-
getServer
protected IServer getServer()
-
getSpincastFilters
protected ISpincastFilters<R> getSpincastFilters()
-
getRouteBuilderFactory
protected IRouteBuilderFactory<R,W> getRouteBuilderFactory()
-
getRedirectRuleBuilderFactory
protected IRedirectRuleBuilderFactory<R,W> getRedirectRuleBuilderFactory()
-
getWebsocketRouteBuilderFactory
protected IWebsocketRouteBuilderFactory<R,W> getWebsocketRouteBuilderFactory()
-
getWebsocketRouteHandlerFactory
protected IWebsocketRouteHandlerFactory<R,W> getWebsocketRouteHandlerFactory()
-
getStaticResourceBuilderFactory
protected IStaticResourceBuilderFactory<R,W> getStaticResourceBuilderFactory()
-
getRouteHandlerMatchFactory
protected IRouteHandlerMatchFactory<R> getRouteHandlerMatchFactory()
-
getStaticResourceFactory
protected IStaticResourceFactory<R> getStaticResourceFactory()
-
getSpincastRoutingUtils
protected ISpincastRoutingUtils getSpincastRoutingUtils()
-
getRouteParamPatternAliases
public Map<String,String> getRouteParamPatternAliases()
Description copied from interface: IRouter
The path patterns' aliases.
Themap is mutable.
- Specified by:
getRouteParamPatternAliases
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
getRoute
public IRoute<R> getRoute(String routeId)
Description copied from interface: IRouter
Gets a route using its routeId
.
- Specified by:
getRoute
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
getGlobalBeforeFiltersPerPosition
protected Map<Integer,List<IRoute<R>>> getGlobalBeforeFiltersPerPosition()
-
getGlobalBeforeFiltersRoutes
public List<IRoute<R>> getGlobalBeforeFiltersRoutes()
Description copied from interface: IRouter
Gets the global "before" filters.
- Specified by:
getGlobalBeforeFiltersRoutes
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
getGlobalAfterFiltersPerPosition
protected Map<Integer,List<IRoute<R>>> getGlobalAfterFiltersPerPosition()
-
getGlobalAfterFiltersRoutes
public List<IRoute<R>> getGlobalAfterFiltersRoutes()
Description copied from interface: IRouter
Gets the global "after" filters.
- Specified by:
getGlobalAfterFiltersRoutes
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
getMainRoutes
public List<IRoute<R>> getMainRoutes()
Description copied from interface: IRouter
Gets the main routes.
- Specified by:
getMainRoutes
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
addRoute
public void addRoute(IRoute<R> route)
Description copied from interface: IRouter
Adds a route, directly.
- Specified by:
addRoute
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
validateId
protected void validateId(String id)
-
validatePath
protected void validatePath(String path)
Validate the path of a route.
Throws an exception if not valide.
-
removeAllRoutes
public void removeAllRoutes()
Description copied from interface: IRouter
Removes all routes.
- Specified by:
removeAllRoutes
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
removeRoute
public void removeRoute(String routeId)
Description copied from interface: IRouter
Removes a route using its routeId
.
- Specified by:
removeRoute
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
route
public IRoutingResult<R> route(R requestContext)
Description copied from interface: IRouter
Find the route to use to handle the current request. The result
contains all handlers to use.
- Specified by:
route
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- Returns:
- the routing result or
null
if no route matches.
-
route
public IRoutingResult<R> route(R requestContext,
RoutingType routingType)
Description copied from interface: IRouter
Find the route to use to handle the current request, given the
specified routing type. The result contains all handlers to use.
- Specified by:
route
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- Returns:
- the routing result or
null
if no route matches.
-
route
public IRoutingResult<R> route(R requestContext,
String fullUrl,
RoutingType routingType)
-
isRoutingTypeMatch
protected boolean isRoutingTypeMatch(RoutingType routingType,
IRoute<R> route)
-
createRoutingResult
protected IRoutingResult<R> createRoutingResult(List<IRouteHandlerMatch<R>> routeHandlerMatches)
-
createRegularHandlerMatches
protected List<IRouteHandlerMatch<R>> createRegularHandlerMatches(RoutingType routingType,
IRoute<R> route,
HttpMethod httpMethod,
List<String> acceptedContentTypes,
URL url,
int position)
Get the matches (filters and main handle) if the route matches the URL and
HTTP method, or returns NULL otherwise.
-
isRouteMatchAcceptedContentType
protected boolean isRouteMatchAcceptedContentType(IRoute<R> route,
List<String> requestContentTypes)
-
createNoMatchingParamsHandlerMatch
protected IRouteHandlerMatch<R> createNoMatchingParamsHandlerMatch(IRoute<R> route,
String id,
IHandler<R> handler,
int position)
Creates an handler match with no matching params.
-
createHandlerMatchForBeforeOrAfterFilter
protected IRouteHandlerMatch<R> createHandlerMatchForBeforeOrAfterFilter(IRouteHandlerMatch<R> mainRouteHandlerMatch,
IHandler<R> beforeOrAfterMethod,
int position)
Creates a new match for a "before" or "after" handler specific
to a route. THis measn keeping the same informations as the
main handler.
-
isRouteMatchHttpMethod
protected boolean isRouteMatchHttpMethod(IRoute<R> route,
HttpMethod httpMethod)
Validate if a route matches the given HTTP method.
-
validatePath
protected Map<String,String> validatePath(String routePath,
URL url)
Validate if url matches the path of the route and if so, returns the
parsed parameters, if any.
Returns NULL if there is no match.
-
getPatternFromAlias
protected String getPatternFromAlias(String alias)
Get a path pattern from its alias.
- Returns:
- the pattern or NULL if not found.
-
addRouteParamPatternAlias
public void addRouteParamPatternAlias(String alias,
String pattern)
Description copied from interface: IRouter
Adds an alias for a path pattern. For example,
the path of a route may be "/${param1:<XXX>}"
: here "XXX" is the alias for the
regular expression pattern to use.
- Specified by:
addRouteParamPatternAlias
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
GET
public IRouteBuilder<R> GET(String path)
Description copied from interface: IRouter
Starts the creation of a GET
route.
- Specified by:
GET
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
POST
public IRouteBuilder<R> POST(String path)
Description copied from interface: IRouter
Starts the creation of a POST
route.
- Specified by:
POST
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
PUT
public IRouteBuilder<R> PUT(String path)
Description copied from interface: IRouter
Starts the creation of a PUT
route.
- Specified by:
PUT
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
DELETE
public IRouteBuilder<R> DELETE(String path)
Description copied from interface: IRouter
Starts the creation of a DELETE
route.
- Specified by:
DELETE
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
OPTIONS
public IRouteBuilder<R> OPTIONS(String path)
Description copied from interface: IRouter
Starts the creation of a OPTIONS
route.
- Specified by:
OPTIONS
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
TRACE
public IRouteBuilder<R> TRACE(String path)
Description copied from interface: IRouter
Starts the creation of a TRACE
route.
- Specified by:
TRACE
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
HEAD
public IRouteBuilder<R> HEAD(String path)
Description copied from interface: IRouter
Starts the creation of a HEAD
route.
- Specified by:
HEAD
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
PATCH
public IRouteBuilder<R> PATCH(String path)
Description copied from interface: IRouter
Starts the creation of a PATCH
route.
- Specified by:
PATCH
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
ALL
public IRouteBuilder<R> ALL(String path)
Description copied from interface: IRouter
Starts the creation of a route matching any HTTP method.
- Specified by:
ALL
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
SOME
public IRouteBuilder<R> SOME(String path,
HttpMethod... httpMethods)
Description copied from interface: IRouter
Starts the creation of a route matching the specified
HTTP methods.
- Specified by:
SOME
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
SOME
public IRouteBuilder<R> SOME(String path,
Set<HttpMethod> httpMethods)
Description copied from interface: IRouter
Starts the creation of a route matching the specified
HTTP methods.
- Specified by:
SOME
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
before
public void before(IHandler<R> handler)
Description copied from interface: IRouter
Creates a "before" filter.
Synonym of :
ALL("/*{path}").pos(-1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()
- Specified by:
before
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
before
public void before(String path,
IHandler<R> handler)
Description copied from interface: IRouter
Creates a "before" filter.
Synonym of :
ALL(path).pos(-1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()
- Specified by:
before
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
after
public void after(IHandler<R> handler)
Description copied from interface: IRouter
Creates an "after" filter.
Synonym of :
ALL("/*{path}").pos(1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()
- Specified by:
after
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
after
public void after(String path,
IHandler<R> handler)
Description copied from interface: IRouter
Creates an "after" filter.
Synonym of :
ALL(path).pos(1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()
- Specified by:
after
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
beforeAndAfter
public void beforeAndAfter(IHandler<R> handler)
Description copied from interface: IRouter
Creates a "before" and an "after" filters.
Synonym of :
ALL("/*{path}").pos(-1).save(handler)
and
ALL("/*{path}").pos(1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()
- Specified by:
beforeAndAfter
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
beforeAndAfter
public void beforeAndAfter(String path,
IHandler<R> handler)
Description copied from interface: IRouter
Creates a "before" and an "after" filters.
Synonym of :
ALL(path).pos(-1).save(handler)
and
ALL(path).pos(1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()
- Specified by:
beforeAndAfter
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
addFilterDefaultRoutingTypes
protected IRouteBuilder<R> addFilterDefaultRoutingTypes(IRouteBuilder<R> builder)
-
exception
public void exception(IHandler<R> handler)
Description copied from interface: IRouter
Creates a route considered during an "Exception" routing process.
Synonym of :
ALL("/*{path}").exception().save(handler)
- Specified by:
exception
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
exception
public void exception(String path,
IHandler<R> handler)
Description copied from interface: IRouter
Creates a route considered during an "Exception" routing process.
Synonym of :
ALL(path).exception().save(handler)
- Specified by:
exception
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
notFound
public void notFound(IHandler<R> handler)
Description copied from interface: IRouter
Creates a route considered during an "Not Found" routing process.
Synonym of :
ALL("/*{path}").notFound().save(handler)
- Specified by:
notFound
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
notFound
public void notFound(String path,
IHandler<R> handler)
Description copied from interface: IRouter
Creates a route considered during an "Not Found" routing process.
Synonym of :
ALL(path).notFound().save(handler)
- Specified by:
notFound
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
cors
public void cors()
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on all
matching requests (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context)
-
cors
public void cors(Set<String> allowedOrigins)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins)
-
cors
public void cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeReadt)
-
cors
public void cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)
-
cors
public void cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)
-
cors
public void cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods)
-
cors
public void cors(Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods,
int maxAgeInSeconds)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
matching requests (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods,
int maxAgeInSeconds)
-
cors
public void cors(String path)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on all
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context)
-
cors
public void cors(String path,
Set<String> allowedOrigins)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins)
-
cors
public void cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)
-
cors
public void cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)
-
cors
public void cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)
-
cors
public void cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods)
-
cors
public void cors(String path,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods,
int maxAgeInSeconds)
Description copied from interface: IRouter
Enables Cross-Origin Resource Sharing (Cors) on
requests matching the specified path (except the static resources,
for whom cors has to be activated directly!)
- Specified by:
cors
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- See Also:
ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods,
int maxAgeInSeconds)
-
file
public IStaticResourceBuilder<R> file(String url)
Description copied from interface: IRouter
Start the creation of a static resource
file.
Only a GET
or a HEAD
request will be able
to access this resource.
No "before" and "after" filters will be applied to those, since the request
won't even reach the framework.
- Specified by:
file
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- Parameters:
url
- The url which will trigger the output of this
static resource.
-
dir
public IStaticResourceBuilder<R> dir(String url)
Description copied from interface: IRouter
Start the creation of a static resource
directory.
Only a GET
or a HEAD
request will be able
to access the resources below this directory.
No "before" and "after" filters will be applied to those, since the request
won't even reach the framework.
- Specified by:
dir
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- Parameters:
url
- The url which will trigger the output of this
static resource.
-
addStaticResource
public void addStaticResource(IStaticResource<R> staticResource)
Description copied from interface: IRouter
Adds a static resource
route, directly.
- Specified by:
addStaticResource
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
isCreateStaticResourceOnDisk
protected boolean isCreateStaticResourceOnDisk()
-
httpAuth
public void httpAuth(String pathPrefix,
String realmName)
Description copied from interface: IRouter
Creates HTTP authentication protection (realm) for the
specified path prefix.
- Specified by:
httpAuth
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
websocket
public IWebsocketRouteBuilder<R,W> websocket(String path)
Description copied from interface: IRouter
Starts the creation of a Websocket route
.
- Specified by:
websocket
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
addWebsocketRoute
public void addWebsocketRoute(IWebsocketRoute<R,W> websocketRoute)
Description copied from interface: IRouter
Adds a Websocket route, directly.
- Specified by:
addWebsocketRoute
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
-
createHttpRouteFromWebsocketRoute
protected IRoute<R> createHttpRouteFromWebsocketRoute(IWebsocketRoute<R,W> websocketRoute)
-
redirect
public IRedirectRuleBuilder redirect(String oldPath)
Description copied from interface: IRouter
Starts the creation of a redirection rule.
- Specified by:
redirect
in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>
- Parameters:
oldPath
- The old path that needs to be redirected.
Copyright © 2016. All rights reserved.