jetty-server-8.1.0.v20120127

16:37:33.066 INFO  jd.cli.Main - Decompiling jetty-server-8.1.0.v20120127.jar
package org.eclipse.jetty.server;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Comparator;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jetty.http.HttpContent;
import org.eclipse.jetty.http.HttpContent.ResourceAsHttpContent;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.ByteArrayBuffer;
import org.eclipse.jetty.io.View;
import org.eclipse.jetty.io.nio.DirectNIOBuffer;
import org.eclipse.jetty.io.nio.IndirectNIOBuffer;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;

public class ResourceCache
{
  private static final Logger LOG = Log.getLogger(ResourceCache.class);
  private final ConcurrentMap<String, Content> _cache;
  private final AtomicInteger _cachedSize;
  private final AtomicInteger _cachedFiles;
  private final ResourceFactory _factory;
  private final ResourceCache _parent;
  private final MimeTypes _mimeTypes;
  private boolean _useFileMappedBuffer = true;
  private int _maxCachedFileSize = 4194304;
  private int _maxCachedFiles = 2048;
  private int _maxCacheSize = 33554432;
  
  public ResourceCache(ResourceCache parent, ResourceFactory factory, MimeTypes mimeTypes, boolean useFileMappedBuffer)
  {
    this(parent, factory, mimeTypes);
    setUseFileMappedBuffer(useFileMappedBuffer);
  }
  
  public ResourceCache(ResourceCache parent, ResourceFactory factory, MimeTypes mimeTypes)
  {
    _factory = factory;
    _cache = new ConcurrentHashMap();
    _cachedSize = new AtomicInteger();
    _cachedFiles = new AtomicInteger();
    _mimeTypes = mimeTypes;
    _parent = parent;
  }
  
  public int getCachedSize()
  {
    return _cachedSize.get();
  }
  
  public int getCachedFiles()
  {
    return _cachedFiles.get();
  }
  
  public int getMaxCachedFileSize()
  {
    return _maxCachedFileSize;
  }
  
  public void setMaxCachedFileSize(int maxCachedFileSize)
  {
    _maxCachedFileSize = maxCachedFileSize;
    shrinkCache();
  }
  
  public int getMaxCacheSize()
  {
    return _maxCacheSize;
  }
  
  public void setMaxCacheSize(int maxCacheSize)
  {
    _maxCacheSize = maxCacheSize;
    shrinkCache();
  }
  
  public int getMaxCachedFiles()
  {
    return _maxCachedFiles;
  }
  
  public void setMaxCachedFiles(int maxCachedFiles)
  {
    _maxCachedFiles = maxCachedFiles;
    shrinkCache();
  }
  
  public boolean isUseFileMappedBuffer()
  {
    return _useFileMappedBuffer;
  }
  
  public void setUseFileMappedBuffer(boolean useFileMappedBuffer)
  {
    _useFileMappedBuffer = useFileMappedBuffer;
  }
  
  public void flushCache()
  {
    if (_cache != null) {
      while (_cache.size() > 0) {
        for (String path : _cache.keySet())
        {
          Content content = (Content)_cache.remove(path);
          if (content != null) {
            content.invalidate();
          }
        }
      }
    }
  }
  
  public HttpContent lookup(String pathInContext)
    throws IOException
  {
    Content content = (Content)_cache.get(pathInContext);
    if ((content != null) && (content.isValid())) {
      return content;
    }
    Resource resource = _factory.getResource(pathInContext);
    HttpContent loaded = load(pathInContext, resource);
    if (loaded != null) {
      return loaded;
    }
    if (_parent != null)
    {
      HttpContent httpContent = _parent.lookup(pathInContext);
      if (httpContent != null) {
        return httpContent;
      }
    }
    return null;
  }
  
  protected boolean isCacheable(Resource resource)
  {
    long len = resource.length();
    
    return (len > 0L) && (len < _maxCachedFileSize) && (len < _maxCacheSize);
  }
  
  private HttpContent load(String pathInContext, Resource resource)
    throws IOException
  {
    Content content = null;
    if ((resource == null) || (!resource.exists())) {
      return null;
    }
    if ((!resource.isDirectory()) && (isCacheable(resource)))
    {
      content = new Content(pathInContext, resource);
      
      shrinkCache();
      
      Content added = (Content)_cache.putIfAbsent(pathInContext, content);
      if (added != null)
      {
        content.invalidate();
        content = added;
      }
      return content;
    }
    return new HttpContent.ResourceAsHttpContent(resource, _mimeTypes.getMimeByExtension(resource.toString()), getMaxCachedFileSize());
  }
  
  private void shrinkCache()
  {
    while ((_cache.size() > 0) && ((_cachedFiles.get() > _maxCachedFiles) || (_cachedSize.get() > _maxCacheSize)))
    {
      SortedSet<Content> sorted = new TreeSet(new Comparator()
      {
        public int compare(ResourceCache.Content c1, ResourceCache.Content c2)
        {
          if (_lastAccessed < _lastAccessed) {
            return -1;
          }
          if (_lastAccessed > _lastAccessed) {
            return 1;
          }
          if (_length < _length) {
            return -1;
          }
          return _key.compareTo(_key);
        }
      });
      for (Content content : _cache.values()) {
        sorted.add(content);
      }
      for (Content content : sorted)
      {
        if ((_cachedFiles.get() <= _maxCachedFiles) && (_cachedSize.get() <= _maxCacheSize)) {
          break;
        }
        if (content == _cache.remove(content.getKey())) {
          content.invalidate();
        }
      }
    }
  }
  
  protected Buffer getIndirectBuffer(Resource resource)
  {
    try
    {
      int len = (int)resource.length();
      if (len < 0)
      {
        LOG.warn("invalid resource: " + String.valueOf(resource) + " " + len, new Object[0]);
        return null;
      }
      Buffer buffer = new IndirectNIOBuffer(len);
      InputStream is = resource.getInputStream();
      buffer.readFrom(is, len);
      is.close();
      return buffer;
    }
    catch (IOException e)
    {
      LOG.warn(e);
    }
    return null;
  }
  
  protected Buffer getDirectBuffer(Resource resource)
  {
    try
    {
      if ((_useFileMappedBuffer) && (resource.getFile() != null)) {
        return new DirectNIOBuffer(resource.getFile());
      }
      int len = (int)resource.length();
      if (len < 0)
      {
        LOG.warn("invalid resource: " + String.valueOf(resource) + " " + len, new Object[0]);
        return null;
      }
      Buffer buffer = new DirectNIOBuffer(len);
      InputStream is = resource.getInputStream();
      buffer.readFrom(is, len);
      is.close();
      return buffer;
    }
    catch (IOException e)
    {
      LOG.warn(e);
    }
    return null;
  }
  
  public String toString()
  {
    return "ResourceCache[" + _parent + "," + _factory + "]@" + hashCode();
  }
  
  public class Content
    implements HttpContent
  {
    final Resource _resource;
    final int _length;
    final String _key;
    final long _lastModified;
    final Buffer _lastModifiedBytes;
    final Buffer _contentType;
    volatile long _lastAccessed;
    AtomicReference<Buffer> _indirectBuffer = new AtomicReference();
    AtomicReference<Buffer> _directBuffer = new AtomicReference();
    
    Content(String pathInContext, Resource resource)
    {
      _key = pathInContext;
      _resource = resource;
      
      _contentType = _mimeTypes.getMimeByExtension(_resource.toString());
      boolean exists = resource.exists();
      _lastModified = (exists ? resource.lastModified() : -1L);
      _lastModifiedBytes = (_lastModified < 0L ? null : new ByteArrayBuffer(HttpFields.formatDate(_lastModified)));
      
      _length = (exists ? (int)resource.length() : 0);
      _cachedSize.addAndGet(_length);
      _cachedFiles.incrementAndGet();
      _lastAccessed = System.currentTimeMillis();
    }
    
    public String getKey()
    {
      return _key;
    }
    
    public boolean isCached()
    {
      return _key != null;
    }
    
    public boolean isMiss()
    {
      return false;
    }
    
    public Resource getResource()
    {
      return _resource;
    }
    
    boolean isValid()
    {
      if (_lastModified == _resource.lastModified())
      {
        _lastAccessed = System.currentTimeMillis();
        return true;
      }
      if (this == _cache.remove(_key)) {
        invalidate();
      }
      return false;
    }
    
    protected void invalidate()
    {
      _cachedSize.addAndGet(-_length);
      _cachedFiles.decrementAndGet();
      _resource.release();
    }
    
    public Buffer getLastModified()
    {
      return _lastModifiedBytes;
    }
    
    public Buffer getContentType()
    {
      return _contentType;
    }
    
    public void release() {}
    
    public Buffer getIndirectBuffer()
    {
      Buffer buffer = (Buffer)_indirectBuffer.get();
      if (buffer == null)
      {
        Buffer buffer2 = getIndirectBuffer(_resource);
        if (buffer2 == null) {
          ResourceCache.LOG.warn("Could not load " + this, new Object[0]);
        } else if (_indirectBuffer.compareAndSet(null, buffer2)) {
          buffer = buffer2;
        } else {
          buffer = (Buffer)_indirectBuffer.get();
        }
      }
      if (buffer == null) {
        return null;
      }
      return new View(buffer);
    }
    
    public Buffer getDirectBuffer()
    {
      Buffer buffer = (Buffer)_directBuffer.get();
      if (buffer == null)
      {
        Buffer buffer2 = getDirectBuffer(_resource);
        if (buffer2 == null) {
          ResourceCache.LOG.warn("Could not load " + this, new Object[0]);
        } else if (_directBuffer.compareAndSet(null, buffer2)) {
          buffer = buffer2;
        } else {
          buffer = (Buffer)_directBuffer.get();
        }
      }
      if (buffer == null) {
        return null;
      }
      return new View(buffer);
    }
    
    public long getContentLength()
    {
      return _length;
    }
    
    public InputStream getInputStream()
      throws IOException
    {
      Buffer indirect = getIndirectBuffer();
      if ((indirect != null) && (indirect.array() != null)) {
        return new ByteArrayInputStream(indirect.array(), indirect.getIndex(), indirect.length());
      }
      return _resource.getInputStream();
    }
    
    public String toString()
    {
      return String.format("%s %s %d %s %s", new Object[] { _resource, Boolean.valueOf(_resource.exists()), Long.valueOf(_resource.lastModified()), _contentType, _lastModifiedBytes });
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.server.ResourceCache
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.server;

public abstract interface UserIdentity$UnauthenticatedUserIdentity
  extends UserIdentity
{}

/* Location:
 * Qualified Name:     org.eclipse.jetty.server.UserIdentity.UnauthenticatedUserIdentity
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.server;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public abstract interface Authentication$Deferred
  extends Authentication
{
  public abstract Authentication authenticate(ServletRequest paramServletRequest);
  
  public abstract Authentication authenticate(ServletRequest paramServletRequest, ServletResponse paramServletResponse);
  
  public abstract Authentication login(String paramString1, String paramString2);
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.server.Authentication.Deferred
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.server;

final class Authentication$5
  implements Authentication.SendSuccess
{
  public String toString()
  {
    return "SEND_SUCCESS";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.server.Authentication.5
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.server;

import java.io.IOException;
import java.util.Collection;
import javax.servlet.ServletResponse;
import javax.servlet.ServletResponseWrapper;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

public class ServletResponseHttpWrapper
  extends ServletResponseWrapper
  implements HttpServletResponse
{
  public ServletResponseHttpWrapper(ServletResponse response)
  {
    super(response);
  }
  
  public void addCookie(Cookie cookie) {}
  
  public boolean containsHeader(String name)
  {
    return false;
  }
  
  public String encodeURL(String url)
  {
    return null;
  }
  
  public String encodeRedirectURL(String url)
  {
    return null;
  }
  
  public String encodeUrl(String url)
  {
    return null;
  }
  
  public String encodeRedirectUrl(String url)
  {
    return null;
  }
  
  public void sendError(int sc, String msg)
    throws IOException
  {}
  
  public void sendError(int sc)
    throws IOException
  {}
  
  public void sendRedirect(String location)
    throws IOException
  {}
  
  public void setDateHeader(String name, long date) {}
  
  public void addDateHeader(String name, long date) {}
  
  public void setHeader(String name, String value) {}
  
  public void addHeader(String name, String value) {}
  
  public void setIntHeader(String name, int value) {}
  
  public void addIntHeader(String name, int value) {}
  
  public void setStatus(int sc) {}
  
  public void setStatus(int sc, String sm) {}
  
  public String getHeader(String name)
  {
    return null;
  }
  
  public Collection<String> getHeaderNames()
  {
    return null;
  }
  
  public Collection<String> getHeaders(String name)
  {
    return null;
  }
  
  public int getStatus()
  {
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.server.ServletResponseHttpWrapper
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.server;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jetty.http.HttpBuffers;
import org.eclipse.jetty.http.HttpBuffersImpl;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpHeaders;
import org.eclipse.jetty.io.Buffers;
import org.eclipse.jetty.io.Buffers.Type;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.statistic.CounterStatistic;
import org.eclipse.jetty.util.statistic.SampleStatistic;
import org.eclipse.jetty.util.thread.ThreadPool;

public abstract class AbstractConnector
  extends AggregateLifeCycle
  implements HttpBuffers, Connector, Dumpable
{
  private static final Logger LOG = Log.getLogger(AbstractConnector.class);
  private String _name;
  private Server _server;
  private ThreadPool _threadPool;
  private String _host;
  private int _port = 0;
  private String _integralScheme = "https";
  private int _integralPort = 0;
  private String _confidentialScheme = "https";
  private int _confidentialPort = 0;
  private int _acceptQueueSize = 0;
  private int _acceptors = 1;
  private int _acceptorPriorityOffset = 0;
  private boolean _useDNS;
  private boolean _forwarded;
  private String _hostHeader;
  private String _forwardedHostHeader = "X-Forwarded-Host";
  private String _forwardedServerHeader = "X-Forwarded-Server";
  private String _forwardedForHeader = "X-Forwarded-For";
  private String _forwardedProtoHeader = "X-Forwarded-Proto";
  private String _forwardedCipherSuiteHeader;
  private String _forwardedSslSessionIdHeader;
  private boolean _reuseAddress = true;
  protected int _maxIdleTime = 200000;
  protected int _lowResourceMaxIdleTime = -1;
  protected int _soLingerTime = -1;
  private transient Thread[] _acceptorThreads;
  private final AtomicLong _statsStartedAt = new AtomicLong(-1L);
  private final CounterStatistic _connectionStats = new CounterStatistic();
  private final SampleStatistic _requestStats = new SampleStatistic();
  private final SampleStatistic _connectionDurationStats = new SampleStatistic();
  protected final HttpBuffersImpl _buffers = new HttpBuffersImpl();
  
  public AbstractConnector()
  {
    addBean(_buffers);
  }
  
  public Server getServer()
  {
    return _server;
  }
  
  public void setServer(Server server)
  {
    _server = server;
  }
  
  public ThreadPool getThreadPool()
  {
    return _threadPool;
  }
  
  public void setThreadPool(ThreadPool pool)
  {
    removeBean(_threadPool);
    _threadPool = pool;
    addBean(_threadPool);
  }
  
  public void setHost(String host)
  {
    _host = host;
  }
  
  public String getHost()
  {
    return _host;
  }
  
  public void setPort(int port)
  {
    _port = port;
  }
  
  public int getPort()
  {
    return _port;
  }
  
  public int getMaxIdleTime()
  {
    return _maxIdleTime;
  }
  
  public void setMaxIdleTime(int maxIdleTime)
  {
    _maxIdleTime = maxIdleTime;
  }
  
  public int getLowResourcesMaxIdleTime()
  {
    return _lowResourceMaxIdleTime;
  }
  
  public void setLowResourcesMaxIdleTime(int maxIdleTime)
  {
    _lowResourceMaxIdleTime = maxIdleTime;
  }
  
  /**
   * @deprecated
   */
  public final int getLowResourceMaxIdleTime()
  {
    return getLowResourcesMaxIdleTime();
  }
  
  /**
   * @deprecated
   */
  public final void setLowResourceMaxIdleTime(int maxIdleTime)
  {
    setLowResourcesMaxIdleTime(maxIdleTime);
  }
  
  public int getSoLingerTime()
  {
    return _soLingerTime;
  }
  
  public int getAcceptQueueSize()
  {
    return _acceptQueueSize;
  }
  
  public void setAcceptQueueSize(int acceptQueueSize)
  {
    _acceptQueueSize = acceptQueueSize;
  }
  
  public int getAcceptors()
  {
    return _acceptors;
  }
  
  public void setAcceptors(int acceptors)
  {
    if (acceptors > 2 * Runtime.getRuntime().availableProcessors()) {
      LOG.warn("Acceptors should be <=2*availableProcessors: " + this, new Object[0]);
    }
    _acceptors = acceptors;
  }
  
  public void setSoLingerTime(int soLingerTime)
  {
    _soLingerTime = soLingerTime;
  }
  
  protected void doStart()
    throws Exception
  {
    if (_server == null) {
      throw new IllegalStateException("No server");
    }
    open();
    if (_threadPool == null)
    {
      _threadPool = _server.getThreadPool();
      addBean(_threadPool, false);
    }
    super.doStart();
    synchronized (this)
    {
      _acceptorThreads = new Thread[getAcceptors()];
      for (int i = 0; i < _acceptorThreads.length; i++) {
        if (!_threadPool.dispatch(new Acceptor(i))) {
          throw new IllegalStateException("!accepting");
        }
      }
      if (_threadPool.isLowOnThreads()) {
        LOG.warn("insufficient threads configured for {}", new Object[] { this });
      }
    }
    LOG.info("Started {}", new Object[] { this });
  }
  
  protected void doStop()
    throws Exception
  {
    try
    {
      close();
    }
    catch (IOException e)
    {
      LOG.warn(e);
    }
    super.doStop();
    Thread[] acceptors;
    synchronized (this)
    {
      acceptors = _acceptorThreads;
      _acceptorThreads = null;
    }
    if (acceptors != null) {
      for (Thread thread : acceptors) {
        if (thread != null) {
          thread.interrupt();
        }
      }
    }
  }
  
  public void join()
    throws InterruptedException
  {
    Thread[] threads;
    synchronized (this)
    {
      threads = _acceptorThreads;
    }
    if (threads != null) {
      for (Thread thread : threads) {
        if (thread != null) {
          thread.join();
        }
      }
    }
  }
  
  protected void configure(Socket socket)
    throws IOException
  {
    try
    {
      socket.setTcpNoDelay(true);
      if (_soLingerTime >= 0) {
        socket.setSoLinger(true, _soLingerTime / 1000);
      } else {
        socket.setSoLinger(false, 0);
      }
    }
    catch (Exception e)
    {
      LOG.ignore(e);
    }
  }
  
  public void customize(EndPoint endpoint, Request request)
    throws IOException
  {
    if (isForwarded()) {
      checkForwardedHeaders(endpoint, request);
    }
  }
  
  protected void checkForwardedHeaders(EndPoint endpoint, Request request)
    throws IOException
  {
    HttpFields httpFields = request.getConnection().getRequestFields();
    if (getForwardedCipherSuiteHeader() != null)
    {
      String cipher_suite = httpFields.getStringField(getForwardedCipherSuiteHeader());
      if (cipher_suite != null) {
        request.setAttribute("javax.servlet.request.cipher_suite", cipher_suite);
      }
    }
    if (getForwardedSslSessionIdHeader() != null)
    {
      String ssl_session_id = httpFields.getStringField(getForwardedSslSessionIdHeader());
      if (ssl_session_id != null)
      {
        request.setAttribute("javax.servlet.request.ssl_session_id", ssl_session_id);
        request.setScheme("https");
      }
    }
    String forwardedHost = getLeftMostFieldValue(httpFields, getForwardedHostHeader());
    String forwardedServer = getLeftMostFieldValue(httpFields, getForwardedServerHeader());
    String forwardedFor = getLeftMostFieldValue(httpFields, getForwardedForHeader());
    String forwardedProto = getLeftMostFieldValue(httpFields, getForwardedProtoHeader());
    if (_hostHeader != null)
    {
      httpFields.put(HttpHeaders.HOST_BUFFER, _hostHeader);
      request.setServerName(null);
      request.setServerPort(-1);
      request.getServerName();
    }
    else if (forwardedHost != null)
    {
      httpFields.put(HttpHeaders.HOST_BUFFER, forwardedHost);
      request.setServerName(null);
      request.setServerPort(-1);
      request.getServerName();
    }
    else if (forwardedServer != null)
    {
      request.setServerName(forwardedServer);
    }
    if (forwardedFor != null)
    {
      request.setRemoteAddr(forwardedFor);
      InetAddress inetAddress = null;
      if (_useDNS) {
        try
        {
          inetAddress = InetAddress.getByName(forwardedFor);
        }
        catch (UnknownHostException e)
        {
          LOG.ignore(e);
        }
      }
      request.setRemoteHost(inetAddress == null ? forwardedFor : inetAddress.getHostName());
    }
    if (forwardedProto != null) {
      request.setScheme(forwardedProto);
    }
  }
  
  protected String getLeftMostFieldValue(HttpFields fields, String header)
  {
    if (header == null) {
      return null;
    }
    String headerValue = fields.getStringField(header);
    if (headerValue == null) {
      return null;
    }
    int commaIndex = headerValue.indexOf(',');
    if (commaIndex == -1) {
      return headerValue;
    }
    return headerValue.substring(0, commaIndex);
  }
  
  public void persist(EndPoint endpoint)
    throws IOException
  {}
  
  public int getConfidentialPort()
  {
    return _confidentialPort;
  }
  
  public String getConfidentialScheme()
  {
    return _confidentialScheme;
  }
  
  public boolean isIntegral(Request request)
  {
    return false;
  }
  
  public int getIntegralPort()
  {
    return _integralPort;
  }
  
  public String getIntegralScheme()
  {
    return _integralScheme;
  }
  
  public boolean isConfidential(Request request)
  {
    return (_forwarded) && (request.getScheme().equalsIgnoreCase("https"));
  }
  
  public void setConfidentialPort(int confidentialPort)
  {
    _confidentialPort = confidentialPort;
  }
  
  public void setConfidentialScheme(String confidentialScheme)
  {
    _confidentialScheme = confidentialScheme;
  }
  
  public void setIntegralPort(int integralPort)
  {
    _integralPort = integralPort;
  }
  
  public void setIntegralScheme(String integralScheme)
  {
    _integralScheme = integralScheme;
  }
  
  protected abstract void accept(int paramInt)
    throws IOException, InterruptedException;
  
  public void stopAccept(int acceptorID)
    throws Exception
  {}
  
  public boolean getResolveNames()
  {
    return _useDNS;
  }
  
  public void setResolveNames(boolean resolve)
  {
    _useDNS = resolve;
  }
  
  public boolean isForwarded()
  {
    return _forwarded;
  }
  
  public void setForwarded(boolean check)
  {
    if (check) {
      LOG.debug("{} is forwarded", new Object[] { this });
    }
    _forwarded = check;
  }
  
  public String getHostHeader()
  {
    return _hostHeader;
  }
  
  public void setHostHeader(String hostHeader)
  {
    _hostHeader = hostHeader;
  }
  
  public String getForwardedHostHeader()
  {
    return _forwardedHostHeader;
  }
  
  public void setForwardedHostHeader(String forwardedHostHeader)
  {
    _forwardedHostHeader = forwardedHostHeader;
  }
  
  public String getForwardedServerHeader()
  {
    return _forwardedServerHeader;
  }
  
  public void setForwardedServerHeader(String forwardedServerHeader)
  {
    _forwardedServerHeader = forwardedServerHeader;
  }
  
  public String getForwardedForHeader()
  {
    return _forwardedForHeader;
  }
  
  public void setForwardedForHeader(String forwardedRemoteAddressHeader)
  {
    _forwardedForHeader = forwardedRemoteAddressHeader;
  }
  
  public String getForwardedProtoHeader()
  {
    return _forwardedProtoHeader;
  }
  
  public void setForwardedProtoHeader(String forwardedProtoHeader)
  {
    _forwardedProtoHeader = forwardedProtoHeader;
  }
  
  public String getForwardedCipherSuiteHeader()
  {
    return _forwardedCipherSuiteHeader;
  }
  
  public void setForwardedCipherSuiteHeader(String forwardedCipherSuite)
  {
    _forwardedCipherSuiteHeader = forwardedCipherSuite;
  }
  
  public String getForwardedSslSessionIdHeader()
  {
    return _forwardedSslSessionIdHeader;
  }
  
  public void setForwardedSslSessionIdHeader(String forwardedSslSessionId)
  {
    _forwardedSslSessionIdHeader = forwardedSslSessionId;
  }
  
  public int getRequestBufferSize()
  {
    return _buffers.getRequestBufferSize();
  }
  
  public void setRequestBufferSize(int requestBufferSize)
  {
    _buffers.setRequestBufferSize(requestBufferSize);
  }
  
  public int getRequestHeaderSize()
  {
    return _buffers.getRequestHeaderSize();
  }
  
  public void setRequestHeaderSize(int requestHeaderSize)
  {
    _buffers.setRequestHeaderSize(requestHeaderSize);
  }
  
  public int getResponseBufferSize()
  {
    return _buffers.getResponseBufferSize();
  }
  
  public void setResponseBufferSize(int responseBufferSize)
  {
    _buffers.setResponseBufferSize(responseBufferSize);
  }
  
  public int getResponseHeaderSize()
  {
    return _buffers.getResponseHeaderSize();
  }
  
  public void setResponseHeaderSize(int responseHeaderSize)
  {
    _buffers.setResponseHeaderSize(responseHeaderSize);
  }
  
  public Buffers.Type getRequestBufferType()
  {
    return _buffers.getRequestBufferType();
  }
  
  public Buffers.Type getRequestHeaderType()
  {
    return _buffers.getRequestHeaderType();
  }
  
  public Buffers.Type getResponseBufferType()
  {
    return _buffers.getResponseBufferType();
  }
  
  public Buffers.Type getResponseHeaderType()
  {
    return _buffers.getResponseHeaderType();
  }
  
  public void setRequestBuffers(Buffers requestBuffers)
  {
    _buffers.setRequestBuffers(requestBuffers);
  }
  
  public void setResponseBuffers(Buffers responseBuffers)
  {
    _buffers.setResponseBuffers(responseBuffers);
  }
  
  public Buffers getRequestBuffers()
  {
    return _buffers.getRequestBuffers();
  }
  
  public Buffers getResponseBuffers()
  {
    return _buffers.getResponseBuffers();
  }
  
  public void setMaxBuffers(int maxBuffers)
  {
    _buffers.setMaxBuffers(maxBuffers);
  }
  
  public int getMaxBuffers()
  {
    return _buffers.getMaxBuffers();
  }
  
  public String toString()
  {
    return String.format("%s@%s:%d", new Object[] { getClass().getSimpleName(), getHost() == null ? "0.0.0.0" : getHost(), Integer.valueOf(getLocalPort() <= 0 ? getPort() : getLocalPort()) });
  }
  
  private class Acceptor
    implements Runnable
  {
    int _acceptor = 0;
    
    Acceptor(int id)
    {
      _acceptor = id;
    }
    
    /* Error */
    public void run()
    {
      // Byte code:
      //   0: invokestatic 4	java/lang/Thread:currentThread	()Ljava/lang/Thread;
      //   3: astore_1
      //   4: aload_0
      //   5: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   8: dup
      //   9: astore_3
      //   10: monitorenter
      //   11: aload_0
      //   12: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   15: invokestatic 5	org/eclipse/jetty/server/AbstractConnector:access$000	(Lorg/eclipse/jetty/server/AbstractConnector;)[Ljava/lang/Thread;
      //   18: ifnonnull +6 -> 24
      //   21: aload_3
      //   22: monitorexit
      //   23: return
      //   24: aload_0
      //   25: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   28: invokestatic 5	org/eclipse/jetty/server/AbstractConnector:access$000	(Lorg/eclipse/jetty/server/AbstractConnector;)[Ljava/lang/Thread;
      //   31: aload_0
      //   32: getfield 3	org/eclipse/jetty/server/AbstractConnector$Acceptor:_acceptor	I
      //   35: aload_1
      //   36: aastore
      //   37: aload_0
      //   38: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   41: invokestatic 5	org/eclipse/jetty/server/AbstractConnector:access$000	(Lorg/eclipse/jetty/server/AbstractConnector;)[Ljava/lang/Thread;
      //   44: aload_0
      //   45: getfield 3	org/eclipse/jetty/server/AbstractConnector$Acceptor:_acceptor	I
      //   48: aaload
      //   49: invokevirtual 6	java/lang/Thread:getName	()Ljava/lang/String;
      //   52: astore_2
      //   53: aload_1
      //   54: new 7	java/lang/StringBuilder
      //   57: dup
      //   58: invokespecial 8	java/lang/StringBuilder:<init>	()V
      //   61: aload_2
      //   62: invokevirtual 9	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   65: ldc 10
      //   67: invokevirtual 9	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   70: aload_0
      //   71: getfield 3	org/eclipse/jetty/server/AbstractConnector$Acceptor:_acceptor	I
      //   74: invokevirtual 11	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
      //   77: ldc 12
      //   79: invokevirtual 9	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
      //   82: aload_0
      //   83: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   86: invokevirtual 13	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      //   89: invokevirtual 14	java/lang/StringBuilder:toString	()Ljava/lang/String;
      //   92: invokevirtual 15	java/lang/Thread:setName	(Ljava/lang/String;)V
      //   95: aload_3
      //   96: monitorexit
      //   97: goto +10 -> 107
      //   100: astore 4
      //   102: aload_3
      //   103: monitorexit
      //   104: aload 4
      //   106: athrow
      //   107: aload_1
      //   108: invokevirtual 16	java/lang/Thread:getPriority	()I
      //   111: istore_3
      //   112: aload_1
      //   113: iload_3
      //   114: aload_0
      //   115: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   118: invokestatic 17	org/eclipse/jetty/server/AbstractConnector:access$100	(Lorg/eclipse/jetty/server/AbstractConnector;)I
      //   121: isub
      //   122: invokevirtual 18	java/lang/Thread:setPriority	(I)V
      //   125: aload_0
      //   126: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   129: invokevirtual 19	org/eclipse/jetty/server/AbstractConnector:isRunning	()Z
      //   132: ifeq +87 -> 219
      //   135: aload_0
      //   136: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   139: invokevirtual 20	org/eclipse/jetty/server/AbstractConnector:getConnection	()Ljava/lang/Object;
      //   142: ifnull +77 -> 219
      //   145: aload_0
      //   146: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   149: aload_0
      //   150: getfield 3	org/eclipse/jetty/server/AbstractConnector$Acceptor:_acceptor	I
      //   153: invokevirtual 21	org/eclipse/jetty/server/AbstractConnector:accept	(I)V
      //   156: goto -31 -> 125
      //   159: astore 4
      //   161: invokestatic 23	org/eclipse/jetty/server/AbstractConnector:access$200	()Lorg/eclipse/jetty/util/log/Logger;
      //   164: aload 4
      //   166: invokeinterface 24 2 0
      //   171: goto -46 -> 125
      //   174: astore 4
      //   176: invokestatic 23	org/eclipse/jetty/server/AbstractConnector:access$200	()Lorg/eclipse/jetty/util/log/Logger;
      //   179: aload 4
      //   181: invokeinterface 24 2 0
      //   186: goto -61 -> 125
      //   189: astore 4
      //   191: invokestatic 23	org/eclipse/jetty/server/AbstractConnector:access$200	()Lorg/eclipse/jetty/util/log/Logger;
      //   194: aload 4
      //   196: invokeinterface 24 2 0
      //   201: goto -76 -> 125
      //   204: astore 4
      //   206: invokestatic 23	org/eclipse/jetty/server/AbstractConnector:access$200	()Lorg/eclipse/jetty/util/log/Logger;
      //   209: aload 4
      //   211: invokeinterface 28 2 0
      //   216: goto -91 -> 125
      //   219: aload_1
      //   220: iload_3
      //   221: invokevirtual 18	java/lang/Thread:setPriority	(I)V
      //   224: aload_1
      //   225: aload_2
      //   226: invokevirtual 15	java/lang/Thread:setName	(Ljava/lang/String;)V
      //   229: aload_0
      //   230: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   233: dup
      //   234: astore 4
      //   236: monitorenter
      //   237: aload_0
      //   238: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   241: invokestatic 5	org/eclipse/jetty/server/AbstractConnector:access$000	(Lorg/eclipse/jetty/server/AbstractConnector;)[Ljava/lang/Thread;
      //   244: ifnull +16 -> 260
      //   247: aload_0
      //   248: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   251: invokestatic 5	org/eclipse/jetty/server/AbstractConnector:access$000	(Lorg/eclipse/jetty/server/AbstractConnector;)[Ljava/lang/Thread;
      //   254: aload_0
      //   255: getfield 3	org/eclipse/jetty/server/AbstractConnector$Acceptor:_acceptor	I
      //   258: aconst_null
      //   259: aastore
      //   260: aload 4
      //   262: monitorexit
      //   263: goto +11 -> 274
      //   266: astore 5
      //   268: aload 4
      //   270: monitorexit
      //   271: aload 5
      //   273: athrow
      //   274: goto +63 -> 337
      //   277: astore 6
      //   279: aload_1
      //   280: iload_3
      //   281: invokevirtual 18	java/lang/Thread:setPriority	(I)V
      //   284: aload_1
      //   285: aload_2
      //   286: invokevirtual 15	java/lang/Thread:setName	(Ljava/lang/String;)V
      //   289: aload_0
      //   290: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   293: dup
      //   294: astore 7
      //   296: monitorenter
      //   297: aload_0
      //   298: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   301: invokestatic 5	org/eclipse/jetty/server/AbstractConnector:access$000	(Lorg/eclipse/jetty/server/AbstractConnector;)[Ljava/lang/Thread;
      //   304: ifnull +16 -> 320
      //   307: aload_0
      //   308: getfield 1	org/eclipse/jetty/server/AbstractConnector$Acceptor:this$0	Lorg/eclipse/jetty/server/AbstractConnector;
      //   311: invokestatic 5	org/eclipse/jetty/server/AbstractConnector:access$000	(Lorg/eclipse/jetty/server/AbstractConnector;)[Ljava/lang/Thread;
      //   314: aload_0
      //   315: getfield 3	org/eclipse/jetty/server/AbstractConnector$Acceptor:_acceptor	I
      //   318: aconst_null
      //   319: aastore
      //   320: aload 7
      //   322: monitorexit
      //   323: goto +11 -> 334
      //   326: astore 8
      //   328: aload 7
      //   330: monitorexit
      //   331: aload 8
      //   333: athrow
      //   334: aload 6
      //   336: athrow
      //   337: return
      // Line number table:
      //   Java source line #913	-> byte code offset #0
      //   Java source line #915	-> byte code offset #4
      //   Java source line #917	-> byte code offset #11
      //   Java source line #918	-> byte code offset #21
      //   Java source line #920	-> byte code offset #24
      //   Java source line #921	-> byte code offset #37
      //   Java source line #922	-> byte code offset #53
      //   Java source line #923	-> byte code offset #95
      //   Java source line #924	-> byte code offset #107
      //   Java source line #928	-> byte code offset #112
      //   Java source line #929	-> byte code offset #125
      //   Java source line #933	-> byte code offset #145
      //   Java source line #951	-> byte code offset #156
      //   Java source line #935	-> byte code offset #159
      //   Java source line #937	-> byte code offset #161
      //   Java source line #951	-> byte code offset #171
      //   Java source line #939	-> byte code offset #174
      //   Java source line #941	-> byte code offset #176
      //   Java source line #951	-> byte code offset #186
      //   Java source line #943	-> byte code offset #189
      //   Java source line #946	-> byte code offset #191
      //   Java source line #951	-> byte code offset #201
      //   Java source line #948	-> byte code offset #204
      //   Java source line #950	-> byte code offset #206
      //   Java source line #951	-> byte code offset #216
      //   Java source line #956	-> byte code offset #219
      //   Java source line #957	-> byte code offset #224
      //   Java source line #959	-> byte code offset #229
      //   Java source line #961	-> byte code offset #237
      //   Java source line #962	-> byte code offset #247
      //   Java source line #963	-> byte code offset #260
      //   Java source line #964	-> byte code offset #274
      //   Java source line #956	-> byte code offset #277
      //   Java source line #957	-> byte code offset #284
      //   Java source line #959	-> byte code offset #289
      //   Java source line #961	-> byte code offset #297
      //   Java source line #962	-> byte code offset #307
      //   Java source line #963	-> byte code offset #320
      //   Java source line #965	-> byte code offset #337
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	338	0	this	Acceptor
      //   3	282	1	current	Thread
      //   52	234	2	name	String
      //   9	94	3	Ljava/lang/Object;	Object
      //   111	170	3	old_priority	int
      //   100	5	4	localObject1	Object
      //   159	6	4	e	org.eclipse.jetty.io.EofException
      //   174	6	4	e	IOException
      //   189	6	4	x	InterruptedException
      //   204	6	4	e	Throwable
      //   266	6	5	localObject2	Object
      //   277	58	6	localObject3	Object
      //   326	6	8	localObject4	Object
      // Exception table:
   
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd