public.javadoc.org.spincast.plugins.routing.WebsocketRouteBuilderDefault.html Maven / Gradle / Ivy
Show all versions of spincast-website Show documentation
WebsocketRouteBuilderDefault (org.spincast:spincast-framework 1.14.0 API)
org.spincast.plugins.routing
Class WebsocketRouteBuilderDefault<R extends RequestContext<?>,W extends WebsocketContext<?>>
- java.lang.Object
-
- org.spincast.plugins.routing.WebsocketRouteBuilderDefault<R,W>
-
- All Implemented Interfaces:
- WebsocketRouteBuilder<R,W>
public class WebsocketRouteBuilderDefault<R extends RequestContext<?>,W extends WebsocketContext<?>>
extends Object
implements WebsocketRouteBuilder<R,W>
-
-
Constructor Summary
Constructors
Constructor and Description
WebsocketRouteBuilderDefault(Router<R,W> router,
WebsocketRouteFactory<R,W> websocketRouteFactory)
WebsocketRouteBuilderDefault(WebsocketRouteFactory<R,W> websocketRouteFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
WebsocketRouteBuilder<R,W>
before(Handler<R> beforeFilter)
Adds a before filter.
WebsocketRoute<R,W>
create(WebsocketController<R,W> websocketController)
Creates and returns the WebSocket route without adding it to
the router.
Set<String>
getBeforeFilterIdsToSkip()
List<Handler<R>>
getBeforeFilters()
String
getId()
String
getPath()
protected Router<R,W>
getRouter()
WebsocketController<R,W>
getWebsocketController()
protected WebsocketRouteFactory<R,W>
getWebsocketRouteFactory()
void
handle(WebsocketController<R,W> websocketController)
Saves the WebSocket route on the router.
WebsocketRouteBuilder<R,W>
id(String id)
The WebSocket route id.
boolean
isSpicastCoreRouteOrPluginRoute()
WebsocketRouteBuilder<R,W>
path(String path)
The path that trigger the beginning of that
HTTP to WebSocket connection.
WebsocketRouteBuilder<R,W>
skip(String beforeFilterId)
Skip a "before" filter for this WebSocket route
("after" filters are never run).
WebsocketRouteBuilder<R,W>
spicastCoreRouteOrPluginRoute()
This sould only by called by *plugins*.
-
-
Constructor Detail
-
WebsocketRouteBuilderDefault
public WebsocketRouteBuilderDefault(WebsocketRouteFactory<R,W> websocketRouteFactory)
-
Method Detail
-
getWebsocketRouteFactory
protected WebsocketRouteFactory<R,W> getWebsocketRouteFactory()
-
getPath
public String getPath()
-
getId
public String getId()
-
isSpicastCoreRouteOrPluginRoute
public boolean isSpicastCoreRouteOrPluginRoute()
-
getWebsocketController
public WebsocketController<R,W> getWebsocketController()
-
path
public WebsocketRouteBuilder<R,W> path(String path)
Description copied from interface: WebsocketRouteBuilder
The path that trigger the beginning of that
HTTP to WebSocket connection.
- Specified by:
path
in interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
-
id
public WebsocketRouteBuilder<R,W> id(String id)
Description copied from interface: WebsocketRouteBuilder
The WebSocket route id.
- Specified by:
id
in interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
-
spicastCoreRouteOrPluginRoute
public WebsocketRouteBuilder<R,W> spicastCoreRouteOrPluginRoute()
Description copied from interface: WebsocketRouteBuilder
This sould only by called by *plugins*.
When this method is called, the resulting route won't
be remove by default when the
Router.removeAllRoutes()
method is used. The
Router.removeAllRoutes(boolean)
with true
will have to be called to actually remove it.
This is useful during development, when an hotreload mecanism
is used to reload the Router without
restarting the application, when the application routes changed.
By default only the routes for which the
#isSpicastCoreRouteOrPluginRoute()
method has been called would then be reloaded.
- Specified by:
spicastCoreRouteOrPluginRoute
in interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
-
before
public WebsocketRouteBuilder<R,W> before(Handler<R> beforeFilter)
Description copied from interface: WebsocketRouteBuilder
Adds a before filter. Those will be run before the
WebSocket connection handshake is started.
Note that there are no "after" filters because once a
WebSocket connection is established, the HTTP one
is no more.
- Specified by:
before
in interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
-
handle
public void handle(WebsocketController<R,W> websocketController)
Description copied from interface: WebsocketRouteBuilder
Saves the WebSocket route on the router.
- Specified by:
handle
in interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
-
create
public WebsocketRoute<R,W> create(WebsocketController<R,W> websocketController)
Description copied from interface: WebsocketRouteBuilder
Creates and returns the WebSocket route without adding it to
the router.
NOTE : use handle(...)
instead to save the route
to the router at the end of the build process!
- Specified by:
create
in interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
-
skip
public WebsocketRouteBuilder<R,W> skip(String beforeFilterId)
Description copied from interface: WebsocketRouteBuilder
Skip a "before" filter for this WebSocket route
("after" filters are never run).
This is useful when you set a global filter but want to skip
it one a specific route only.
- Specified by:
skip
in interface WebsocketRouteBuilder<R extends RequestContext<?>,W extends WebsocketContext<?>>
Copyright © 2019. All rights reserved.