本文整理了Java中org.eclipse.jetty.server.HttpConnection
类的一些代码示例,展示了HttpConnection
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpConnection
类的具体详情如下:
包路径:org.eclipse.jetty.server.HttpConnection
类名称:HttpConnection
[英]A Connection that handles the HTTP protocol.
[中]处理HTTP协议的连接。
代码示例来源:origin: neo4j/neo4j
public static JettyHttpConnection getCurrentJettyHttpConnection()
{
HttpConnection connection = HttpConnection.getCurrentConnection();
return connection instanceof JettyHttpConnection ? (JettyHttpConnection) connection : null;
}
}
代码示例来源:origin: stackoverflow.com
try {
hc = (HttpConnection) Connector.open("http://" + fileToGet);
hc.setRequestMethod(HttpsConnection.GET);
din = hc.openDataInputStream();
ByteVector bv = new ByteVector();
int i = din.read();
din.close();
din = null;
hc.close();
hc = null;
代码示例来源:origin: jenkinsci/winstone
if (LOG.isDebugEnabled())
LOG.debug("Upgrade from {} to {}", this, connection);
_channel.getState().upgrade();
getEndPoint().upgrade(connection);
_channel.recycle();
_parser.reset();
_generator.reset();
if (_contentBufferReferences.get()==0)
releaseRequestBuffer();
else
if (getCurrentConnection()!=this)
fillInterested();
else if (getConnector().isRunning())
getExecutor().execute(this);
if (getConnector().isRunning())
LOG.warn(e);
else
LOG.ignore(e);
getEndPoint().close();
getEndPoint().close();
else if (getEndPoint().isOpen())
fillInterested();
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
LOG.warn("{} fill with unconsumed content!",this);
return 0;
if(getEndPoint().isInputShutdown())
if (LOG.isDebugEnabled())
LOG.debug("{} filled -1 {}",this,BufferUtil.toDetailString(_requestBuffer));
return -1;
_requestBuffer = getRequestBuffer();
int filled = getEndPoint().fill(_requestBuffer);
if (filled==0) // Do a retry on fill 0 (optimization for SSL connections)
filled = getEndPoint().fill(_requestBuffer);
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
LOG.debug("Upgrade from {} to {}", this, connection);
onClose();
getEndPoint().setConnection(connection);
connection.onOpen();
reset();
return;
reset();
if (getCurrentConnection()==null)
fillInterested();
else if (getConnector().isStarted())
getExecutor().execute(this);
if (getConnector().isStarted())
LOG.warn(e);
else
LOG.ignore(e);
getEndPoint().close();
getEndPoint().close();
if (getEndPoint().isOpen() && getEndPoint().isOutputShutdown())
fillInterested();
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
setCurrentConnection(this);
try
_requestBuffer = _bufferPool.acquire(getInputBufferSize(), REQUEST_BUFFER_DIRECT);
int filled = getEndPoint().fill(_requestBuffer);
if (filled==0) // Do a retry on fill 0 (optimisation for SSL connections)
filled = getEndPoint().fill(_requestBuffer);
releaseRequestBuffer();
fillInterested();
return;
if (getEndPoint().isOutputShutdown())
getEndPoint().close();
else
getEndPoint().shutdownOutput();
releaseRequestBuffer();
return;
if (_channel.getState().isSuspended() || getEndPoint().getConnection()!=this)
return;
LOG.debug(e);
else
LOG.warn(this.toString(), e);
close();
代码示例来源:origin: Nextdoor/bender
public void onFillable()
final HttpConnection last=setCurrentConnection(this);
int filled=Integer.MAX_VALUE;
boolean suspended=false;
while (!suspended && getEndPoint().getConnection()==this)
if(getEndPoint().isInputShutdown())
_requestBuffer = getRequestBuffer();
filled = getEndPoint().fill(_requestBuffer);
if (filled==0) // Do a retry on fill 0 (optimization for SSL connections)
filled = getEndPoint().fill(_requestBuffer);
releaseRequestBuffer();
LOG.debug(e);
else
LOG.warn(this.toString(), e);
close();
setCurrentConnection(last);
if (!suspended && getEndPoint().isOpen() && getEndPoint().getConnection()==this)
fillInterested();
代码示例来源:origin: jenkinsci/winstone
getEndPoint().write(this, _header, chunk, _content);
break;
case 6:
getEndPoint().write(this, _header, chunk);
break;
case 5:
getEndPoint().write(this, _header, _content);
break;
case 4:
getEndPoint().write(this, _header);
break;
case 3:
getEndPoint().write(this, chunk, _content);
break;
case 2:
getEndPoint().write(this, chunk);
break;
case 1:
getEndPoint().write(this, _content);
break;
default:
if (getConnector().isShutdown())
_shutdownOut=true;
代码示例来源:origin: jenkinsci/winstone
@Override
public void onFillable()
HttpConnection last=setCurrentConnection(this);
try
while (getEndPoint().isOpen())
int filled = fillRequestBuffer();
if (filled>0)
bytesIn.add(filled);
else if (filled==-1 && getEndPoint().isOutputShutdown())
close();
boolean handle = parseRequestBuffer();
if (getEndPoint().getConnection()!=this)
break;
if (suspended || getEndPoint().getConnection() != this)
break;
fillInterested();
break;
setCurrentConnection(last);
if (LOG.isDebugEnabled())
LOG.debug("{} onFillable exit {} {}", this, _channel.getState(),BufferUtil.toDetailString(_requestBuffer));
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
if (handshaker == null)
LOG.warn("Unsupported Websocket version: " + version);
HttpConnection http = HttpConnection.getCurrentConnection();
EndPoint endp = http.getEndPoint();
Executor executor = http.getConnector().getExecutor();
ByteBufferPool bufferPool = http.getConnector().getByteBufferPool();
WebSocketServerConnection wsConnection = new WebSocketServerConnection(endp,executor,scheduler,driver.getPolicy(),bufferPool,this);
connection = wsConnection;
extensionStack.configure(wsConnection.getGenerator());
LOG.debug("HttpConnection: {}",http);
LOG.debug("AsyncWebSocketConnection: {}",connection);
代码示例来源:origin: org.eclipse.jetty.websocket/websocket-server
LOG.warn(warn.toString());
EndPoint endp = http.getEndPoint();
Connector connector = http.getConnector();
Executor executor = connector.getExecutor();
ByteBufferPool bufferPool = connector.getByteBufferPool();
extensionStack.configure(wsConnection.getGenerator());
if (LOG.isDebugEnabled())
LOG.debug("HttpConnection: {}", http);
LOG.debug("WebSocketConnection: {}", wsConnection);
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
if (getEndPoint().isInputShutdown())
getEndPoint().fillInterested(_readBlocker);
LOG.debug("{} block readable on {}",this,_readBlocker);
_readBlocker.block();
int size=getInputBufferSize();
if (size<content_length)
size=size*4; // TODO tune this
int filled=getEndPoint().fill(_requestBuffer);
LOG.debug("{} block filled {}",this,filled);
if (filled<0)
throw new InterruptedIOException(getEndPoint().toString()){{initCause(x);}};
代码示例来源:origin: jenkinsci/winstone
@Override
public void abort(Throwable failure)
{
if (LOG.isDebugEnabled())
LOG.debug("abort {} {}",this,failure);
// Do a direct close of the output, as this may indicate to a client that the
// response is bad either with RST or by abnormal completion of chunked response.
getEndPoint().close();
}
代码示例来源:origin: org.eclipse.jetty/jetty-proxy
protected void onConnectSuccess(ConnectContext connectContext, UpstreamConnection upstreamConnection)
{
ConcurrentMap<String, Object> context = connectContext.getContext();
HttpServletRequest request = connectContext.getRequest();
prepareContext(request, context);
HttpConnection httpConnection = connectContext.getHttpConnection();
EndPoint downstreamEndPoint = httpConnection.getEndPoint();
DownstreamConnection downstreamConnection = newDownstreamConnection(downstreamEndPoint, context);
downstreamConnection.setInputBufferSize(getBufferSize());
upstreamConnection.setConnection(downstreamConnection);
downstreamConnection.setConnection(upstreamConnection);
if (LOG.isDebugEnabled())
LOG.debug("Connection setup completed: {}<->{}", downstreamConnection, upstreamConnection);
HttpServletResponse response = connectContext.getResponse();
sendConnectResponse(request, response, HttpServletResponse.SC_OK);
upgradeConnection(request, response, downstreamConnection);
connectContext.getAsyncContext().complete();
}
代码示例来源:origin: Nextdoor/bender
@Override
protected void blockForContent() throws IOException
{
while(true)
{
try (Blocker blocker=_readBlocker.acquire())
{
_httpConnection.fillInterested(blocker);
if (LOG.isDebugEnabled())
LOG.debug("{} block readable on {}",this,blocker);
blocker.block();
}
Object content=getNextContent();
if (content!=null || isFinished())
break;
}
}
代码示例来源:origin: Nextdoor/bender
@Override
public void onCompleteFailure(final Throwable x)
{
releaseHeader();
failedCallback(_callback,x);
if (_shutdownOut)
getEndPoint().shutdownOutput();
}
代码示例来源:origin: apache/cxf
private Request getCurrentRequest() {
try {
HttpConnection con = HttpConnection.getCurrentConnection();
HttpChannel channel = con.getHttpChannel();
return channel.getRequest();
} catch (Throwable t) {
//
}
return null;
}
}
代码示例来源:origin: org.scalatra.socketio-java/socketio-core
HttpConnection httpConnection = HttpConnection.getCurrentConnection();
if (httpConnection != null) {
EndPoint endPoint = httpConnection.getEndPoint();
if (endPoint instanceof AsyncEndPoint) {
((AsyncEndPoint)endPoint).cancelIdle();
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.jetty.server
@Override
public void abort(Throwable failure)
{
// Do a direct close of the output, as this may indicate to a client that the
// response is bad either with RST or by abnormal completion of chunked response.
getEndPoint().close();
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
private void blockingWrite(ByteBuffer... bytes) throws IOException
{
try
{
getEndPoint().write(_writeBlocker, bytes);
_writeBlocker.block();
}
catch (InterruptedException x)
{
throw (IOException)new InterruptedIOException().initCause(x);
}
catch (TimeoutException e)
{
throw new IOException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!