Package io.mangoo.routing.routes
Class RequestRoute
- java.lang.Object
-
- io.mangoo.routing.routes.RequestRoute
-
- All Implemented Interfaces:
MangooRoute
public class RequestRoute extends Object implements MangooRoute
- Author:
- svenkubiak
-
-
Constructor Summary
Constructors Constructor Description RequestRoute(Http method)RequestRoute(Http... methods)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>getControllerClass()StringgetControllerMethod()intgetLimit()HttpgetMethod()Http[]getMethods()StringgetPassword()StringgetUrl()StringgetUsername()booleanhasAuthentication()booleanhasAuthorization()booleanhasBasicAuthentication()booleanhasMultipleMethods()booleanisBlocking()RequestRouterespondeWith(String method)Sets the controller method to response on requestRequestRouteto(String url)Sets the URL for this routeRequestRoutewithAuthentication()Sets authentication to true for this route, default is falseRequestRoutewithAuthorization()Sets authorization to true for this route, default is false Also sets authentication to true, default is falseRequestRoutewithBasicAuthentication(String username, String password)Sets HTTP Basic authentication to this request on the defined controller classvoidwithControllerClass(Class<?> clazz)Sets the controller class of this requestvoidwithHttpMethod(Http method)Sets the HTTP method of this requestRequestRoutewithNonBlocking()Configures this request as long running request that is executed in a different thread pool to not block the non blocking I/O requestRequestRoutewithRequestLimit(int requestsPerSecond)Sets a request limit to the request
-
-
-
Method Detail
-
to
public RequestRoute to(String url)
Sets the URL for this route- Parameters:
url- The URL for this route- Returns:
- RequestRoute instance
-
respondeWith
public RequestRoute respondeWith(String method)
Sets the controller method to response on request- Parameters:
method- The controller method- Returns:
- RequestRoute instance
-
withRequestLimit
public RequestRoute withRequestLimit(int requestsPerSecond)
Sets a request limit to the request- Parameters:
requestsPerSecond- Number of requests per second- Returns:
- RequestRoute instance
-
withControllerClass
public void withControllerClass(Class<?> clazz)
Sets the controller class of this request- Parameters:
clazz- The controller class
-
withHttpMethod
public void withHttpMethod(Http method)
Sets the HTTP method of this request- Parameters:
method- The controller method
-
withBasicAuthentication
public RequestRoute withBasicAuthentication(String username, String password)
Sets HTTP Basic authentication to this request on the defined controller class- Parameters:
username- The username for basic authentication in cleartextpassword- The password for basic authentication in cleartext- Returns:
- RequestRoute instance
-
withAuthentication
public RequestRoute withAuthentication()
Sets authentication to true for this route, default is false- Returns:
- RequestRoute instance
-
withAuthorization
public RequestRoute withAuthorization()
Sets authorization to true for this route, default is false Also sets authentication to true, default is false- Returns:
- RequestRoute instance
-
withNonBlocking
public RequestRoute withNonBlocking()
Configures this request as long running request that is executed in a different thread pool to not block the non blocking I/O request- Returns:
- RequestRoute instance
-
getUrl
public String getUrl()
- Specified by:
getUrlin interfaceMangooRoute- Returns:
- The configured URL for this route
-
hasAuthentication
public boolean hasAuthentication()
-
hasAuthorization
public boolean hasAuthorization()
-
hasBasicAuthentication
public boolean hasBasicAuthentication()
-
getUsername
public String getUsername()
-
getPassword
public String getPassword()
-
hasMultipleMethods
public boolean hasMultipleMethods()
-
getMethods
public Http[] getMethods()
-
getControllerClass
public Class<?> getControllerClass()
-
getControllerMethod
public String getControllerMethod()
-
getLimit
public int getLimit()
-
getMethod
public Http getMethod()
-
isBlocking
public boolean isBlocking()
-
-