You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.flow.server.

Class VaadinServletService

    • Constructor Detail

      • VaadinServletService

        public VaadinServletService​(VaadinServlet servlet,
                                    DeploymentConfiguration deploymentConfiguration)

        Creates an instance connected to the given servlet and using the given configuration.

        Parameters:

        servlet - the servlet which receives requests

        deploymentConfiguration - the configuration to use

      • VaadinServletService

        protected VaadinServletService()

        Creates a servlet service. This method is for use by dependency injection frameworks etc. getServlet() and VaadinService.getContext() should be overridden (or otherwise intercepted) to not return null.

    • Method Detail

      • createRequestHandlers

        protected List<RequestHandler> createRequestHandlers()
                                                      throws ServiceException

        Description copied from class: VaadinService

        Called during initialization to add the request handlers for the service. Note that the returned list will be reversed so the last handler will be called first. This enables overriding this method and using add on the returned list to add a custom request handler which overrides any predefined handler.

        Overrides:

        createRequestHandlers in class VaadinService

        Returns:

        The list of request handlers used by this service.

        Throws:

        ServiceException - if a problem occurs when creating the request handlers

      • getServlet

        public VaadinServlet getServlet()

        Retrieves a reference to the servlet associated with this service. Should be overridden (or otherwise intercepted) if the no-arg constructor is used to prevent NPEs.

        Returns:

        A reference to the VaadinServlet this service is using

      • getMimeType

        public String getMimeType​(String resourceName)

        Description copied from class: VaadinService

        Returns the MIME type of the specified file, or null if the MIME type is not known. The MIME type is determined by the configuration of the container, and may be specified in a deployment descriptor. Common MIME types are "text/html" and "image/gif".

        Specified by:

        getMimeType in class VaadinService

        Parameters:

        resourceName - a String specifying the name of a file

        Returns:

        a String specifying the file's MIME type

        See Also:

        ServletContext.getMimeType(String)

      • requestCanCreateSession

        protected boolean requestCanCreateSession​(VaadinRequest request)

        Description copied from class: VaadinService

        Checks whether it's valid to create a new service session as a result of the given request.

        Specified by:

        requestCanCreateSession in class VaadinService

        Parameters:

        request - the request

        Returns:

        true if it's valid to create a new service session for the request; else false

      • getCurrentServletRequest

        public static javax.servlet.http.HttpServletRequest getCurrentServletRequest()
      • getServiceName

        public String getServiceName()

        Description copied from class: VaadinService

        Gets a unique name for this service. The name should be unique among different services of the same type but the same for corresponding instances running in different JVMs in a cluster. This is typically based on e.g. the configured servlet's name.

        Specified by:

        getServiceName in class VaadinService

        Returns:

        the unique name of this service instance.

      • getMainDivId

        public String getMainDivId​(VaadinSession session,
                                   VaadinRequest request)

        Description copied from class: VaadinService

        Creates and returns a unique ID for the DIV where the UI is to be rendered.

        Specified by:

        getMainDivId in class VaadinService

        Parameters:

        session - The service session to which the bootstrapped UI will belong.

        request - The request for which a div id is needed

        Returns:

        the id to use in the DOM

      • getStaticResource

        public URL getStaticResource​(String path)

        Description copied from class: VaadinService

        Returns a URL to the static resource at the given URI or null if no file found.

        Specified by:

        getStaticResource in class VaadinService

        Parameters:

        path - the URL for the resource

        Returns:

        the resource located at the named path, or null if there is no resource at that path

      • getResource

        public URL getResource​(String path)

        Description copied from class: VaadinService

        Returns a URL to the resource at the given Vaadin URI.

        Specified by:

        getResource in class VaadinService

        Parameters:

        path - the untranslated Vaadin URL for the resource

        Returns:

        the resource located at the named path, or null if there is no resource at that path

      • getResourceAsStream

        public InputStream getResourceAsStream​(String path)

        Description copied from class: VaadinService

        Opens a stream to to the resource at the given Vaadin URI.

        Specified by:

        getResourceAsStream in class VaadinService

        Parameters:

        path - the untranslated Vaadin URL for the resource

        Returns:

        a stream for the resource or null if no resource exists at the specified path

      • getResourceInServletContext

        public URL getResourceInServletContext​(String path)

        Finds the given resource in the servlet context.

        Parameters:

        path - the path inside servlet context

        Returns:

        a URL for the resource or null if no resource was found

      • getContextRootRelativePath

        public String getContextRootRelativePath​(VaadinRequest request)

        Description copied from class: VaadinService

        Returns relative context path for given request. Override this method in subclasses.

        Specified by:

        getContextRootRelativePath in class VaadinService

        Parameters:

        request - Request.

        Returns:

        Relative context root path for that request.

      • setDefaultClassLoader

        protected void setDefaultClassLoader()

        Description copied from class: VaadinService

        Tries to acquire default class loader and sets it as a class loader for this VaadinService if found. If current security policy disallows acquiring class loader instance it will log a message and re-throw SecurityException

        Overrides:

        setDefaultClassLoader in class VaadinService