Package com.vaadin.browserless.mocks
Class MockServletConfig
java.lang.Object
com.vaadin.browserless.mocks.MockServletConfig
- All Implemented Interfaces:
jakarta.servlet.ServletConfig
The
ServletConfig the mocked servlet is initialized with.
It carries the per-servlet init parameters and the ServletContext,
which is the whole of what a Vaadin servlet reads from its config. The
servlet name is fixed at "Vaadin Servlet".
Init parameters are read while the servlet initializes, so they have to be in
getServletInitParams() before Servlet.init(ServletConfig) is
called; setting one afterwards has no effect.
For internal use only. May be renamed or removed in a future release.
-
Constructor Summary
ConstructorsConstructorDescriptionMockServletConfig(jakarta.servlet.ServletContext context) Creates a config for a servlet in the given context, with no init parameters. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.servlet.ServletContextReturns the context the configured servlet belongs to.getInitParameter(String name) jakarta.servlet.ServletContextReturns the per-servlet init parameters, live and directly modifiable.voidsetServletInitParams(Map<String, String> servletInitParams) Replaces the per-servlet init parameters.
-
Constructor Details
-
MockServletConfig
public MockServletConfig(jakarta.servlet.ServletContext context) Creates a config for a servlet in the given context, with no init parameters.- Parameters:
context- the context the servlet belongs to
-
-
Method Details
-
getContext
public jakarta.servlet.ServletContext getContext()Returns the context the configured servlet belongs to. Same value asgetServletContext().- Returns:
- the servlet context
-
getServletInitParams
Returns the per-servlet init parameters, live and directly modifiable. Populate before the servlet is initialized.- Returns:
- the init parameters
-
setServletInitParams
Replaces the per-servlet init parameters.- Parameters:
servletInitParams- the init parameters
-
getInitParameter
- Specified by:
getInitParameterin interfacejakarta.servlet.ServletConfig
-
getInitParameterNames
- Specified by:
getInitParameterNamesin interfacejakarta.servlet.ServletConfig
-
getServletName
- Specified by:
getServletNamein interfacejakarta.servlet.ServletConfig
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()- Specified by:
getServletContextin interfacejakarta.servlet.ServletConfig
-