public class RouteBuilder<R extends IRequestContext<?>,W extends IWebsocketContext<?>> extends Object implements IRouteBuilder<R>
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
RouteBuilder(IRouteFactory<R> routeFactory,
ISpincastRouterConfig spincastRouterConfig,
ISpincastFilters<R> spincastFilters) |
RouteBuilder(IRouter<R,W> router,
IRouteFactory<R> routeFactory,
ISpincastRouterConfig spincastRouterConfig,
ISpincastFilters<R> spincastFilters) |
| Modifier and Type | Method and Description |
|---|---|
IRouteBuilder<R> |
accept(ContentTypeDefaults... acceptedContentTypes)
Sets the accepted
Content-Types. |
IRouteBuilder<R> |
accept(Set<ContentTypeDefaults> acceptedContentTypes)
Sets the accepted
Content-Types. |
IRouteBuilder<R> |
acceptAsString(Set<String> acceptedContentTypes)
Sets the accepted
Content-Types. |
IRouteBuilder<R> |
acceptAsString(String... acceptedContentTypes)
Sets the accepted
Content-Types. |
IRouteBuilder<R> |
after(IHandler<R> afterFilter)
Adds an "after" filter which will only be applied to this particular route.
|
IRouteBuilder<R> |
ALL()
Adds all HTTP methods as being supported.
|
IRouteBuilder<R> |
allRoutingTypes()
This route will be considered for all routing types.
|
IRouteBuilder<R> |
before(IHandler<R> beforeFilter)
Adds a "before" filter which will only be applied to this particular route.
|
IRoute<R> |
create(IHandler<R> mainHandler)
Creates and returns the route without adding it to
the router.
|
IRouteBuilder<R> |
DELETE()
Adds
DELETE as a supported HTTP method. |
IRouteBuilder<R> |
exception()
This route will be considered during an
Exception routing process. |
IRouteBuilder<R> |
found()
This route will be considered during a
Found routing process. |
IRouteBuilder<R> |
GET()
Addss
GET as a supported HTTP method. |
Set<String> |
getAcceptedContentTypes() |
List<IHandler<R>> |
getAfterFilters() |
List<IHandler<R>> |
getBeforeFilters() |
Set<HttpMethod> |
getHttpMethods() |
String |
getId() |
IHandler<R> |
getMainHandler() |
String |
getPath() |
Set<Integer> |
getPositions() |
protected IRouteFactory<R> |
getRouteFactory() |
protected IRouter<R,W> |
getRouter() |
Set<RoutingType> |
getRoutingTypes() |
protected ISpincastFilters<R> |
getSpincastFilters() |
protected ISpincastRouterConfig |
getSpincastRouterConfig() |
IRouteBuilder<R> |
HEAD()
Adds
HEAD as a supported HTTP method. |
IRouteBuilder<R> |
html()
Adds
application/html as an accepted Content-Type. |
IRouteBuilder<R> |
id(String id)
An id that can be used to identify the route.
|
IRouteBuilder<R> |
json()
Adds
application/json as an accepted Content-Type. |
IRouteBuilder<R> |
notFound()
This route will be considered during a
Not Found routing process. |
IRouteBuilder<R> |
OPTIONS()
Adds
OPTIONS as a supported HTTP method. |
IRouteBuilder<R> |
PATCH()
Adds
PATCH as a supported HTTP method. |
IRouteBuilder<R> |
path(String path)
The path of the route.
|
IRouteBuilder<R> |
pos(int position)
The position of the handler.
|
IRouteBuilder<R> |
POST()
Adds
POST as a supported HTTP method. |
IRouteBuilder<R> |
PUT()
Adds
PUT as a supported HTTP method. |
void |
save(IHandler<R> mainHandler)
Creates the route and saves it to the router.
|
IRouteBuilder<R> |
SOME(HttpMethod... httpMethods)
Adds the specified HTTP methods as being supported.
|
IRouteBuilder<R> |
SOME(Set<HttpMethod> httpMethods)
Adds the specified HTTP methods as being supported.
|
IRouteBuilder<R> |
TRACE()
Adds
TRACE as a supported HTTP method. |
IRouteBuilder<R> |
xml()
Adds
application/xml as an accepted Content-Type. |
public RouteBuilder(IRouteFactory<R> routeFactory, ISpincastRouterConfig spincastRouterConfig, ISpincastFilters<R> spincastFilters)
public RouteBuilder(IRouter<R,W> router, IRouteFactory<R> routeFactory, ISpincastRouterConfig spincastRouterConfig, ISpincastFilters<R> spincastFilters)
protected IRouteFactory<R> getRouteFactory()
protected ISpincastRouterConfig getSpincastRouterConfig()
protected ISpincastFilters<R> getSpincastFilters()
public String getId()
public String getPath()
public Set<RoutingType> getRoutingTypes()
public Set<HttpMethod> getHttpMethods()
public IRouteBuilder<R> id(String id)
IRouteBuilderid in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> pos(int position)
IRouteBuilderpos in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> allRoutingTypes()
IRouteBuilderallRoutingTypes in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> found()
IRouteBuilderFound routing process.found in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> notFound()
IRouteBuilderNot Found routing process.notFound in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> exception()
IRouteBuilderException routing process.exception in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> before(IHandler<R> beforeFilter)
IRouteBuilderbefore in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> after(IHandler<R> afterFilter)
IRouteBuilderafter in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> acceptAsString(String... acceptedContentTypes)
IRouteBuilderContent-Types.
This route will only be considered for requests specifying those
Content-Types as being accepted
(using the Accept header).acceptAsString in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> acceptAsString(Set<String> acceptedContentTypes)
IRouteBuilderContent-Types.
This route will only be considered for requests specifying those
Content-Types as being accepted
(using the Accept header).acceptAsString in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> accept(ContentTypeDefaults... acceptedContentTypes)
IRouteBuilderContent-Types.
This route will only be considered for requests specifying those
Content-Types as being accepted
(using the Accept header).accept in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> accept(Set<ContentTypeDefaults> acceptedContentTypes)
IRouteBuilderContent-Types.
This route will only be considered for requests specifying those
Content-Types as being accepted
(using the Accept header).accept in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> html()
IRouteBuilderapplication/html as an accepted Content-Type.html in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> json()
IRouteBuilderapplication/json as an accepted Content-Type.json in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> xml()
IRouteBuilderapplication/xml as an accepted Content-Type.xml in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> path(String path)
IRouteBuilderpath in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> GET()
IRouteBuilderGET as a supported HTTP method.
If you started the creation of the route from an
IRouter object, you already specified some
supported HTTP methods. This one will simply be added.GET in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> POST()
IRouteBuilderPOST as a supported HTTP method.
If you started the creation of the route from an
IRouter object, you already specified some
supported HTTP methods. This one will simply be added.POST in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> PUT()
IRouteBuilderPUT as a supported HTTP method.
If you started the creation of the route from an
IRouter object, you already specified some
supported HTTP methods. This one will simply be added.PUT in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> DELETE()
IRouteBuilderDELETE as a supported HTTP method.
If you started the creation of the route from an
IRouter object, you already specified some
supported HTTP methods. This one will simply be added.DELETE in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> OPTIONS()
IRouteBuilderOPTIONS as a supported HTTP method.
If you started the creation of the route from an
IRouter object, you already specified some
supported HTTP methods. This one will simply be added.OPTIONS in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> TRACE()
IRouteBuilderTRACE as a supported HTTP method.
If you started the creation of the route from an
IRouter object, you already specified some
supported HTTP methods. This one will simply be added.TRACE in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> HEAD()
IRouteBuilderHEAD as a supported HTTP method.
If you started the creation of the route from an
IRouter object, you already specified some
supported HTTP methods. This one will simply be added.HEAD in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> PATCH()
IRouteBuilderPATCH as a supported HTTP method.
If you started the creation of the route from an
IRouter object, you already specified some
supported HTTP methods. This one will simply be added.PATCH in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> ALL()
IRouteBuilderIRouter object, you already specified some
supported HTTP methods. By calling this method, all
methods will now be suported.ALL in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> SOME(Set<HttpMethod> httpMethods)
IRouteBuilderIRouter object, you already specified some
supported HTTP methods. Those new ones will simply be added.SOME in interface IRouteBuilder<R extends IRequestContext<?>>public IRouteBuilder<R> SOME(HttpMethod... httpMethods)
IRouteBuilderIRouter object, you already specified some
supported HTTP methods. Those new ones will simply be added.SOME in interface IRouteBuilder<R extends IRequestContext<?>>public void save(IHandler<R> mainHandler)
IRouteBuilderIRouter object, an exception will be
thrown.save in interface IRouteBuilder<R extends IRequestContext<?>>public IRoute<R> create(IHandler<R> mainHandler)
IRouteBuildersave(...) instead to save the route
to the router at the end of the build process!create in interface IRouteBuilder<R extends IRequestContext<?>>Copyright © 2016. All rights reserved.