org.openqa.grid.web.servlet.handler
Class SeleniumBasedRequest
java.lang.Object
javax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
org.openqa.grid.web.servlet.handler.SeleniumBasedRequest
- All Implemented Interfaces:
- javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest
- Direct Known Subclasses:
- LegacySeleniumRequest, WebDriverRequest
public abstract class SeleniumBasedRequest
- extends javax.servlet.http.HttpServletRequestWrapper
wrapper around a selenium http request that helps accessing the internal
details that are selenium related ( type of protocol, new session request
etc ) Also allows to change the content of the request, or read it
on the hub.
Fields inherited from interface javax.servlet.http.HttpServletRequest |
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper |
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole |
Methods inherited from class javax.servlet.ServletRequestWrapper |
getAttribute, getAttributeNames, getCharacterEncoding, getContentType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.servlet.ServletRequest |
getAttribute, getAttributeNames, getCharacterEncoding, getContentType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding |
SeleniumBasedRequest
public SeleniumBasedRequest(javax.servlet.http.HttpServletRequest request,
Registry registry,
RequestType type,
java.util.Map<java.lang.String,java.lang.Object> desiredCapability)
SeleniumBasedRequest
public SeleniumBasedRequest(javax.servlet.http.HttpServletRequest httpServletRequest,
Registry registry)
createFromRequest
public static SeleniumBasedRequest createFromRequest(javax.servlet.http.HttpServletRequest request,
Registry registry)
getRequestProtocol
public static SeleniumProtocol getRequestProtocol(javax.servlet.http.HttpServletRequest request)
- check the request and finds out if that's a selenium legacy protocol( RC ) or a webdriver one.
- Parameters:
request
-
- Returns:
getRegistry
public Registry getRegistry()
extractRequestType
public abstract RequestType extractRequestType()
- Returns:
- the type of the request.
extractSession
public abstract ExternalSessionKey extractSession()
- Extract the session from the request. This only works for a request that has a session already
assigned. It shouldn't be called for a new session request.
- Returns:
- the external session id sent by the remote. Null is the session cannot be found.
extractDesiredCapability
public abstract java.util.Map<java.lang.String,java.lang.Object> extractDesiredCapability()
- Parse the request to extract the desiredCapabilities. For non web driver protocol ( selenium1 )
some mapping will be necessary
- Returns:
- the desired capabilities requested by the client.
getNewSessionRequestedCapability
public abstract java.lang.String getNewSessionRequestedCapability(TestSession session)
getRequestType
public RequestType getRequestType()
getInputStream
public javax.servlet.ServletInputStream getInputStream()
throws java.io.IOException
- Specified by:
getInputStream
in interface javax.servlet.ServletRequest
- Overrides:
getInputStream
in class javax.servlet.ServletRequestWrapper
- Throws:
java.io.IOException
getReader
public java.io.BufferedReader getReader()
throws java.io.IOException
- Specified by:
getReader
in interface javax.servlet.ServletRequest
- Overrides:
getReader
in class javax.servlet.ServletRequestWrapper
- Throws:
java.io.IOException
getContentLength
public int getContentLength()
- Specified by:
getContentLength
in interface javax.servlet.ServletRequest
- Overrides:
getContentLength
in class javax.servlet.ServletRequestWrapper
getBody
public java.lang.String getBody()
setBody
public void setBody(java.lang.String content)
setBody
public void setBody(byte[] content)
getCreationTime
public long getCreationTime()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getDesiredCapabilities
public java.util.Map<java.lang.String,java.lang.Object> getDesiredCapabilities()
Copyright © 2012. All Rights Reserved.