Package com.caucho.network.listen

Examples of com.caucho.network.listen.SocketLink


  /**
   * Called for a connection: close
   */
  protected void handleConnectionClose()
  {
    SocketLink conn = _conn;

    if (conn != null)
      conn.killKeepalive("client Connection: close");
  }
View Full Code Here


  /**
   * Kills the keepalive.
   */
  public void killKeepalive(String reason)
  {
    SocketLink conn = _conn;

    if (conn != null) {
      conn.killKeepalive(reason);
    }
  }
View Full Code Here

  /**
   * Returns true if the keepalive is active.
   */
  protected boolean isKeepalive()
  {
    SocketLink conn = _conn;
   
    return conn != null && conn.isKeepaliveAllocated();
  }
View Full Code Here

   * Initialize any special attributes.
   */
  @Override
  protected void initAttributes(HttpServletRequestImpl request)
  {
    SocketLink conn = getConnection();

    if (! (conn instanceof TcpSocketLink))
      return;
   
    TcpSocketLink tcpConn = (TcpSocketLink) conn;
   
    if (! conn.isSecure())
      return;

    QSocket socket = tcpConn.getSocket();

    String cipherSuite = socket.getCipherSuite();
View Full Code Here

   * For SSL connections, use the SSL identifier.
   */
  @Override
  public String findSessionIdFromConnection()
  {
    SocketLink link = getConnection();
   
    TcpSocketLink tcpConn = null;
   
    if (link instanceof TcpSocketLink)
      tcpConn = (TcpSocketLink) getConnection();
View Full Code Here

                       ServletResponse response)
    throws ServletException, IOException
  {
    _next.doFilter(request, response);
   
    SocketLink socketLink = null;
   
    if (request instanceof CauchoRequest) {
      socketLink = ((CauchoRequest) request).getSocketLink();
    }
   
    try {
      if (socketLink != null)
        socketLink.requestShutdownBegin();
     
      _accessLog.log((HttpServletRequest) request,
                     (HttpServletResponse) response,
                     _webApp);
    } catch (Throwable e) {
      log.log(Level.FINE, e.toString(), e);
    } finally {
      if (socketLink != null)
        socketLink.requestShutdownEnd();
    }
   
  }
View Full Code Here

  public boolean handleRequest()
    throws IOException
  {
    _hasRequest = false;

    SocketLink conn = getConnection();
    Server server = getServer();

    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();

    try {
      thread.setContextClassLoader(server.getClassLoader());

      HttpBufferStore httpBuffer = server.allocateHttpBuffer();

      startRequest(httpBuffer);
      startInvocation();

      ReadStream is = getRawRead();
      WriteStream os = getRawWrite();

      _filter.init(is, os);
      _writeStream.init(_filter);
      // _writeStream.setWritePrefix(3);

      try {
        _hasRequest = false;

        while (readPacket(is)) {
        }

        if (! _hasRequest) {
          if (log.isLoggable(Level.FINE))
            log.fine(dbgId() + "read timeout");

          return false;
        }

        startInvocation();

        _isSecure = conn.isSecure() || conn.getLocalPort() == 443;

        /*
        if (_protocol.length() == 0)
          _protocol.append("HTTP/0.9");

        if (log.isLoggable(Level.FINE)) {
          log.fine(dbgId() + _method + " " +
                   new String(_uri, 0, _uriLength) + " " + _protocol);
          log.fine(dbgId() + "Remote-IP: " + _conn.getRemoteHost() + ":" + _conn.getRemotePort());
        }

        parseHeaders(_rawRead);

        if (getVersion() >= HTTP_1_1 && isForce10()) {
          _protocol.clear();
          _protocol.append("HTTP/1.0");
          _version = HTTP_1_0;
        }
        */
      } catch (ClientDisconnectException e) {
        throw e;
      } catch (Throwable e) {
        log.log(Level.FINER, e.toString(), e);

        throw new BadRequestException(String.valueOf(e), e);
      }

      CharSequence host = getHost();

      String ipHost = conn.getVirtualHost();
      if (ipHost != null)
        host = ipHost;

      _invocationKey.init(_isSecure,
                          host, conn.getLocalPort(),
                          _uri, _uriLength);

      Invocation invocation = getInvocation(host);

      if (invocation == null)
View Full Code Here

    throws ServletException, IOException
  {
    if (request instanceof AbstractHttpRequest) {
      AbstractHttpRequest httpRequest = (AbstractHttpRequest) request;

      SocketLink connection = httpRequest.getConnection();

      if (connection instanceof TcpSocketLink) {
        TcpSocketLink tcpConnection = (TcpSocketLink) connection;

        long time = Alarm.getExactTime();
View Full Code Here

   * Initialize any special attributes.
   */
  @Override
  protected void initAttributes(HttpServletRequestImpl request)
  {
    SocketLink conn = getConnection();

    if (! (conn instanceof TcpSocketLink))
      return;
   
    TcpSocketLink tcpConn = (TcpSocketLink) conn;
   
    if (! conn.isSecure())
      return;

    QSocket socket = tcpConn.getSocket();

    String cipherSuite = socket.getCipherSuite();
View Full Code Here

  public boolean handleRequest()
    throws IOException
  {
    _hasRequest = false;

    SocketLink conn = getConnection();
    Server server = getServer();

    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();

    try {
      thread.setContextClassLoader(server.getClassLoader());

      HttpBufferStore httpBuffer = HttpBufferStore.allocate((Server) server);

      startRequest(httpBuffer);
      startInvocation();

      ReadStream is = getRawRead();
      WriteStream os = getRawWrite();

      _filter.init(is, os);
      _writeStream.init(_filter);
      // _writeStream.setWritePrefix(3);

      try {
        _hasRequest = false;

        while (readPacket(is)) {
        }

        if (! _hasRequest) {
          if (log.isLoggable(Level.FINE))
            log.fine(dbgId() + "read timeout");

          return false;
        }

        startInvocation();

        _isSecure = conn.isSecure() || conn.getLocalPort() == 443;

        /*
        if (_protocol.length() == 0)
          _protocol.append("HTTP/0.9");

        if (log.isLoggable(Level.FINE)) {
          log.fine(dbgId() + _method + " " +
                   new String(_uri, 0, _uriLength) + " " + _protocol);
          log.fine(dbgId() + "Remote-IP: " + _conn.getRemoteHost() + ":" + _conn.getRemotePort());
        }

        parseHeaders(_rawRead);

        if (getVersion() >= HTTP_1_1 && isForce10()) {
          _protocol.clear();
          _protocol.append("HTTP/1.0");
          _version = HTTP_1_0;
        }
        */
      } catch (ClientDisconnectException e) {
        throw e;
      } catch (Throwable e) {
        log.log(Level.FINER, e.toString(), e);

        throw new BadRequestException(String.valueOf(e), e);
      }

      CharSequence host = getHost();

      String ipHost = conn.getVirtualHost();
      if (ipHost != null)
        host = ipHost;

      _invocationKey.init(_isSecure,
                          host, conn.getLocalPort(),
                          _uri, _uriLength);

      Invocation invocation = getInvocation(host);

      if (invocation == null)
View Full Code Here

TOP

Related Classes of com.caucho.network.listen.SocketLink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.