public abstract class RouteImpl extends Object implements Route, Wrapper
Modifier | Constructor and Description |
---|---|
protected |
RouteImpl(String path)
Constructor
|
protected |
RouteImpl(String path,
String acceptType)
Constructor
|
protected |
RouteImpl(String path,
String acceptType,
Object route)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static RouteImpl |
create(String path,
Route route)
Wraps the route in RouteImpl
|
static RouteImpl |
create(String path,
String acceptType,
Route route)
Wraps the route in RouteImpl
|
Object |
delegate() |
String |
getAcceptType() |
String |
getPath() |
abstract Object |
handle(Request request,
Response response)
Invoked when a request is made on this route's corresponding path e.g.
|
Object |
render(Object element)
This method should render the given element into something that can be send through Response element.
|
RouteImpl |
withPrefix(String prefix)
Prefix the path (used for
Service.path(java.lang.String, spark.RouteGroup) ) |
protected RouteImpl(String path)
path
- The route path which is used for matching. (e.g. /hello, users/:name)protected RouteImpl(String path, String acceptType)
path
- The route path which is used for matching. (e.g. /hello, users/:name)acceptType
- The accept type which is used for matching.public RouteImpl withPrefix(String prefix)
Service.path(java.lang.String, spark.RouteGroup)
)prefix
- the prefixpublic static RouteImpl create(String path, Route route)
path
- the pathroute
- the routepublic static RouteImpl create(String path, String acceptType, Route route)
path
- the pathacceptType
- the accept typeroute
- the routepublic abstract Object handle(Request request, Response response) throws Exception
public Object render(Object element) throws Exception
element
- to be rendered.Exception
- when render failspublic String getAcceptType()
public String getPath()
Copyright © 2018. All rights reserved.