Package spark
Class RouteImpl
java.lang.Object
spark.RouteImpl
- Direct Known Subclasses:
ResponseTransformerRouteImpl
,TemplateViewRouteImpl
RouteImpl is created from a path, acceptType and Route. This is encapsulate the information needed in the route
matcher in a single container.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RouteImpl
Wraps the route in RouteImplstatic RouteImpl
Wraps the route in RouteImpldelegate()
getPath()
abstract Object
Invoked when a request is made on this route's corresponding path e.g.This method should render the given element into something that can be send through Response element.withPrefix
(String prefix) Prefix the path (used forService.path(java.lang.String, spark.RouteGroup)
)
-
Field Details
-
DEFAULT_ACCEPT_TYPE
- See Also:
-
path
-
acceptType
-
delegate
-
-
Constructor Details
-
RouteImpl
Constructor- Parameters:
path
- The route path which is used for matching. (e.g. /hello, users/:name)
-
RouteImpl
Constructor- Parameters:
path
- The route path which is used for matching. (e.g. /hello, users/:name)acceptType
- The accept type which is used for matching.
-
RouteImpl
Constructor- Parameters:
path
- The route path which is used for matching. (e.g. /hello, users/:name)acceptType
- The accept type which is used for matching.route
- The route used to create the route implementation
-
-
Method Details
-
withPrefix
Prefix the path (used forService.path(java.lang.String, spark.RouteGroup)
)- Parameters:
prefix
- the prefix- Returns:
- itself for easy chaining
-
create
Wraps the route in RouteImpl- Parameters:
path
- the pathroute
- the route- Returns:
- the wrapped route
-
create
Wraps the route in RouteImpl- Parameters:
path
- the pathacceptType
- the accept typeroute
- the route- Returns:
- the wrapped route
-
handle
Invoked when a request is made on this route's corresponding path e.g. '/hello' -
render
This method should render the given element into something that can be send through Response element. By default this method returns the result of calling toString method in given element, but can be overridden.- Parameters:
element
- to be rendered.- Returns:
- body content.
- Throws:
Exception
- when render fails
-
getAcceptType
- Returns:
- the accept type
-
getPath
- Returns:
- the path
-
delegate
-