public class SpincastRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>> extends Object implements IRouter<R,W>
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
DEFAULT_ROUTE_PATH| Constructor and Description |
|---|
SpincastRouter(ISpincastRouterConfig spincastRouterConfig,
IRouteFactory<R> routeFactory,
ISpincastConfig spincastConfig,
ISpincastDictionary spincastDictionary,
IServer server,
ISpincastFilters<R> spincastFilters,
IRouteBuilderFactory<R,W> routeBuilderFactory,
IStaticResourceBuilderFactory<R,W> staticResourceBuilderFactory,
IRouteHandlerMatchFactory<R> routeHandlerMatchFactory,
IStaticResourceFactory<R> staticResourceFactory,
IWebsocketRouteBuilderFactory<R,W> websocketRouteBuilderFactory,
IWebsocketRouteHandlerFactory<R,W> websocketRouteHandlerFactory) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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 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 |
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. |
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. |
@Inject public SpincastRouter(ISpincastRouterConfig spincastRouterConfig, IRouteFactory<R> routeFactory, ISpincastConfig spincastConfig, ISpincastDictionary spincastDictionary, IServer server, ISpincastFilters<R> spincastFilters, IRouteBuilderFactory<R,W> routeBuilderFactory, IStaticResourceBuilderFactory<R,W> staticResourceBuilderFactory, IRouteHandlerMatchFactory<R> routeHandlerMatchFactory, IStaticResourceFactory<R> staticResourceFactory, IWebsocketRouteBuilderFactory<R,W> websocketRouteBuilderFactory, IWebsocketRouteHandlerFactory<R,W> websocketRouteHandlerFactory)
@Inject protected void init()
protected void validation()
protected ISpincastRouterConfig getSpincastRouterConfig()
protected IRouteFactory<R> getRouteFactory()
protected ISpincastConfig getSpincastConfig()
protected ISpincastDictionary getSpincastDictionary()
protected IServer getServer()
protected ISpincastFilters<R> getSpincastFilters()
protected IRouteBuilderFactory<R,W> getRouteBuilderFactory()
protected IWebsocketRouteBuilderFactory<R,W> getWebsocketRouteBuilderFactory()
protected IWebsocketRouteHandlerFactory<R,W> getWebsocketRouteHandlerFactory()
protected IStaticResourceBuilderFactory<R,W> getStaticResourceBuilderFactory()
protected IRouteHandlerMatchFactory<R> getRouteHandlerMatchFactory()
protected IStaticResourceFactory<R> getStaticResourceFactory()
public Map<String,String> getRouteParamPatternAliases()
IRoutergetRouteParamPatternAliases in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRoute<R> getRoute(String routeId)
IRouterrouteId.getRoute in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>protected Map<Integer,List<IRoute<R>>> getGlobalBeforeFiltersPerPosition()
public List<IRoute<R>> getGlobalBeforeFiltersRoutes()
IRoutergetGlobalBeforeFiltersRoutes in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>protected Map<Integer,List<IRoute<R>>> getGlobalAfterFiltersPerPosition()
public List<IRoute<R>> getGlobalAfterFiltersRoutes()
IRoutergetGlobalAfterFiltersRoutes in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public List<IRoute<R>> getMainRoutes()
IRoutergetMainRoutes in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void addRoute(IRoute<R> route)
IRouteraddRoute in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>protected void validateId(String id)
protected void validatePath(String path)
public void removeAllRoutes()
IRouterremoveAllRoutes in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void removeRoute(String routeId)
IRouterrouteId.removeRoute in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRoutingResult<R> route(R requestContext)
IRouterroute in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>null if no route matches.public IRoutingResult<R> route(R requestContext, RoutingType routingType)
IRouterroute in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>null if no route matches.public IRoutingResult<R> route(R requestContext, String fullUrl, RoutingType routingType)
protected boolean isRoutingTypeMatch(RoutingType routingType, IRoute<R> route)
protected IRoutingResult<R> createRoutingResult(List<IRouteHandlerMatch<R>> routeHandlerMatches)
protected List<IRouteHandlerMatch<R>> createRegularHandlerMatches(RoutingType routingType, IRoute<R> route, HttpMethod httpMethod, List<String> acceptedContentTypes, URL url, int position)
protected boolean isRouteMatchAcceptedContentType(IRoute<R> route, List<String> requestContentTypes)
protected IRouteHandlerMatch<R> createNoMatchingParamsHandlerMatch(IRoute<R> route, String id, IHandler<R> handler, int position)
protected IRouteHandlerMatch<R> createHandlerMatchForBeforeOrAfterFilter(IRouteHandlerMatch<R> mainRouteHandlerMatch, IHandler<R> beforeOrAfterMethod, int position)
protected boolean isRouteMatchHttpMethod(IRoute<R> route, HttpMethod httpMethod)
protected Map<String,String> validatePath(String routePath, URL url)
protected String getPatternFromAlias(String alias)
public void addRouteParamPatternAlias(String alias, String pattern)
IRouter"/${param1:<XXX>}" : here "XXX" is the alias for the
regular expression pattern to use.addRouteParamPatternAlias in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> GET(String path)
IRouterGET route.GET in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> POST(String path)
IRouterPOST route.POST in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> PUT(String path)
IRouterPUT route.PUT in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> DELETE(String path)
IRouterDELETE route.DELETE in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> OPTIONS(String path)
IRouterOPTIONS route.OPTIONS in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> TRACE(String path)
IRouterTRACE route.TRACE in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> HEAD(String path)
IRouterHEAD route.HEAD in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> PATCH(String path)
IRouterPATCH route.PATCH in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> ALL(String path)
IRouterALL in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> SOME(String path, HttpMethod... httpMethods)
IRouterSOME in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IRouteBuilder<R> SOME(String path, Set<HttpMethod> httpMethods)
IRouterSOME in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void before(IHandler<R> handler)
IRouterALL("/*{path}").pos(-1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()before in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void before(String path, IHandler<R> handler)
IRouterALL(path).pos(-1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()before in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void after(IHandler<R> handler)
IRouterALL("/*{path}").pos(1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()after in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void after(String path, IHandler<R> handler)
IRouterALL(path).pos(1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()after in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void beforeAndAfter(IHandler<R> handler)
IRouterALL("/*{path}").pos(-1).save(handler)
and
ALL("/*{path}").pos(1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()beforeAndAfter in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void beforeAndAfter(String path, IHandler<R> handler)
IRouterALL(path).pos(-1).save(handler)
and
ALL(path).pos(1).save(handler)
and with the Routing types as returned by
ISpincastRouterConfig#getFilterDefaultRoutingTypes()beforeAndAfter in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>protected IRouteBuilder<R> addFilterDefaultRoutingTypes(IRouteBuilder<R> builder)
public void exception(IHandler<R> handler)
IRouterALL("/*{path}").exception().save(handler)exception in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void exception(String path, IHandler<R> handler)
IRouterALL(path).exception().save(handler)exception in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void notFound(IHandler<R> handler)
IRouterALL("/*{path}").notFound().save(handler)notFound in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void notFound(String path, IHandler<R> handler)
IRouterALL(path).notFound().save(handler)notFound in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void cors()
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context)public void cors(Set<String> allowedOrigins)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins)public void cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeReadt)public void cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)public void cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)public void cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, Set<HttpMethod> allowedMethods)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods)public void cors(Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, Set<HttpMethod> allowedMethods, int maxAgeInSeconds)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods,
int maxAgeInSeconds)public void cors(String path)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context)public void cors(String path, Set<String> allowedOrigins)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins)public void cors(String path, Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead)public void cors(String path, Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent)public void cors(String path, Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies)public void cors(String path, Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, Set<HttpMethod> allowedMethods)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods)public void cors(String path, Set<String> allowedOrigins, Set<String> extraHeadersAllowedToBeRead, Set<String> extraHeadersAllowedToBeSent, boolean allowCookies, Set<HttpMethod> allowedMethods, int maxAgeInSeconds)
IRoutercors in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>ISpincastFilters#cors(R context,
Set<String> allowedOrigins,
Set<String> extraHeadersAllowedToBeRead,
Set<String> extraHeadersAllowedToBeSent,
boolean allowCookies,
Set<HttpMethod> allowedMethods,
int maxAgeInSeconds)public IStaticResourceBuilder<R> file(String url)
IRouterstatic resource file.
No "before" and "after" filters will be applied to those, since the request
won't even reach the framework.file in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>url - The url which will trigger the output of this
static resource.public IStaticResourceBuilder<R> dir(String url)
IRouterstatic resource directory.
No "before" and "after" filters will be applied to those, since the request
won't even reach the framework.dir in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>url - The url which will trigger the output of this
static resource.public void addStaticResource(IStaticResource<R> staticResource)
IRouterstatic resource route, directly.addStaticResource in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void httpAuth(String pathPrefix, String realmName)
IRouterhttpAuth in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public IWebsocketRouteBuilder<R,W> websocket(String path)
IRouterWebsocket route.websocket in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>public void addWebsocketRoute(IWebsocketRoute<R,W> websocketRoute)
IRouteraddWebsocketRoute in interface IRouter<R extends IRequestContext<?>,W extends IWebsocketContext<?>>protected IRoute<R> createHttpRouteFromWebsocketRoute(IWebsocketRoute<R,W> websocketRoute)
Copyright © 2016. All rights reserved.