Package ej.hoka.http
Class Route
- java.lang.Object
-
- ej.hoka.http.Route
-
public class Route extends java.lang.ObjectRepresent an HTTP route.
-
-
Constructor Summary
Constructors Constructor Description Route(int httpMethod, java.lang.String path, RequestHandler handler)Constructs a new instance of Route.Route(int httpMethod, java.lang.String path, java.lang.String acceptType, RequestHandler handler)Constructs a new instance of Route.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptAllContentTypes()Checks if this route accepts all content types.booleanequals(java.lang.Object obj)java.lang.StringgetAcceptType()Gets the acceptType.RequestHandlergetHandler()Gets the request handler associated with this route.intgetHttpMethod()Gets the integer value associated with the HTTP method of the route.java.lang.StringgetHttpMethodAsString()Returns the HTTP method of this route as a String.java.lang.StringgetPath()Gets the path (URI) mapped in this route.inthashCode()
-
-
-
Constructor Detail
-
Route
public Route(int httpMethod, java.lang.String path, RequestHandler handler)Constructs a new instance of Route.- Parameters:
httpMethod- HTTP methodHttpRequest.GETHttpRequest.POSTHttpRequest.DELETEHttpRequest.PUTpath- request pathhandler- request handler
-
Route
public Route(int httpMethod, java.lang.String path, @Nullable java.lang.String acceptType, RequestHandler handler)Constructs a new instance of Route.- Parameters:
httpMethod- HTTP methodHttpRequest.GETHttpRequest.POSTHttpRequest.DELETEHttpRequest.PUTpath- request pathacceptType- accepted content typehandler- request handler
-
-
Method Detail
-
getPath
public java.lang.String getPath()
Gets the path (URI) mapped in this route.- Returns:
- the path (URI) mapped in this route.
-
getHttpMethod
public int getHttpMethod()
Gets the integer value associated with the HTTP method of the route.- Returns:
- http method. The mapping between the method number and the name can be found in
HttpRequest.GETHttpRequest.POSTHttpRequest.PUTHttpRequest.DELETEgetHttpMethodAsString()can be used to get the string representation of the http method.
-
getAcceptType
@Nullable public java.lang.String getAcceptType()
Gets the acceptType.- Returns:
- the acceptType.
-
getHandler
public RequestHandler getHandler()
Gets the request handler associated with this route.- Returns:
- the request handler associated with this route.
-
acceptAllContentTypes
public boolean acceptAllContentTypes()
Checks if this route accepts all content types.- Returns:
- true if this route accepts all content types.
-
getHttpMethodAsString
public java.lang.String getHttpMethodAsString()
Returns the HTTP method of this route as a String.- Returns:
- http method as string
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
-