本文整理了Java中org.eclipse.jetty.server.Request.getConnection
方法的一些代码示例,展示了Request.getConnection
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getConnection
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:getConnection
暂无
代码示例来源:origin: 4thline/cling
public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
Request jettyRequest = (Request)request;
AbstractHttpConnection connection = jettyRequest.getConnection();
Socket socket = (Socket)connection.getEndPoint().getTransport();
if (log.isLoggable(Level.FINE))
log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
try {
socket.getOutputStream().write(heartbeat);
socket.getOutputStream().flush();
return true;
} catch (IOException ex) {
if (log.isLoggable(Level.FINE))
log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
return false;
}
}
代码示例来源:origin: kingthy/TVRemoteIME
public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
Request jettyRequest = (Request)request;
AbstractHttpConnection connection = jettyRequest.getConnection();
Socket socket = (Socket)connection.getEndPoint().getTransport();
if (log.isLoggable(Level.FINE))
log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
try {
socket.getOutputStream().write(heartbeat);
socket.getOutputStream().flush();
return true;
} catch (IOException ex) {
if (log.isLoggable(Level.FINE))
log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
return false;
}
}
代码示例来源:origin: org.fourthline.cling/cling-core
public static boolean isConnectionOpen(HttpServletRequest request, byte[] heartbeat) {
Request jettyRequest = (Request)request;
AbstractHttpConnection connection = jettyRequest.getConnection();
Socket socket = (Socket)connection.getEndPoint().getTransport();
if (log.isLoggable(Level.FINE))
log.fine("Checking if client connection is still open: " + socket.getRemoteSocketAddress());
try {
socket.getOutputStream().write(heartbeat);
socket.getOutputStream().flush();
return true;
} catch (IOException ex) {
if (log.isLoggable(Level.FINE))
log.fine("Client connection has been closed: " + socket.getRemoteSocketAddress());
return false;
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public Object getAttribute(String name)
{
if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
return new Long(getConnection().getEndPoint().getMaxIdleTime());
Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
if (attr == null && Continuation.ATTRIBUTE.equals(name))
return _async;
return attr;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
public Object getAttribute(String name)
{
if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
return new Long(getConnection().getEndPoint().getMaxIdleTime());
Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
if (attr == null && Continuation.ATTRIBUTE.equals(name))
return _async;
return attr;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
public Object getAttribute(String name)
{
if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
return new Long(getConnection().getEndPoint().getMaxIdleTime());
Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
if (attr == null && Continuation.ATTRIBUTE.equals(name))
return _async;
return attr;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
public Object getAttribute(String name)
{
if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
return new Long(getConnection().getEndPoint().getMaxIdleTime());
Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
if (attr == null && Continuation.ATTRIBUTE.equals(name))
return _async;
return attr;
}
代码示例来源:origin: org.eclipse.jetty/server
public Object getAttribute(String name)
{
if ("org.eclipse.jetty.io.EndPoint.maxIdleTime".equalsIgnoreCase(name))
return new Long(getConnection().getEndPoint().getMaxIdleTime());
Object attr = (_attributes == null)?null:_attributes.getAttribute(name);
if (attr == null && Continuation.ATTRIBUTE.equals(name))
return _async;
return attr;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
protected void closeConnection(HttpServletRequest request, HttpServletResponse response, Thread thread)
{
try
{
Request base_request=(request instanceof Request)?(Request)request:AbstractHttpConnection.getCurrentConnection().getRequest();
base_request.getConnection().getEndPoint().close();
}
catch(IOException e)
{
LOG.warn(e);
}
}
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
getConnection().getEndPoint().setMaxIdleTime(Integer.valueOf(value.toString()));
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
/**
* Checks the incoming request against the whitelist and blacklist
*
* @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
// Get the real remote IP (not the one set by the forwarded headers (which may be forged))
AbstractHttpConnection connection = baseRequest.getConnection();
if (connection!=null)
{
EndPoint endp=connection.getEndPoint();
if (endp!=null)
{
String addr = endp.getRemoteAddr();
if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
{
response.sendError(HttpStatus.FORBIDDEN_403);
baseRequest.setHandled(true);
return;
}
}
}
getHandler().handle(target,baseRequest, request, response);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
/**
* Checks the incoming request against the whitelist and blacklist
*
* @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
// Get the real remote IP (not the one set by the forwarded headers (which may be forged))
AbstractHttpConnection connection = baseRequest.getConnection();
if (connection!=null)
{
EndPoint endp=connection.getEndPoint();
if (endp!=null)
{
String addr = endp.getRemoteAddr();
if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
{
response.sendError(HttpStatus.FORBIDDEN_403);
baseRequest.setHandled(true);
return;
}
}
}
getHandler().handle(target,baseRequest, request, response);
}
代码示例来源:origin: org.eclipse.jetty/server
/**
* Checks the incoming request against the whitelist and blacklist
*
* @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
// Get the real remote IP (not the one set by the forwarded headers (which may be forged))
AbstractHttpConnection connection = baseRequest.getConnection();
if (connection!=null)
{
EndPoint endp=connection.getEndPoint();
if (endp!=null)
{
String addr = endp.getRemoteAddr();
if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
{
response.sendError(HttpStatus.FORBIDDEN_403);
baseRequest.setHandled(true);
return;
}
}
}
getHandler().handle(target,baseRequest, request, response);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
/**
* Checks the incoming request against the whitelist and blacklist
*
* @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
// Get the real remote IP (not the one set by the forwarded headers (which may be forged))
AbstractHttpConnection connection = baseRequest.getConnection();
if (connection!=null)
{
EndPoint endp=connection.getEndPoint();
if (endp!=null)
{
String addr = endp.getRemoteAddr();
if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
{
response.sendError(HttpStatus.FORBIDDEN_403);
baseRequest.setHandled(true);
return;
}
}
}
getHandler().handle(target,baseRequest, request, response);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
/**
* Checks the incoming request against the whitelist and blacklist
*
* @see org.eclipse.jetty.server.handler.HandlerWrapper#handle(java.lang.String, org.eclipse.jetty.server.Request, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
// Get the real remote IP (not the one set by the forwarded headers (which may be forged))
AbstractHttpConnection connection = baseRequest.getConnection();
if (connection!=null)
{
EndPoint endp=connection.getEndPoint();
if (endp!=null)
{
String addr = endp.getRemoteAddr();
if (addr!=null && !isAddrUriAllowed(addr,baseRequest.getPathInfo()))
{
response.sendError(HttpStatus.FORBIDDEN_403);
baseRequest.setHandled(true);
return;
}
}
}
getHandler().handle(target,baseRequest, request, response);
}
代码示例来源:origin: org.eclipse.jetty/server
baseRequest.getConnection().include();
if (_named!=null)
_contextHandler.handle(_named,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response);
baseRequest.getConnection().included();
baseRequest.setParameters(old_params);
baseRequest.setDispatcherType(old_type);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
baseRequest.getConnection().include();
if (_named!=null)
_contextHandler.handle(_named,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response);
baseRequest.getConnection().included();
baseRequest.setParameters(old_params);
baseRequest.setDispatcherType(old_type);
代码示例来源:origin: org.eclipse.jetty/server
protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException
HttpFields httpFields = request.getConnection().getRequestFields();
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp
protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException
HttpFields httpFields = request.getConnection().getRequestFields();
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
protected void checkForwardedHeaders(EndPoint endpoint, Request request) throws IOException
HttpFields httpFields = request.getConnection().getRequestFields();
内容来源于网络,如有侵权,请联系作者删除!