Class SpincastRouter<R extends RequestContext<?>,W extends WebsocketContext<?>>
- All Implemented Interfaces:
Router<R,
W>
- Direct Known Subclasses:
AppRouterDefault
,AppRouterDefault
,DefaultRouterDefault
-
Field Summary
Fields inherited from interface org.spincast.core.routing.Router
DEFAULT_ROUTE_PATH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
Adds a route, directly.void
addRouteParamPatternAlias
(String alias, String pattern) Adds an alias for a path pattern.void
addStaticResource
(StaticResource<R> staticResource) Adds astatic resource
route, directly.void
addWebsocketRoute
(WebsocketRoute<R, W> websocketRoute) Adds a Websocket route, directly.ALL()
Starts the creation of a route matching any HTTP method, and on any path.Starts the creation of a route matching any HTTP method.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
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
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
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!)void
Enables Cross-Origin Resource Sharing (Cors) on matching requests (except the static resources, for whom cors has to be activated directly!)void
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!)protected RouteHandlerMatch<R>
createHandlerMatchForBeforeOrAfterFilter
(RouteHandlerMatch<R> mainRouteHandlerMatch, Handler<R> beforeOrAfterMethod, int position) Creates a new match for a "before" or "after" handler specific to a route.createHttpRouteFromWebsocketRoute
(WebsocketRoute<R, W> websocketRoute) protected RouteHandlerMatch<R>
Creates an handler match with no matching params.protected List<RouteHandlerMatch<R>>
createRegularHandlerMatches
(RoutingType routingType, Route<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 RoutingResult<R>
createRoutingResult
(List<RouteHandlerMatch<R>> routeHandlerMatches) DELETE()
Starts the creation of aDELETE
route, for all path.Starts the creation of aDELETE
route.Start the creation of astatic resource
directory.void
Creates a route considered during an "Exception" routing process.void
Creates a route considered during an "Exception" routing process.Start the creation of astatic resource
file.GET()
Starts the creation of aGET
route, for all path.Starts the creation of aGET
route.protected Dictionary
Gets the global "after" filters.Gets the global "before" filters.protected LocaleResolver
Gets the main routes.protected Pattern
getPattern
(String patternStr) protected String
getPatternFromAlias
(String alias) Get a path pattern from its alias.protected String
getPatternFromDictionaryKey
(String dictionaryKey) Get a path pattern from a dictionary key.protected RedirectRuleBuilderFactory<R,
W> Gets a route using itsrouteId
.protected RouteBuilderFactory<R,
W> protected RouteFactory<R>
protected RouteHandlerMatchFactory<R>
The path patterns' aliases.protected Server
protected SpincastConfig
protected SpincastFilters<R>
protected SpincastRouterConfig
protected SpincastRoutingUtils
protected StaticResourceBuilderFactory<R,
W> protected StaticResourceFactory<R>
protected WebsocketRouteBuilderFactory<R,
W> protected WebsocketRouteHandlerFactory<R,
W> HEAD()
Starts the creation of aHEAD
route, for all path.Starts the creation of aHEAD
route.void
Creates HTTP authentication protection (realm) for the specified path prefix.protected void
init()
protected boolean
protected boolean
isMustSkipResourceRequest
(Route<R> mainRoute, Route<R> filterRoute) protected boolean
isRouteMatchAcceptedContentType
(Route<R> route, List<String> requestContentTypes) protected boolean
isRouteMatchHttpMethod
(Route<R> route, HttpMethod httpMethod) Validate if a route matches the given HTTP method.protected boolean
isRoutingTypeMatch
(RoutingType routingType, Route<R> route) methods
(String path, Set<HttpMethod> httpMethods) Starts the creation of a route matching the specified HTTP methods.methods
(String path, HttpMethod... httpMethods) Starts the creation of a route matching the specified HTTP methods.methods
(Set<HttpMethod> httpMethods) Starts the creation of a route matching the specified HTTP methods and on any path.methods
(HttpMethod... httpMethods) Starts the creation of a route matching the specified HTTP methods and on any path.void
Creates a route considered during an "Not Found" routing process.void
Creates a route considered during an "Not Found" routing process.OPTIONS()
Starts the creation of aOPTIONS
route, for all path.Starts the creation of aOPTIONS
route.PATCH()
Starts the creation of aPATCH
route, for all path.Starts the creation of aPATCH
route.POST()
Starts the creation of aPOST
route, for all path.Starts the creation of aPOST
route.PUT()
Starts the creation of aPUT
route, for all path.Starts the creation of aPUT
route.Starts the creation of a redirection rule.void
Removes all application routes (not the ones added by Spincast and plugins).void
removeAllRoutes
(boolean removeSpincastAndPluginsRoutesToo) Removes all routes.void
removeRoute
(String routeId) Removes a route using itsrouteId
.Find the route to use to handle the current request.route
(R requestContext, String fullUrl, RoutingType routingType) route
(R requestContext, RoutingType routingType) Find the route to use to handle the current request, given the specified routing type.protected boolean
startsWithAnyOf
(String id, Set<String> prefixes) TRACE()
Starts the creation of aTRACE
route, for all path.Starts the creation of aTRACE
route, at the specified position.protected void
validateId
(String id) protected void
validatePath
(String path) Validate the path of a route.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
Starts the creation of aWebsocket route
.
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
SpincastRouter
-
-
Method Details
-
init
@Inject protected void init() -
validation
protected void validation() -
addDefaultFilters
protected void addDefaultFilters() -
getSpincastRouterConfig
-
getRouteFactory
-
getSpincastConfig
-
getDictionary
-
getServer
-
getSpincastFilters
-
getRouteBuilderFactory
-
getRedirectRuleBuilderFactory
-
getWebsocketRouteBuilderFactory
-
getWebsocketRouteHandlerFactory
-
getStaticResourceBuilderFactory
-
getRouteHandlerMatchFactory
-
getStaticResourceFactory
-
getSpincastRoutingUtils
-
getLocaleResolver
-
getPattern
-
getRouteParamPatternAliases
Description copied from interface:Router
The path patterns' aliases. The map is mutable.- Specified by:
getRouteParamPatternAliases
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
getRouteParamPatternFromDictionaryKeyCache
-
getRoute
Description copied from interface:Router
Gets a route using itsrouteId
.- Specified by:
getRoute
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
getGlobalBeforeFiltersPerPosition
-
getGlobalBeforeFiltersRoutes
Description copied from interface:Router
Gets the global "before" filters.- Specified by:
getGlobalBeforeFiltersRoutes
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
getGlobalAfterFiltersPerPosition
-
getGlobalAfterFiltersRoutes
Description copied from interface:Router
Gets the global "after" filters.- Specified by:
getGlobalAfterFiltersRoutes
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
getMainRoutes
Description copied from interface:Router
Gets the main routes.- Specified by:
getMainRoutes
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
addRoute
Description copied from interface:Router
Adds a route, directly.- Specified by:
addRoute
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
validateId
-
validatePath
Validate the path of a route. Throws an exception if not valide. -
removeAllRoutes
public void removeAllRoutes()Description copied from interface:Router
Removes all application routes (not the ones added by Spincast and plugins).- Specified by:
removeAllRoutes
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
removeAllRoutes
public void removeAllRoutes(boolean removeSpincastAndPluginsRoutesToo) Description copied from interface:Router
Removes all routes.- Specified by:
removeAllRoutes
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - Parameters:
removeSpincastAndPluginsRoutesToo
- Should the routes added by Spincast and plugins be removed too?
-
startsWithAnyOf
-
removeRoute
Description copied from interface:Router
Removes a route using itsrouteId
.- Specified by:
removeRoute
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
route
Description copied from interface:Router
Find the route to use to handle the current request. The result contains all handlers to use.- Specified by:
route
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - Returns:
- the routing result or
null
if no route matches.
-
route
Description copied from interface:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - Returns:
- the routing result or
null
if no route matches.
-
route
-
isRoutingTypeMatch
-
isMustSkipResourceRequest
-
createRoutingResult
-
createRegularHandlerMatches
protected List<RouteHandlerMatch<R>> createRegularHandlerMatches(RoutingType routingType, Route<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
-
createNoMatchingParamsHandlerMatch
protected RouteHandlerMatch<R> createNoMatchingParamsHandlerMatch(Route<R> route, String id, Handler<R> handler, int position) Creates an handler match with no matching params. -
createHandlerMatchForBeforeOrAfterFilter
protected RouteHandlerMatch<R> createHandlerMatchForBeforeOrAfterFilter(RouteHandlerMatch<R> mainRouteHandlerMatch, Handler<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
Validate if a route matches the given HTTP method. -
validatePath
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
Get a path pattern from its alias.- Returns:
- the pattern or NULL if not found.
-
getPatternFromDictionaryKey
Get a path pattern from a dictionary key.- Returns:
- the pattern or NULL if not found.
-
addRouteParamPatternAlias
Description copied from interface:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
GET
Description copied from interface:Router
Starts the creation of aGET
route, for all path. Same asGET("/*{path}")
.- Specified by:
GET
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
GET
Description copied from interface:Router
Starts the creation of aGET
route.- Specified by:
GET
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
POST
Description copied from interface:Router
Starts the creation of aPOST
route, for all path. Same asPOST("/*{path}")
.- Specified by:
POST
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
POST
Description copied from interface:Router
Starts the creation of aPOST
route.- Specified by:
POST
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
PUT
Description copied from interface:Router
Starts the creation of aPUT
route, for all path. Same asPUT("/*{path}")
.- Specified by:
PUT
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
PUT
Description copied from interface:Router
Starts the creation of aPUT
route.- Specified by:
PUT
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
DELETE
Description copied from interface:Router
Starts the creation of aDELETE
route, for all path. Same asDELETE("/*{path}")
.- Specified by:
DELETE
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
DELETE
Description copied from interface:Router
Starts the creation of aDELETE
route.- Specified by:
DELETE
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
OPTIONS
Description copied from interface:Router
Starts the creation of aOPTIONS
route, for all path. Same asOPTIONS("/*{path}")
.- Specified by:
OPTIONS
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
OPTIONS
Description copied from interface:Router
Starts the creation of aOPTIONS
route.- Specified by:
OPTIONS
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
TRACE
Description copied from interface:Router
Starts the creation of aTRACE
route, for all path. Same asTRACE("/*{path}")
.- Specified by:
TRACE
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
TRACE
Description copied from interface:Router
Starts the creation of aTRACE
route, at the specified position.- Specified by:
TRACE
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
HEAD
Description copied from interface:Router
Starts the creation of aHEAD
route, for all path. Same asHEAD("/*{path}")
.- Specified by:
HEAD
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
HEAD
Description copied from interface:Router
Starts the creation of aHEAD
route.- Specified by:
HEAD
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
PATCH
Description copied from interface:Router
Starts the creation of aPATCH
route, for all path. Same asPATCH("/*{path}")
.- Specified by:
PATCH
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
PATCH
Description copied from interface:Router
Starts the creation of aPATCH
route.- Specified by:
PATCH
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
ALL
Description copied from interface:Router
Starts the creation of a route matching any HTTP method, and on any path. Same asALL("/*{path}")
.- Specified by:
ALL
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
ALL
Description copied from interface:Router
Starts the creation of a route matching any HTTP method.- Specified by:
ALL
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
methods
Description copied from interface:Router
Starts the creation of a route matching the specified HTTP methods and on any path. Same asmethods("/*{path}", httpMethods)
.- Specified by:
methods
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
methods
Description copied from interface:Router
Starts the creation of a route matching the specified HTTP methods.- Specified by:
methods
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
methods
Description copied from interface:Router
Starts the creation of a route matching the specified HTTP methods and on any path. Same asmethods("/*{path}", httpMethods)
.- Specified by:
methods
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
methods
Description copied from interface:Router
Starts the creation of a route matching the specified HTTP methods.- Specified by:
methods
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
exception
Description copied from interface:Router
Creates a route considered during an "Exception" routing process.Synonym of :
ALL("/*{path}").exception().handle(handler)
- Specified by:
exception
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
exception
Description copied from interface:Router
Creates a route considered during an "Exception" routing process.Synonym of :
ALL(path).exception().handle(handler)
- Specified by:
exception
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
notFound
Description copied from interface:Router
Creates a route considered during an "Not Found" routing process.Synonym of :
ALL("/*{path}").notFound().handle(handler)
- Specified by:
notFound
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
notFound
Description copied from interface:Router
Creates a route considered during an "Not Found" routing process.Synonym of :
ALL(path).notFound().handle(handler)
- Specified by:
notFound
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
cors
public void cors()Description copied from interface:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#cors(R context)
-
cors
Description copied from interface:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#cors(R context, Set<String> allowedOrigins)
-
cors
Description copied from interface:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#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:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#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:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#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:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#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:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#cors(R context, Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, Set<HttpMethod> allowedMethods, int maxAgeInSeconds)
-
cors
Description copied from interface:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#cors(R context)
-
cors
Description copied from interface:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#cors(R context, Set<String> allowedOrigins)
-
cors
Description copied from interface:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#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:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#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:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#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:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#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:Router
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - See Also:
-
SpincastFilters#cors(R context, Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, Set<HttpMethod> allowedMethods, int maxAgeInSeconds)
-
file
Description copied from interface:Router
Start the creation of astatic resource
file.Only a
GET
or aHEAD
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - Parameters:
url
- The url which will trigger the output of this static resource.
-
dir
Description copied from interface:Router
Start the creation of astatic resource
directory.Only a
GET
or aHEAD
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 interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - Parameters:
url
- The url which will trigger the output of this static resource.
-
addStaticResource
Description copied from interface:Router
Adds astatic resource
route, directly.- Specified by:
addStaticResource
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
isCreateStaticResourceOnDisk
protected boolean isCreateStaticResourceOnDisk() -
httpAuth
Description copied from interface:Router
Creates HTTP authentication protection (realm) for the specified path prefix.- Specified by:
httpAuth
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
websocket
Description copied from interface:Router
Starts the creation of aWebsocket route
.- Specified by:
websocket
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
addWebsocketRoute
Description copied from interface:Router
Adds a Websocket route, directly.- Specified by:
addWebsocketRoute
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>>
-
createHttpRouteFromWebsocketRoute
-
redirect
Description copied from interface:Router
Starts the creation of a redirection rule.Redirecttion rule are ran at position "0", as a regular route. Therefore the order in which they are added to the router is very important! As soon as a redirect rule matches, the request is redirected.
- Specified by:
redirect
in interfaceRouter<R extends RequestContext<?>,
W extends WebsocketContext<?>> - Parameters:
oldPath
- The old path that needs to be redirected.
-