Package com.vaadin.browserless.mocks
Class MockRequest
-
- All Implemented Interfaces:
-
jakarta.servlet.ServletRequest,jakarta.servlet.http.HttpServletRequest
public class MockRequest implements HttpServletRequest
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description MockRequest(HttpSession session)
-
Method Summary
-
Methods inherited from class com.vaadin.browserless.mocks.MockRequest
getAsyncContext, getAttributeNames, getAuthType, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getContextPath, getCookies, getDispatcherType, getHeaderNames, getInputStream, getLocalAddr, getLocalName, getLocalPort, getLocale, getLocales, getMethod, getParameterMap, getParameterNames, getParts, getPathInfo, getPathTranslated, getProtocol, getProtocolRequestId, getQueryString, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRemoteUser, getRequestId, getRequestURI, getRequestURL, getRequestedSessionId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, getServletPath, getSession, getUserPrincipal, isAsyncStarted, isAsyncSupported, isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isSecure -
Methods inherited from class jakarta.servlet.http.HttpServletRequest
getHttpServletMapping, getTrailerFields, isTrailerFieldsReady, newPushBuilder -
Methods inherited from class jakarta.servlet.ServletRequest
setCharacterEncoding -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getCharacterEncodingInt
final String getCharacterEncodingInt()
-
setCharacterEncodingInt
final Unit setCharacterEncodingInt(String value)
-
getParameters
final Map<String, Array<String>> getParameters()
-
getPartsInt
final List<Part> getPartsInt()
-
setPartsInt
final Unit setPartsInt(List<Part> value)
-
isUserInRole
final Function2<Principal, String, Boolean> isUserInRole()
-
setUserInRole
final Unit setUserInRole(Function2<Principal, String, Boolean> value)
-
getCookiesInt
final Array<Cookie> getCookiesInt()
-
setCookiesInt
final Unit setCookiesInt(Array<Cookie> value)
-
getLocaleInt
final Locale getLocaleInt()
-
setLocaleInt
final Unit setLocaleInt(Locale value)
-
getUserPrincipalInt
final Principal getUserPrincipalInt()
-
setUserPrincipalInt
final Unit setUserPrincipalInt(Principal value)
-
getUserPrincipalProvider
final Function0<Principal> getUserPrincipalProvider()
-
getHeaders
final ConcurrentHashMap<String, List<String>> getHeaders()
-
getInputStream
ServletInputStream getInputStream()
-
startAsync
AsyncContext startAsync()
-
startAsync
AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse)
-
getProtocol
String getProtocol()
-
getRequestURL
StringBuffer getRequestURL()
-
setCharacterEncoding
Unit setCharacterEncoding(String env)
-
getParameterValues
Array<String> getParameterValues(String name)
-
isAsyncStarted
Boolean isAsyncStarted()
-
getContentLengthLong
Long getContentLengthLong()
-
isRequestedSessionIdValid
Boolean isRequestedSessionIdValid()
-
getServerPort
Integer getServerPort()
Returns MockHttpEnvironment.serverPort.
-
getRequestedSessionId
String getRequestedSessionId()
-
getServletPath
String getServletPath()
-
getSession
HttpSession getSession(Boolean create)
-
getSession
HttpSession getSession()
-
getServerName
String getServerName()
-
getLocalAddr
String getLocalAddr()
-
isRequestedSessionIdFromCookie
Boolean isRequestedSessionIdFromCookie()
-
isRequestedSessionIdFromURL
Boolean isRequestedSessionIdFromURL()
-
getLocalPort
Integer getLocalPort()
Returns MockHttpEnvironment.localPort.
-
getServletContext
ServletContext getServletContext()
-
getQueryString
String getQueryString()
-
getDispatcherType
DispatcherType getDispatcherType()
-
getRequestId
String getRequestId()
-
getProtocolRequestId
String getProtocolRequestId()
-
getServletConnection
ServletConnection getServletConnection()
-
getParts
Collection<Part> getParts()
-
getLocalName
String getLocalName()
-
isAsyncSupported
Boolean isAsyncSupported()
-
getParameterNames
Enumeration<String> getParameterNames()
-
authenticate
Boolean authenticate(HttpServletResponse response)
-
getPathTranslated
String getPathTranslated()
-
getIntHeader
Integer getIntHeader(String name)
-
changeSessionId
String changeSessionId()
-
getAsyncContext
AsyncContext getAsyncContext()
-
getRequestURI
String getRequestURI()
-
getRequestDispatcher
RequestDispatcher getRequestDispatcher(String path)
-
isUserInRole
Boolean isUserInRole(String role)
Set isUserInRole to modify the outcome of this function.
-
roleChecker
final Unit roleChecker(BiPredicate<Principal, String> checker)
Sets the user-in-role checker using a java.util.function.BiPredicate. Java-friendly alternative to setting isUserInRole directly.
- Since:
1.1
-
getPathInfo
String getPathInfo()
-
getRemoteUser
String getRemoteUser()
-
getCookies
Array<Cookie> getCookies()
-
getParameterMap
Map<String, Array<String>> getParameterMap()
-
getAttributeNames
Enumeration<String> getAttributeNames()
-
getRemoteAddr
String getRemoteAddr()
-
getHeaders
Enumeration<String> getHeaders(String name)
-
principalProvider
final Unit principalProvider(Supplier<Principal> supplier)
Sets the user principal provider. Accepts a java.util.function.Supplier so Java callers can pass a lambda directly; Kotlin callers can do the same via SAM conversion.
- Since:
1.1
-
getUserPrincipal
Principal getUserPrincipal()
Returns the principal from userPrincipalProvider if set, otherwise falls back to userPrincipalInt.
-
getReader
BufferedReader getReader()
-
getLocales
Enumeration<Locale> getLocales()
-
getAuthType
String getAuthType()
Returns MockHttpEnvironment.authType
-
getCharacterEncoding
String getCharacterEncoding()
-
removeAttribute
Unit removeAttribute(String name)
-
getContentLength
Integer getContentLength()
-
getContextPath
String getContextPath()
-
getContentType
String getContentType()
-
getHeaderNames
Enumeration<String> getHeaderNames()
-
getAttribute
Object getAttribute(String name)
-
setAttribute
Unit setAttribute(String name, Object value)
-
getParameter
String getParameter(String parameter)
-
getRemotePort
Integer getRemotePort()
Returns MockHttpEnvironment.remotePort.
-
getDateHeader
Long getDateHeader(String name)
-
getRemoteHost
String getRemoteHost()
-
isSecure
Boolean isSecure()
Returns MockHttpEnvironment.isSecure
-
setParameter
final Unit setParameter(String name, String values)
-
-
-
-