本文整理汇总了Java中org.openqa.grid.internal.TestSession.forward方法的典型用法代码示例。如果您正苦于以下问题:Java TestSession.forward方法的具体用法?Java TestSession.forward怎么用?Java TestSession.forward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.grid.internal.TestSession
的用法示例。
在下文中一共展示了TestSession.forward方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doPost
import org.openqa.grid.internal.TestSession; //导入方法依赖的package包/类
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
SeleniumBasedRequest request = new OurRegistrationRequest(req, getRegistry());
Map<String, Object> capabilities = request.extractDesiredCapability();
String proxyId = (String)capabilities.get("proxyId");
RemoteProxy proxyById = getRegistry().getProxyById(proxyId);
if(proxyById == null) {
resp.sendError(HttpStatus.SC_BAD_REQUEST, "Remote proxy not found: " + proxyId);
return;
}
TestSession session = proxyById.getNewSession(capabilities);
if(session == null) {
log.warning("Test slot requested on proxy is unavailable. Proxy: " + proxyId + " capabilities: " + capabilities);
resp.sendError(429, "Test Slot Unavailable");
return;
}
session.forward(request, resp, true);
if(session.getExternalKey() != null) {
log.info("Created session successfully for proxy " + proxyId + " - cleaning up session");
session.sendDeleteSessionRequest();
// This will log a warning, about couldn't find a session
getRegistry().terminate(session, SessionTerminationReason.CLIENT_STOPPED_SESSION);
}
else {
log.warning("Could not create session on proxy for " + proxyId);
}
}