public class HandlerHelper extends Object implements Serializable
VaadinServlet and generally for handling
VaadinRequests.| Modifier and Type | Class and Description |
|---|---|
static class |
HandlerHelper.RequestType
Framework internal enum for tracking the type of a request.
|
| Modifier and Type | Method and Description |
|---|---|
static Locale |
findLocale(VaadinSession session,
VaadinRequest request)
Helper to find the most most suitable Locale.
|
static String |
getCancelingRelativePath(String pathToCancel)
Gets a relative path that cancels the provided path.
|
static boolean |
isPathUnsafe(String path)
Checks if the given URL path contains the directory change instruction
(dot-dot), taking into account possible double encoding in hexadecimal
format, which can be injected maliciously.
|
static boolean |
isRequestType(VaadinRequest request,
HandlerHelper.RequestType requestType)
Returns whether the given request is of the given type.
|
static void |
setResponseNoCacheHeaders(BiConsumer<String,String> headerSetter,
BiConsumer<String,Long> longHeaderSetter)
Sets no cache headers to the specified response.
|
public static boolean isRequestType(VaadinRequest request, HandlerHelper.RequestType requestType)
request - the request to checkrequestType - the type to check fortrue if the request is of the given type,
false otherwisepublic static Locale findLocale(VaadinSession session, VaadinRequest request)
UI.getCurrent() if definedVaadinSession.getCurrent() if definedVaadinService.getCurrentRequest() if definedLocale.getDefault()session - the session that is searched for locale or null
if not availablerequest - the request that is searched for locale or null
if not availablepublic static void setResponseNoCacheHeaders(BiConsumer<String,String> headerSetter, BiConsumer<String,Long> longHeaderSetter)
headerSetter - setter for string value headerslongHeaderSetter - setter for long value headerspublic static String getCancelingRelativePath(String pathToCancel)
pathToCancel - the path that should be canceledpublic static boolean isPathUnsafe(String path)
path - the URL path to be verified.true, if the given path has a directory change
instruction, false otherwise.Copyright © 2025. All rights reserved.