Package net.avcompris.commons3.web
Class AbstractController
java.lang.Object
net.avcompris.commons3.web.AbstractController
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
protected static interface
protected static interface
protected static interface
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractController
(net.avcompris.commons3.core.CorrelationService correlationService, net.avcompris.commons3.client.SessionPropagator sessionPropagator, net.avcompris.commons3.utils.Clock clock) -
Method Summary
Modifier and TypeMethodDescriptionprotected final String
getUserSessionId
(javax.servlet.http.HttpServletRequest request) protected final <T extends org.springframework.http.ResponseEntity<?>>
ThandleServiceException
(net.avcompris.commons3.api.exception.ServiceException e) protected static org.springframework.http.HttpHeaders
protected abstract boolean
protected abstract boolean
isSecure()
protected final void
setUserSessionCookie
(javax.servlet.http.HttpServletResponse response, String userSessionId) protected final <T> org.springframework.http.ResponseEntity<T>
wrapAuthenticated
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.avcompris.commons3.core.AuthService authService, AbstractController.AuthenticatedAction<T> action) protected final <T> org.springframework.http.ResponseEntity<T>
wrapAuthenticatedOrNot
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.avcompris.commons3.core.AuthService authService, AbstractController.AuthenticatedAction<T> action) protected final <T> org.springframework.http.ResponseEntity<T>
wrapAuthenticatedServletAction
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.avcompris.commons3.core.AuthService authService, AbstractController.AuthenticatedServletAction<T> action) protected final <T> org.springframework.http.ResponseEntity<T>
wrapNonAuthenticated
(javax.servlet.http.HttpServletRequest request, AbstractController.UnauthenticatedAction<T> action) protected final <T> org.springframework.http.ResponseEntity<T>
wrapNonAuthenticatedWithoutCorrelationId
(javax.servlet.http.HttpServletRequest request, AbstractController.UnauthenticatedAnonymousAction<T> action) protected final <T> org.springframework.http.ResponseEntity<T>
wrapWithoutCorrelationId
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.avcompris.commons3.core.AuthService authService, AbstractController.AuthenticatedAction<T> action)
-
Field Details
-
CORRELATION_ID_ATTRIBUTE_NAME
- See Also:
-
USER_SESSION_ID_ATTRIBUTE_NAME
- See Also:
-
correlationService
protected final net.avcompris.commons3.core.CorrelationService correlationService -
clock
protected final net.avcompris.commons3.utils.Clock clock
-
-
Constructor Details
-
AbstractController
protected AbstractController(net.avcompris.commons3.core.CorrelationService correlationService, net.avcompris.commons3.client.SessionPropagator sessionPropagator, net.avcompris.commons3.utils.Clock clock)
-
-
Method Details
-
getUserSessionId
-
wrapAuthenticated
protected final <T> org.springframework.http.ResponseEntity<T> wrapAuthenticated(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.avcompris.commons3.core.AuthService authService, AbstractController.AuthenticatedAction<T> action) throws net.avcompris.commons3.api.exception.ServiceException - Throws:
net.avcompris.commons3.api.exception.ServiceException
-
wrapAuthenticatedServletAction
protected final <T> org.springframework.http.ResponseEntity<T> wrapAuthenticatedServletAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.avcompris.commons3.core.AuthService authService, AbstractController.AuthenticatedServletAction<T> action) throws net.avcompris.commons3.api.exception.ServiceException, IOException, javax.servlet.ServletException - Throws:
net.avcompris.commons3.api.exception.ServiceException
IOException
javax.servlet.ServletException
-
wrapAuthenticatedOrNot
protected final <T> org.springframework.http.ResponseEntity<T> wrapAuthenticatedOrNot(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.avcompris.commons3.core.AuthService authService, AbstractController.AuthenticatedAction<T> action) throws net.avcompris.commons3.api.exception.ServiceException - Throws:
net.avcompris.commons3.api.exception.ServiceException
-
wrapWithoutCorrelationId
protected final <T> org.springframework.http.ResponseEntity<T> wrapWithoutCorrelationId(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, net.avcompris.commons3.core.AuthService authService, AbstractController.AuthenticatedAction<T> action) throws net.avcompris.commons3.api.exception.ServiceException - Throws:
net.avcompris.commons3.api.exception.ServiceException
-
wrapNonAuthenticated
protected final <T> org.springframework.http.ResponseEntity<T> wrapNonAuthenticated(javax.servlet.http.HttpServletRequest request, AbstractController.UnauthenticatedAction<T> action) throws net.avcompris.commons3.api.exception.ServiceException - Throws:
net.avcompris.commons3.api.exception.ServiceException
-
wrapNonAuthenticatedWithoutCorrelationId
protected final <T> org.springframework.http.ResponseEntity<T> wrapNonAuthenticatedWithoutCorrelationId(javax.servlet.http.HttpServletRequest request, AbstractController.UnauthenticatedAnonymousAction<T> action) throws net.avcompris.commons3.api.exception.ServiceException - Throws:
net.avcompris.commons3.api.exception.ServiceException
-
handleServiceException
protected final <T extends org.springframework.http.ResponseEntity<?>> T handleServiceException(net.avcompris.commons3.api.exception.ServiceException e) -
headers
-
isSecure
protected abstract boolean isSecure() -
isHttpOnly
protected abstract boolean isHttpOnly() -
setUserSessionCookie
protected final void setUserSessionCookie(javax.servlet.http.HttpServletResponse response, String userSessionId)
-