|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openqa.grid.web.servlet.handler.RequestHandler
public abstract class RequestHandler
Base stuff to handle the request coming from a remote. Ideally, there should be only 1 concrete class, but to support both legacy selenium1 and web driver, 2 classes are needed.
Selenium1RequestHandler
for the part specific to selenium1 protocol
WebDriverRequestHandler
for the part specific to webdriver protocol
Threading notes; RequestHandlers are instantiated per-request, run on the servlet container
thread. The instance is also accessed by the matcher thread.
Constructor Summary | |
---|---|
protected |
RequestHandler(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Registry registry)
|
Method Summary | |
---|---|
void |
bindSession(TestSession session)
|
int |
compareTo(RequestHandler o)
|
static RequestHandler |
createHandler(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Registry registry)
Detect what kind of protocol ( selenium1 vs webdriver ) is used by the request and create the associated handler. |
java.lang.String |
debug()
|
boolean |
equals(java.lang.Object obj)
|
abstract java.util.Map<java.lang.String,java.lang.Object> |
extractDesiredCapability()
Parse the request to extract the desiredCapabilities. |
abstract RequestType |
extractRequestType()
|
abstract ExternalSessionKey |
extractSession()
Extract the session from the request. |
abstract ExternalSessionKey |
forwardNewSessionRequest(TestSession session)
Forward the new session request to the TestSession that has been assigned, and parse the response to extract and return the external key assigned by the remote. |
protected void |
forwardRequest(TestSession session,
RequestHandler handler)
|
java.util.Map<java.lang.String,java.lang.Object> |
getDesiredCapabilities()
|
Registry |
getRegistry()
|
javax.servlet.http.HttpServletRequest |
getRequest()
the HttpServletRequest this hanlder is processing. |
protected java.lang.String |
getRequestBody()
reads the input stream of the request and returns its content. |
protected RequestType |
getRequestType()
|
javax.servlet.http.HttpServletResponse |
getResponse()
the HttpServletResponse the handler is writing to. |
ExternalSessionKey |
getServerSession()
return the session from the server ( = opaque handle used by the server to determine where to route session-specific commands fro mthe JSON wire protocol ). will be null until the request has been processed. |
protected TestSession |
getSession()
|
int |
hashCode()
|
void |
process()
forwards the request to the remote, allocating / releasing the resources if necessary. |
protected void |
setDesiredCapabilities(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities)
|
protected void |
setRequestType(RequestType requestType)
|
protected void |
setSession(TestSession session)
|
void |
stop()
|
java.lang.String |
toString()
|
void |
waitForSessionBound()
wait for the registry to match the request with a TestSlot. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected RequestHandler(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Registry registry)
Method Detail |
---|
public static RequestHandler createHandler(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Registry registry)
public abstract RequestType extractRequestType()
public abstract ExternalSessionKey extractSession()
public abstract java.util.Map<java.lang.String,java.lang.Object> extractDesiredCapability()
public abstract ExternalSessionKey forwardNewSessionRequest(TestSession session) throws NewSessionException
NewSessionException
- in case anything wrong happens during the new session process.protected void forwardRequest(TestSession session, RequestHandler handler) throws java.io.IOException
java.io.IOException
public void process()
public void waitForSessionBound() throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
java.lang.InterruptedException
java.util.concurrent.TimeoutException
- if the request reaches the new session wait timeout before being
assigned.protected java.lang.String getRequestBody()
public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public java.util.Map<java.lang.String,java.lang.Object> getDesiredCapabilities()
protected void setDesiredCapabilities(java.util.Map<java.lang.String,java.lang.Object> desiredCapabilities)
public int compareTo(RequestHandler o)
compareTo
in interface java.lang.Comparable<RequestHandler>
protected RequestType getRequestType()
protected void setRequestType(RequestType requestType)
protected void setSession(TestSession session)
public void bindSession(TestSession session)
protected TestSession getSession()
public ExternalSessionKey getServerSession()
public void stop()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String debug()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public Registry getRegistry()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |