if (request.hasSession()) {
try {
session = getDriver().getSession(request.getSession());
session.updateLastCommandTime();
} catch (WebDriverException e) {
Response response = new Response();
response.setStatus(13);
response.setValue(serializeException(e));
return response;
}
}
// otherwise,forward to the driver to get the response.
Level level = Level.FINE;
long startTime = System.currentTimeMillis();
WebDriverLikeCommand wdlc = null;
try {
wdlc = request.getGenericCommand();
Handler h = CommandMapping.get(wdlc).createHandler(getDriver(), request);
return h.handleAndRunDecorators();
} catch (Exception we) {
Response response = new Response();
response.setStatus(errorCodes.toStatusCode(we));
if (wdlc != null && wdlc.isSessionLess()) {
response.setSessionId("");
} else {
response.setSessionId(request.getSession());
}
try {
JSONObject o = serializeException(we);
response.setValue(o);
} catch (JSONException e) {
level = Level.SEVERE;
log.warning(e.toString());
}
return response;