Class VaadinServletRequest

java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
com.vaadin.flow.server.VaadinServletRequest
All Implemented Interfaces:
VaadinRequest, jakarta.servlet.http.HttpServletRequest, jakarta.servlet.ServletRequest

public class VaadinServletRequest extends jakarta.servlet.http.HttpServletRequestWrapper implements VaadinRequest
Wrapper for HttpServletRequest.
Since:
1.0.
Author:
Vaadin Ltd
See Also:
  • Field Summary

    Fields inherited from interface jakarta.servlet.http.HttpServletRequest

    BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
  • Constructor Summary

    Constructors
    Constructor
    Description
    VaadinServletRequest(jakarta.servlet.http.HttpServletRequest request, VaadinServletService vaadinService)
    Wraps a http servlet request and associates with a vaadin service.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the currently processed Vaadin servlet request.
    jakarta.servlet.http.HttpServletRequest
    Gets the original, unwrapped HTTP servlet request.
    Gets the vaadin service for the context of this request.
    Gets the session associated with this request, creating a new if there is no session.
    getWrappedSession(boolean allowSessionCreation)
    Gets the session associated with this request, optionally creating a new if there is no session.

    Methods inherited from class jakarta.servlet.http.HttpServletRequestWrapper

    authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade

    Methods inherited from class jakarta.servlet.ServletRequestWrapper

    getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jakarta.servlet.ServletRequest

    getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
  • Constructor Details

    • VaadinServletRequest

      public VaadinServletRequest(jakarta.servlet.http.HttpServletRequest request, VaadinServletService vaadinService)
      Wraps a http servlet request and associates with a vaadin service.
      Parameters:
      request - the http servlet request to wrap
      vaadinService - the associated vaadin service
  • Method Details

    • getWrappedSession

      public WrappedSession getWrappedSession()
      Description copied from interface: VaadinRequest
      Gets the session associated with this request, creating a new if there is no session.
      Specified by:
      getWrappedSession in interface VaadinRequest
      Returns:
      the wrapped session for this request
      See Also:
    • getWrappedSession

      public WrappedSession getWrappedSession(boolean allowSessionCreation)
      Description copied from interface: VaadinRequest
      Gets the session associated with this request, optionally creating a new if there is no session.
      Specified by:
      getWrappedSession in interface VaadinRequest
      Parameters:
      allowSessionCreation - true to create a new session for this request if necessary; false to return null if there's no current session
      Returns:
      the wrapped session for this request
      See Also:
    • getHttpServletRequest

      public jakarta.servlet.http.HttpServletRequest getHttpServletRequest()
      Gets the original, unwrapped HTTP servlet request.
      Returns:
      the servlet request
    • getService

      public VaadinServletService getService()
      Description copied from interface: VaadinRequest
      Gets the vaadin service for the context of this request.
      Specified by:
      getService in interface VaadinRequest
      Returns:
      the vaadin service
      See Also:
    • getCurrent

      public static VaadinServletRequest getCurrent()
      Gets the currently processed Vaadin servlet request. The current request is automatically defined when the request is started. The current request can not be used in e.g. background threads because of the way server implementations reuse request instances.
      Returns:
      the current Vaadin servlet request instance if available, otherwise null