public class VaadinServlet extends javax.servlet.http.HttpServlet implements Constants
Modifier and Type | Class and Description |
---|---|
protected static class |
VaadinServlet.RequestType
Deprecated.
As of 7.0. This is no longer used and only provided for
backwards compatibility. Each
RequestHandler can
individually decide whether it wants to handle a request or
not. |
ATMOSPHERE_MISSING_ERROR, CANNOT_ACQUIRE_CLASSLOADER_SEVERE, DEFAULT_BUFFER_SIZE, DEFAULT_THEME_CACHETIME, DEFAULT_THEME_NAME, DEFAULT_WIDGETSET, ERROR_NO_UI_FOUND, INVALID_ATMOSPHERE_VERSION_WARNING, INVALID_SECURITY_KEY_MSG, MAX_BUFFER_SIZE, NOT_PRODUCTION_MODE_INFO, PARAMETER_VAADIN_RESOURCES, PARAMETER_WIDGETSET, PORTAL_PARAMETER_VAADIN_RESOURCE_PATH, PORTAL_PARAMETER_VAADIN_THEME, PORTAL_PARAMETER_VAADIN_WIDGETSET, PORTLET_CONTEXT, PUSH_NOT_SUPPORTED_ERROR, REQUIRED_ATMOSPHERE_RUNTIME_VERSION, SERVLET_PARAMETER_CLOSE_IDLE_SESSIONS, SERVLET_PARAMETER_DISABLE_XSRF_PROTECTION, SERVLET_PARAMETER_HEARTBEAT_INTERVAL, SERVLET_PARAMETER_LEGACY_DESIGN_PREFIX, SERVLET_PARAMETER_LEGACY_PROPERTY_TOSTRING, SERVLET_PARAMETER_PRODUCTION_MODE, SERVLET_PARAMETER_PUSH_MODE, SERVLET_PARAMETER_PUSH_SUSPEND_TIMEOUT_LONGPOLLING, SERVLET_PARAMETER_RESOURCE_CACHE_TIME, SERVLET_PARAMETER_SENDURLSASPARAMETERS, SERVLET_PARAMETER_SYNC_ID_CHECK, SERVLET_PARAMETER_UI_PROVIDER, THEME_DIR_PATH, URL_PARAMETER_THEME, WARNING_HEARTBEAT_INTERVAL_NOT_NUMERIC, WARNING_LEGACY_PROPERTY_TOSTRING, WARNING_PUSH_MODE_NOT_RECOGNIZED, WARNING_RESOURCE_CACHING_TIME_NOT_NUMERIC, WARNING_UNKNOWN_LEGACY_PROPERTY_TOSTRING_VALUE, WARNING_XSRF_PROTECTION_DISABLED, WIDGETSET_DIR_PATH, WIDGETSET_MISMATCH_INFO
Constructor and Description |
---|
VaadinServlet() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
allowServePrecompressedResource(javax.servlet.http.HttpServletRequest request,
String url)
Returns whether this servlet should attempt to serve a precompressed
version of the given static resource.
|
protected DeploymentConfiguration |
createDeploymentConfiguration(Properties initParameters) |
protected VaadinServletService |
createServletService(DeploymentConfiguration deploymentConfiguration) |
protected VaadinServletRequest |
createVaadinRequest(javax.servlet.http.HttpServletRequest request)
Create a Vaadin request for a http servlet request.
|
protected void |
criticalNotification(VaadinServletRequest request,
VaadinServletResponse response,
String caption,
String message,
String details,
String url)
Deprecated.
As of 7.0. This method is retained only for backwards
compatibility and for
GAEVaadinServlet . |
void |
destroy() |
protected URL |
findResourceURL(String filename)
Finds the given resource from the web content folder or using the class
loader.
|
protected URL |
getApplicationUrl(javax.servlet.http.HttpServletRequest request)
Deprecated.
As of 7.0. Will likely change or be removed in a future
version
|
protected int |
getCacheTime(String filename)
Calculates the cache lifetime for the given filename in seconds.
|
static VaadinServlet |
getCurrent()
Gets the currently used Vaadin servlet.
|
static String |
getDefaultTheme()
Returns the default theme.
|
protected static String |
getLastPathParameter(String uri)
Finds any path parameter added to the last part of the uri.
|
protected VaadinServlet.RequestType |
getRequestType(VaadinServletRequest request)
Deprecated.
As of 7.0. This is no longer used and only provided for
backwards compatibility. Each
RequestHandler can
individually decide whether it wants to handle a request or
not. |
protected static String |
getResourcePath(javax.servlet.ServletContext servletContext,
String path)
Deprecated.
As of 7.0. Will likely change or be removed in a future
version
|
protected VaadinServletService |
getService()
Gets a the vaadin service for this servlet.
|
protected boolean |
handleContextRootWithoutSlash(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Invoked for every request to this servlet to potentially send a redirect
to avoid problems with requests to the context root with no trailing
slash.
|
void |
init(javax.servlet.ServletConfig servletConfig)
Called by the servlet container to indicate to a servlet that the servlet
is being placed into service.
|
protected boolean |
isAllowedVAADINResourceUrl(javax.servlet.http.HttpServletRequest request,
URL resourceUrl)
Deprecated.
As of 7.0. Will likely change or be removed in a future
version
|
protected boolean |
isStaticResourceRequest(javax.servlet.http.HttpServletRequest request) |
static String |
safeEscapeForHtml(String unsafe)
Deprecated.
As of 7.0. Will likely change or be removed in a future
version
|
protected boolean |
serveStaticResources(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Check if this is a request for a static resource and, if it is, serve the
resource to the client.
|
protected void |
serveStaticResourcesInVAADIN(String filename,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Serve resources from VAADIN directory.
|
protected void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Receives standard HTTP requests from the public service method and
dispatches them.
|
protected void |
servletInitialized() |
static String |
stripSpecialChars(String themeName)
Deprecated.
As of 7.0. Will likely change or be removed in a future
version
|
protected void |
writeStaticResourceResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
URL resourceUrl)
Writes the contents of the given resourceUrl in the response.
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
servletConfig
- the object containing the servlet's configuration and
initialization parametersjavax.servlet.ServletException
- if an exception has occurred that interferes with the
servlet's normal operation.protected void servletInitialized() throws javax.servlet.ServletException
javax.servlet.ServletException
public static VaadinServlet getCurrent()
InheritableThreadLocal
). In other cases,
(e.g. from background threads started in some other way), the current
servlet is not automatically defined.
The current servlet is derived from the current service using
VaadinService.getCurrent()
null
protected DeploymentConfiguration createDeploymentConfiguration(Properties initParameters)
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException
ServiceException
protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
service
in class javax.servlet.http.HttpServlet
request
- the object that contains the request the client made of the
servlet.response
- the object that contains the response the servlet returns to
the client.javax.servlet.ServletException
- if an input or output error occurs while the servlet is
handling the TRACE request.IOException
- if the request for the TRACE cannot be handled.protected boolean handleContextRootWithoutSlash(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
request
- the processed requestresponse
- the processed responsetrue
if a redirect has been sent and the request
should not be processed further; false
if the
request should be processed as usualIOException
- If an input or output exception occursprotected static String getLastPathParameter(String uri)
For example the uri http://myhost.com/foo;a=1/bar;b=1 contains two path parameters, a=1 related to /foo and b=1 related to /bar.
For http://myhost.com/foo;a=1/bar;b=1 this method will return ;b=1
uri
- a URIprotected VaadinServletRequest createVaadinRequest(javax.servlet.http.HttpServletRequest request)
request
- the original http servlet requestprotected VaadinServletService getService()
@Deprecated protected void criticalNotification(VaadinServletRequest request, VaadinServletResponse response, String caption, String message, String details, String url) throws IOException
GAEVaadinServlet
.request
- the HTTP request instance.response
- the HTTP response to write to.caption
- the notification captionmessage
- to notification bodydetails
- a detail message to show in addition to the message. Currently
shown directly below the message but could be hidden behind a
details drop down in the future. Mainly used to give
additional information not necessarily useful to the end user.url
- url to load when the message is dismissed. Null will reload
the current page.IOException
- if the writing failed due to input/output error.@Deprecated protected static String getResourcePath(javax.servlet.ServletContext servletContext, String path)
servletContext
- path
- the resource path.@Deprecated public static String stripSpecialChars(String themeName)
themeName
- public static String getDefaultTheme()
protected boolean serveStaticResources(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
request
- response
- IOException
javax.servlet.ServletException
protected void serveStaticResourcesInVAADIN(String filename, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
filename
- The filename to serve. Should always start with /VAADIN/.request
- response
- IOException
javax.servlet.ServletException
protected int getCacheTime(String filename)
filename
- protected void writeStaticResourceResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, URL resourceUrl) throws IOException
request
- The request for the resourceresponse
- The responseresourceUrl
- The url to sendIOException
protected boolean allowServePrecompressedResource(javax.servlet.http.HttpServletRequest request, String url)
.gz
is appended to the URL and the corresponding resource
is served if it exists. It is assumed that the compression method used is
gzip. If this method returns false or a compressed version is not found,
the original URL is used.
The base implementation of this method returns true if and only if the
request indicates that the client accepts gzip compressed responses and
the filename extension of the requested resource is .js, .css, or .html.request
- the request for the resourceurl
- the URL of the requested resourceprotected URL findResourceURL(String filename) throws IOException
filename
- The file to find, starting with a "/"IOException
- if there was a problem while locating the file@Deprecated protected boolean isAllowedVAADINResourceUrl(javax.servlet.http.HttpServletRequest request, URL resourceUrl)
request
- resourceUrl
- @Deprecated protected VaadinServlet.RequestType getRequestType(VaadinServletRequest request)
RequestHandler
can
individually decide whether it wants to handle a request or
not.request
- protected boolean isStaticResourceRequest(javax.servlet.http.HttpServletRequest request)
@Deprecated protected URL getApplicationUrl(javax.servlet.http.HttpServletRequest request) throws MalformedURLException
request
- the HTTP request.MalformedURLException
- if the application is denied access to the persistent data
store represented by the given URL.public void destroy()
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
@Deprecated public static final String safeEscapeForHtml(String unsafe)
unsafe
- Copyright © 2019 Vaadin Ltd. All rights reserved.