本文整理了Java中org.mortbay.jetty.HttpConnection.getCurrentConnection()
方法的一些代码示例,展示了HttpConnection.getCurrentConnection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpConnection.getCurrentConnection()
方法的具体详情如下:
包路径:org.mortbay.jetty.HttpConnection
类名称:HttpConnection
方法名:getCurrentConnection
暂无
代码示例来源:origin: twitter/ambrose
private static void setHandled(HttpServletRequest request) {
Request base_request = (request instanceof Request) ?
(Request) request : HttpConnection.getCurrentConnection().getRequest();
base_request.setHandled(true);
}
代码示例来源:origin: org.mortbay.jetty/jetty-embedded
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
{
Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
base_request.setHandled(true);
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello ManyHandler</h1>");
}
}
代码示例来源:origin: org.mortbay.jetty/jetty-embedded
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
{
Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
base_request.setHandled(true);
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("text/html");
response.getWriter().println("<h1>Hello OneContext</h1>");
}
}
代码示例来源:origin: org.mortbay.jetty/jetty-embedded
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
{
Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
base_request.setHandled(true);
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<h1>Hello OneHandler</h1>");
}
}
代码示例来源:origin: org.mortbay.jetty/jetty-embedded
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
{
Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
base_request.setHandled(true);
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("text/html");
response.getWriter().println("<h1>Hello OneContext "+hello+"</h1>");
}
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
{
if (_newContextURL==null)
return;
Request base_request=(request instanceof Request)?(Request)request:HttpConnection.getCurrentConnection().getRequest();
String url = _newContextURL;
if (!_discardPathInfo && request.getPathInfo()!=null)
url=URIUtil.addPaths(url, request.getPathInfo());
if (!_discardQuery && request.getQueryString()!=null)
url+="?"+request.getQueryString();
response.sendRedirect(url);
if (_permanent)
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
base_request.setHandled(true);
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
protected boolean setContentEncodingGzip()
{
HttpConnection connection = HttpConnection.getCurrentConnection();
connection.getResponseFields().put("Content-Encoding", "gzip");
return true;
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
public static Request getRequest(HttpServletRequest request)
{
if (request instanceof Request)
return (Request) request;
while (request instanceof ServletRequestWrapper)
request = (HttpServletRequest)((ServletRequestWrapper)request).getRequest();
if (request instanceof Request)
return (Request) request;
return HttpConnection.getCurrentConnection().getRequest();
}
代码示例来源:origin: stevensouza/jamonapi
/** Monitor the request and call any other requests in the decorator chain */
@Override
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException {
final Request baseRequest = (request instanceof Request) ? ((Request)request) : HttpConnection.getCurrentConnection().getRequest();
final Response baseResponse = (response instanceof Response) ? ((Response)response) : HttpConnection.getCurrentConnection().getResponse();
HttpMon httpMon=null;
try {
httpMon=httpMonFactory.start(baseRequest, baseResponse);
super.handle(target, request, response, dispatch);
} catch (Throwable e) {
httpMon.throwException(e);
} finally {
httpMon.stop();
}
}
代码示例来源:origin: org.restlet/org.restlet.ext.jetty
/**
* Handles a Jetty call by converting it to a Restlet call and giving it for
* processing to the Restlet server.
*
* @param target
* The target of the request, either a URI or a name.
* @param request
* The Jetty request.
* @param response
* The Jetty response.
* @param dispatch
* The Jetty dispatch mode.
*/
public void handle(String target, HttpServletRequest request,
HttpServletResponse response, int dispatch) throws IOException,
ServletException {
final Request baseRequest = (request instanceof Request) ? (Request) request
: HttpConnection.getCurrentConnection().getRequest();
this.helper.handle(new JettyCall(this.helper.getHelped(),
HttpConnection.getCurrentConnection()));
baseRequest.setHandled(true);
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException
{
HttpConnection.getCurrentConnection().getRequest().setHandled(true);
response.setContentType(MimeTypes.TEXT_HTML_8859_1);
ByteArrayISO8859Writer writer= new ByteArrayISO8859Writer(4096);
HttpConnection connection = HttpConnection.getCurrentConnection();
handleErrorPage(request, writer, connection.getResponse().getStatus(), connection.getResponse().getReason());
writer.flush();
response.setContentLength(writer.size());
writer.writeTo(response.getOutputStream());
writer.destroy();
}
代码示例来源:origin: com.microsoft.reef/reef-webserver
HttpConnection.getCurrentConnection().getRequest();
代码示例来源:origin: org.apache.reef/reef-webserver
HttpConnection.getCurrentConnection().getRequest();
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
final Request base_request=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
final Response base_response=(response instanceof Response)?((Response)response):HttpConnection.getCurrentConnection().getResponse();
代码示例来源:origin: org.graniteds/granite-server
public void logout() throws SecurityServiceException {
HttpGraniteContext graniteContext = (HttpGraniteContext)GraniteContext.getCurrentInstance();
HttpServletRequest httpRequest = graniteContext.getRequest();
Request request = httpRequest instanceof Request ? (Request)httpRequest : HttpConnection.getCurrentConnection().getRequest();
UserRealm realm = request.getUserRealm();
realm.disassociate(httpRequest.getUserPrincipal());
endLogout();
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch)
throws IOException, ServletException
{
Handler[] handlers = getHandlers();
if (handlers!=null && isStarted())
{
Request base_request = HttpConnection.getCurrentConnection().getRequest();
for (int i=0;i<handlers.length;i++)
{
handlers[i].handle(target,request, response, dispatch);
if ( base_request.isHandled())
return;
}
}
}
}
代码示例来源:origin: org.graniteds/granite-server
public Principal login(Object credentials, String charset) throws SecurityServiceException {
String[] decoded = decodeBase64Credentials(credentials, charset);
HttpGraniteContext graniteContext = (HttpGraniteContext)GraniteContext.getCurrentInstance();
HttpServletRequest httpRequest = graniteContext.getRequest();
Request request = httpRequest instanceof Request ? (Request)httpRequest : HttpConnection.getCurrentConnection().getRequest();
UserRealm realm = request.getUserRealm();
Principal principal = realm.authenticate(decoded[0], decoded[1], request);
if (principal == null) {
if (request.getSession(false) != null)
request.getSession(false).removeAttribute(JETTY6_AUTH);
throw SecurityServiceException.newInvalidCredentialsException("Wrong username or password");
}
request.setAuthType(AUTH_TYPE);
request.setUserPrincipal(principal);
request.getSession().setAttribute(JETTY6_AUTH, principal);
endLogin(credentials, charset);
return principal;
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
Response base_response = (response instanceof Response) ? (Response)response:HttpConnection.getCurrentConnection().getResponse();
UserRealm old_realm = base_request.getUserRealm();
try
代码示例来源:origin: org.mortbay.jetty/jetty-security
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException
Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
Response base_response = (response instanceof Response) ? (Response)response:HttpConnection.getCurrentConnection().getResponse();
UserRealm old_realm = base_request.getUserRealm();
try
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
try
Connector connector = HttpConnection.getCurrentConnection().getConnector();
buffer = new NIOBuffer((int) length, ((NIOConnector)connector).getUseDirectBuffers()?NIOBuffer.DIRECT:NIOBuffer.INDIRECT);
内容来源于网络,如有侵权,请联系作者删除!