Class HttpPathVariableController
java.lang.Object
com.chillycheesy.modulo.controllers.HttpPathVariableController
- All Implemented Interfaces:
Controller
Controller that check if the pathVariable match with the target path.
If the path match then return the next controller result.
The path variable include some expression.
-
{<key>}
: The path variable. The key is the name of the path variable. If the path match with the request path, the apply method register the key inside a "path-variable" section with the equivalent value inside the configuration.
Exemple:/{value}
match with/test
and register the keypath-variable.value
with the valuetest
. -
*
: match any path but don't register it inside the configuration.
Exemple:/my/*
match with/my/test
. -
/**
: match any additional path but don't register it inside the configuration. it should be place at the end of the path
Exemple:/my/**
match with/my/test
and/my/test/test2
and/my/test/test2/test3
. Register the additional path inside the configuration at the key "additional-path".
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Configuration configuration)
Apply the controller.void
setNextStep(Controller controller)
Set the next controller.
-
Field Details
-
PATH_VARIABLE_SECTION
- See Also:
- Constant Field Values
-
-
Constructor Details
-
HttpPathVariableController
Constructor.- Parameters:
pathVariable
- The target path.- Throws:
InvalidPathVariableException
-
-
Method Details
-
apply
public Object apply(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Configuration configuration) throws ExceptionApply the controller. If the path match with the target pathVariable then Register all find variable inside the configuration and return the next controller result.- Specified by:
apply
in interfaceController
- Parameters:
request
- the http request.response
- the http response.configuration
- the configuration.- Returns:
- The response.
- Throws:
Exception
-
setNextStep
Set the next controller.- Specified by:
setNextStep
in interfaceController
- Parameters:
controller
- the next controller.
-