Package io.github.jirkasa.servletrouter
Class BaseURLAttributeSetter
java.lang.Object
io.github.jirkasa.servletrouter.Middleware<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
io.github.jirkasa.servletrouter.HttpMiddleware
io.github.jirkasa.servletrouter.BaseURLAttributeSetter
- All Implemented Interfaces:
Handler<javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse>
Middleware that sets base URL attribute to request. By default it is named "BASE_URL", but that can be changed by passing name to constructor.
-
Constructor Summary
ConstructorDescriptionCreates new middleware that sets "BASE_URL" attribute to request.BaseURLAttributeSetter
(String baseURLAttributeName) Creates new middleware that sets base URL attribute to request. -
Method Summary
Modifier and TypeMethodDescriptionboolean
handle
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Handles request.Methods inherited from class io.github.jirkasa.servletrouter.Middleware
getPathParam, matchesFullPath, setPathParams
-
Constructor Details
-
BaseURLAttributeSetter
public BaseURLAttributeSetter()Creates new middleware that sets "BASE_URL" attribute to request. -
BaseURLAttributeSetter
Creates new middleware that sets base URL attribute to request.- Parameters:
baseURLAttributeName
- Name of attribute.
-
-
Method Details
-
handle
public boolean handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception Description copied from interface:Handler
Handles request.- Parameters:
request
- Request to be handled.response
- Response to be handled.- Returns:
- Determines whether handlers chain should continue or not.
- Throws:
Exception
-