Class AbstractController

java.lang.Object
net.avcompris.commons3.web.AbstractController

public abstract class AbstractController extends Object
  • Field Details

    • CORRELATION_ID_ATTRIBUTE_NAME

      public static final String CORRELATION_ID_ATTRIBUTE_NAME
      See Also:
    • USER_SESSION_ID_ATTRIBUTE_NAME

      public static final String 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

      @Nullable protected final String getUserSessionId(javax.servlet.http.HttpServletRequest request)
    • 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

      protected static org.springframework.http.HttpHeaders headers(String... headerNameValuePairs)
    • isSecure

      protected abstract boolean isSecure()
    • isHttpOnly

      protected abstract boolean isHttpOnly()
    • setUserSessionCookie

      protected final void setUserSessionCookie(javax.servlet.http.HttpServletResponse response, String userSessionId)