当前位置: 首页>>代码示例>>Java>>正文


Java Connection类代码示例

本文整理汇总了Java中org.eclipse.jetty.io.Connection的典型用法代码示例。如果您正苦于以下问题:Java Connection类的具体用法?Java Connection怎么用?Java Connection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Connection类属于org.eclipse.jetty.io包,在下文中一共展示了Connection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setConnection

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public void setConnection(Connection connection)
{
    Connection old=_connection;
    _connection=(AsyncConnection)connection;
    if (old!=null && old!=_connection)
        _manager.endPointUpgraded(this,old);
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:8,代码来源:SelectChannelEndPoint.java

示例2: connectionClosed

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
@Override  
protected void connectionClosed(Connection connection) {
    if (connection instanceof AsyncHttpConnection) {
        AsyncHttpConnection conn = (AsyncHttpConnection)connection;
        ServerSessionMonitor monitor = (ServerSessionMonitor)conn.getAssociatedObject();
        if (monitor != null) {
            monitorService.deregisterSessionMonitor(monitor, session);
            conn.setAssociatedObject(null);
        }
    }
    super.connectionClosed(connection);
}
 
开发者ID:jaytaylor,项目名称:sql-layer,代码行数:13,代码来源:HttpConductorImpl.java

示例3: endPointUpgraded

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
@Override
protected void endPointUpgraded(ConnectedEndPoint endpoint, Connection oldConnection)
{
    LOG.debug("upgrade {} -> {}", oldConnection, endpoint.getConnection());
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:6,代码来源:WebSocketClientFactory.java

示例4: handle

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public Connection handle() throws IOException
{
    while (_endp.isOpen() && !_parser.isComplete())
    {
        if (_handshake==null || _handshake.length()>0)
            if (!handshake())
                return this;

        if (!_parser.parseAvailable())
        {
            if (_endp.isInputShutdown())
                _future.handshakeFailed(new IOException("Incomplete handshake response"));
            return this;
        }
    }
    if (_error == null)
    {
        if (_accept == null)
        {
            _error = "No Sec-WebSocket-Accept";
        }
        else if (!WebSocketConnectionRFC6455.hashKey(_key).equals(_accept))
        {
            _error = "Bad Sec-WebSocket-Accept";
        }
        else if (!initExtensions(_future.getExtensions()))
        {
            _error = "Bad Sec-WebSocket-Extension";
        }
        else
        {
            WebSocketConnection connection = newWebSocketConnection();

            Buffer header = _parser.getHeaderBuffer();
            if (header.hasContent())
                connection.fillBuffersFrom(header);
            _buffers.returnBuffer(header);

            _future.onConnection(connection);

            return connection;
        }
    }

    _endp.close();
    return this;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:48,代码来源:WebSocketClientFactory.java

示例5: getConnection

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public WebSocket.Connection getConnection()
{
    return _connection;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:5,代码来源:WebSocketConnectionRFC6455.java

示例6: handle

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public Connection handle() throws IOException
{
    Thread current = Thread.currentThread();
    ClassLoader oldcontext = current.getContextClassLoader();
    current.setContextClassLoader(_context);
    try
    {
        // handle the framing protocol
        boolean progress=true;

        while (progress)
        {
            int flushed=_generator.flushBuffer();
            int filled=_parser.parseNext();

            progress = flushed>0 || filled>0;
            _endp.flush();

            if (_endp instanceof AsyncEndPoint && ((AsyncEndPoint)_endp).hasProgressed())
                progress=true;
        }
    }
    catch(IOException e)
    {
        try
        {
            if (_endp.isOpen())
                _endp.close();
        }
        catch(IOException e2)
        {
            LOG.ignore(e2);
        }
        throw e;
    }
    finally
    {
        current.setContextClassLoader(oldcontext);
        _parser.returnBuffer();
        _generator.returnBuffer();
        if (_endp.isOpen())
        {
            if (_closedIn && _closedOut && _outbound.isBufferEmpty())
                _endp.close();
            else if (_endp.isInputShutdown() && !_closedIn)
                closeIn(CLOSE_NO_CLOSE,null);
            else
                checkWriteable();
        }
    }
    return this;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:53,代码来源:WebSocketConnectionRFC6455.java

示例7: shutdown

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public void shutdown()
{
    final WebSocket.Connection connection = _connection;
    if (connection != null)
        connection.close(CLOSE_SHUTDOWN, null);
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:7,代码来源:WebSocketConnectionRFC6455.java

示例8: handle

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public Connection handle() throws IOException
{
    try
    {
        allocateBuffers();

        boolean progress=true;

        while (progress)
        {
            progress=false;

            // If we are handshook let the delegate connection
            if (_engine.getHandshakeStatus()!=HandshakeStatus.NOT_HANDSHAKING)
                progress=process(null,null);

            // handle the delegate connection
            AsyncConnection next = (AsyncConnection)_connection.handle();
            if (next!=_connection && next!=null)
            {
                _connection=next;
                progress=true;
            }

            _logger.debug("{} handle {} progress={}", _session, this, progress);
        }
    }
    finally
    {
        releaseBuffers();

        if (!_ishut && _sslEndPoint.isInputShutdown() && _sslEndPoint.isOpen())
        {
            _ishut=true;
            try
            {
                _connection.onInputShutdown();
            }
            catch(Throwable x)
            {
                _logger.warn("onInputShutdown failed", x);
                try{_sslEndPoint.close();}
                catch(IOException e2){
                    _logger.ignore(e2);}
            }
        }
    }

    return this;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:51,代码来源:SslConnection.java

示例9: onClose

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public void onClose()
{
    Connection connection = _sslEndPoint.getConnection();
    if (connection != null && connection != this)
        connection.onClose();
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:7,代码来源:SslConnection.java

示例10: getConnection

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public Connection getConnection()
{
    return _connection;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:5,代码来源:SslConnection.java

示例11: setConnection

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public void setConnection(Connection connection)
{
    _connection=(AsyncConnection)connection;
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:5,代码来源:SslConnection.java

示例12: newConnection

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
@Override
public Connection newConnection(Connector connector, EndPoint endPoint) {
    System.out.println("Received new connection from " + endPoint.getRemoteAddress());
    ConnectionTracker.getInstance().onConnection();
    return super.newConnection(connector, endPoint);
}
 
开发者ID:fstab,项目名称:http2-examples,代码行数:7,代码来源:Http2Server.java

示例13: handle

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
public Connection handle() throws IOException
{
    while (_endp.isOpen() && !_parser.isComplete())
    {
        if (_handshake==null || _handshake.length()>0)
            if (!handshake())
                return this;

        if (!_parser.parseAvailable())
        {
            if (_endp.isInputShutdown())
                _future.handshakeFailed(new IOException("Incomplete handshake response"));
            return this;
        }
    }
    if (_error == null)
    {
        if (_accept == null)
        {
            _error = "No Sec-WebSocket-Accept";
        }
        else if (!WebSocketConnectionRFC6455.hashKey(_key).equals(_accept))
        {
            _error = "Bad Sec-WebSocket-Accept";
        }
        else
        {
            WebSocketConnection connection = newWebSocketConnection();

            Buffer header = _parser.getHeaderBuffer();
            if (header.hasContent())
                connection.fillBuffersFrom(header);
            _buffers.returnBuffer(header);

            _future.onConnection(connection);

            return connection;
        }
    }

    _endp.close();
    return this;
}
 
开发者ID:itead,项目名称:IoTgo_Android_App,代码行数:44,代码来源:WebSocketClientFactory.java

示例14: newConnection

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
@Override
public Connection newConnection(Connector connector, EndPoint endPoint) {
	ArrayByteBufferPool bufferPool = new ArrayByteBufferPool();
	return new EchoConnection(bufferPool, endPoint, connector.getExecutor());
}
 
开发者ID:HunanTV,项目名称:fw,代码行数:6,代码来源:EchoConnectionFactory.java

示例15: newConnection

import org.eclipse.jetty.io.Connection; //导入依赖的package包/类
@Override
public Connection newConnection(Connector connector, EndPoint endPoint) {
    throw new UnsupportedOperationException();
}
 
开发者ID:line,项目名称:armeria,代码行数:5,代码来源:ArmeriaConnector.java


注:本文中的org.eclipse.jetty.io.Connection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。