org.eclipse.jetty.continuation_8.1.3.v20120522

16:45:22.429 INFO  jd.cli.Main - Decompiling org.eclipse.jetty.continuation_8.1.3.v20120522.jar
package org.eclipse.jetty.continuation;

import java.util.ArrayList;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletResponseWrapper;

class FauxContinuation
  implements ContinuationFilter.FilteredContinuation
{
  private static final ContinuationThrowable __exception = new ContinuationThrowable();
  private static final int __HANDLING = 1;
  private static final int __SUSPENDING = 2;
  private static final int __RESUMING = 3;
  private static final int __COMPLETING = 4;
  private static final int __SUSPENDED = 5;
  private static final int __UNSUSPENDING = 6;
  private static final int __COMPLETE = 7;
  private final ServletRequest _request;
  private ServletResponse _response;
  private int _state = 1;
  private boolean _initial = true;
  private boolean _resumed = false;
  private boolean _timeout = false;
  private boolean _responseWrapped = false;
  private long _timeoutMs = 30000L;
  private ArrayList<ContinuationListener> _listeners;
  
  FauxContinuation(ServletRequest request)
  {
    _request = request;
  }
  
  public void onComplete()
  {
    if (_listeners != null) {
      for (ContinuationListener l : _listeners) {
        l.onComplete(this);
      }
    }
  }
  
  public void onTimeout()
  {
    if (_listeners != null) {
      for (ContinuationListener l : _listeners) {
        l.onTimeout(this);
      }
    }
  }
  
  public boolean isResponseWrapped()
  {
    return _responseWrapped;
  }
  
  /* Error */
  public boolean isInitial()
  {
    // Byte code:
    //   0: aload_0
    //   1: dup
    //   2: astore_1
    //   3: monitorenter
    //   4: aload_0
    //   5: getfield 202	org/eclipse/jetty/continuation/FauxContinuation:_initial	Z
    //   8: aload_1
    //   9: monitorexit
    //   10: ireturn
    //   11: astore_2
    //   12: aload_1
    //   13: monitorexit
    //   14: aload_2
    //   15: athrow
    // Line number table:
    //   Java source line #91	-> byte code offset #0
    //   Java source line #93	-> byte code offset #4
    //   Java source line #94	-> byte code offset #11
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	16	0	this	FauxContinuation
    //   2	11	1	Ljava/lang/Object;	Object
    //   11	4	2	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   4	10	11	finally
    //   11	14	11	finally
  }
  
  /* Error */
  public boolean isResumed()
  {
    // Byte code:
    //   0: aload_0
    //   1: dup
    //   2: astore_1
    //   3: monitorenter
    //   4: aload_0
    //   5: getfield 204	org/eclipse/jetty/continuation/FauxContinuation:_resumed	Z
    //   8: aload_1
    //   9: monitorexit
    //   10: ireturn
    //   11: astore_2
    //   12: aload_1
    //   13: monitorexit
    //   14: aload_2
    //   15: athrow
    // Line number table:
    //   Java source line #100	-> byte code offset #0
    //   Java source line #102	-> byte code offset #4
    //   Java source line #103	-> byte code offset #11
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	16	0	this	FauxContinuation
    //   2	11	1	Ljava/lang/Object;	Object
    //   11	4	2	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   4	10	11	finally
    //   11	14	11	finally
  }
  
  public boolean isSuspended()
  {
    synchronized (this)
    {
      switch (_state)
      {
      case 1: 
        return false;
      case 2: 
      case 3: 
      case 4: 
      case 5: 
        return true;
      }
      return false;
    }
  }
  
  /* Error */
  public boolean isExpired()
  {
    // Byte code:
    //   0: aload_0
    //   1: dup
    //   2: astore_1
    //   3: monitorenter
    //   4: aload_0
    //   5: getfield 205	org/eclipse/jetty/continuation/FauxContinuation:_timeout	Z
    //   8: aload_1
    //   9: monitorexit
    //   10: ireturn
    //   11: astore_2
    //   12: aload_1
    //   13: monitorexit
    //   14: aload_2
    //   15: athrow
    // Line number table:
    //   Java source line #130	-> byte code offset #0
    //   Java source line #132	-> byte code offset #4
    //   Java source line #133	-> byte code offset #11
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	16	0	this	FauxContinuation
    //   2	11	1	Ljava/lang/Object;	Object
    //   11	4	2	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   4	10	11	finally
    //   11	14	11	finally
  }
  
  public void setTimeout(long timeoutMs)
  {
    _timeoutMs = timeoutMs;
  }
  
  public void suspend(ServletResponse response)
  {
    _response = response;
    _responseWrapped = (response instanceof ServletResponseWrapper);
    suspend();
  }
  
  public void suspend()
  {
    synchronized (this)
    {
      switch (_state)
      {
      case 1: 
        _timeout = false;
        _resumed = false;
        _state = 2;
        return;
      case 2: 
      case 3: 
        return;
      case 4: 
      case 5: 
      case 6: 
        throw new IllegalStateException(getStatusString());
      }
      throw new IllegalStateException("" + _state);
    }
  }
  
  public void resume()
  {
    synchronized (this)
    {
      switch (_state)
      {
      case 1: 
        _resumed = true;
        return;
      case 2: 
        _resumed = true;
        _state = 3;
        return;
      case 3: 
      case 4: 
        
      case 5: 
        fauxResume();
        _resumed = true;
        _state = 6;
        break;
      case 6: 
        _resumed = true;
        return;
      default: 
        throw new IllegalStateException(getStatusString());
      }
    }
  }
  
  public void complete()
  {
    synchronized (this)
    {
      switch (_state)
      {
      case 1: 
        throw new IllegalStateException(getStatusString());
      case 2: 
        _state = 4;
        break;
      case 3: 
        break;
      case 4: 
        
      case 5: 
        _state = 4;
        fauxResume();
        break;
      case 6: 
        
      default: 
        throw new IllegalStateException(getStatusString());
      }
    }
  }
  
  public boolean enter(ServletResponse response)
  {
    _response = response;
    return true;
  }
  
  public ServletResponse getServletResponse()
  {
    return _response;
  }
  
  void handling()
  {
    synchronized (this)
    {
      _responseWrapped = false;
      switch (_state)
      {
      case 1: 
        throw new IllegalStateException(getStatusString());
      case 2: 
      case 3: 
        throw new IllegalStateException(getStatusString());
      case 4: 
        return;
      case 5: 
        fauxResume();
      case 6: 
        _state = 1;
        return;
      }
      throw new IllegalStateException("" + _state);
    }
  }
  
  public boolean exit()
  {
    synchronized (this)
    {
      switch (_state)
      {
      case 1: 
        _state = 7;
        onComplete();
        return true;
      case 2: 
        _initial = false;
        _state = 5;
        fauxSuspend();
        if ((_state == 5) || (_state == 4))
        {
          onComplete();
          return true;
        }
        _initial = false;
        _state = 1;
        return false;
      case 3: 
        _initial = false;
        _state = 1;
        return false;
      case 4: 
        _initial = false;
        _state = 7;
        onComplete();
        return true;
      }
      throw new IllegalStateException(getStatusString());
    }
  }
  
  protected void expire()
  {
    synchronized (this)
    {
      _timeout = true;
    }
    onTimeout();
    synchronized (this)
    {
      switch (_state)
      {
      case 1: 
        
      case 2: 
        _timeout = true;
        _state = 3;
        fauxResume();
        return;
      case 3: 
        
      case 4: 
        
      case 5: 
        _timeout = true;
        _state = 6;
        break;
      case 6: 
        _timeout = true;
        return;
      default: 
        throw new IllegalStateException(getStatusString());
      }
    }
  }
  
  private void fauxSuspend()
  {
    long expire_at = System.currentTimeMillis() + _timeoutMs;
    long wait = _timeoutMs;
    while ((_timeoutMs > 0L) && (wait > 0L))
    {
      try
      {
        wait(wait);
      }
      catch (InterruptedException e)
      {
        break;
      }
      wait = expire_at - System.currentTimeMillis();
    }
    if ((_timeoutMs > 0L) && (wait <= 0L)) {
      expire();
    }
  }
  
  private void fauxResume()
  {
    _timeoutMs = 0L;
    notifyAll();
  }
  
  public String toString()
  {
    return getStatusString();
  }
  
  String getStatusString()
  {
    synchronized (this)
    {
      return (_state == 4 ? "COMPLETING" : _state == 6 ? "UNSUSPENDING" : _state == 3 ? "RESUMING" : _state == 5 ? "SUSPENDED" : _state == 2 ? "SUSPENDING" : _state == 1 ? "HANDLING" : new StringBuilder().append("???").append(_state).toString()) + (_initial ? ",initial" : "") + (_resumed ? ",resumed" : "") + (_timeout ? ",timeout" : "");
    }
  }
  
  public void addContinuationListener(ContinuationListener listener)
  {
    if (_listeners == null) {
      _listeners = new ArrayList();
    }
    _listeners.add(listener);
  }
  
  public Object getAttribute(String name)
  {
    return _request.getAttribute(name);
  }
  
  public void removeAttribute(String name)
  {
    _request.removeAttribute(name);
  }
  
  public void setAttribute(String name, Object attribute)
  {
    _request.setAttribute(name, attribute);
  }
  
  public void undispatch()
  {
    if (isSuspended())
    {
      if (ContinuationFilter.__debug) {
        throw new ContinuationThrowable();
      }
      throw __exception;
    }
    throw new IllegalStateException("!suspended");
  }
}

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

import java.io.IOException;
import javax.servlet.AsyncContext;
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;

class Servlet3Continuation$1
  implements AsyncListener
{
  Servlet3Continuation$1(Servlet3Continuation paramServlet3Continuation) {}
  
  public void onComplete(AsyncEvent event)
    throws IOException
  {}
  
  public void onError(AsyncEvent event)
    throws IOException
  {}
  
  public void onStartAsync(AsyncEvent event)
    throws IOException
  {
    event.getAsyncContext().addListener(this);
  }
  
  public void onTimeout(AsyncEvent event)
    throws IOException
  {
    Servlet3Continuation.access$002(this$0, false);
    event.getAsyncContext().dispatch();
  }
}

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

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.AsyncContext;
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
import javax.servlet.DispatcherType;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletResponseWrapper;

public class Servlet3Continuation
  implements Continuation
{
  private static final ContinuationThrowable __exception = new ContinuationThrowable();
  private final ServletRequest _request;
  private ServletResponse _response;
  private AsyncContext _context;
  private List<AsyncListener> _listeners = new ArrayList();
  private volatile boolean _initial = true;
  private volatile boolean _resumed = false;
  private volatile boolean _expired = false;
  private volatile boolean _responseWrapped = false;
  private long _timeoutMs = -1L;
  
  public Servlet3Continuation(ServletRequest request)
  {
    _request = request;
    
    _listeners.add(new AsyncListener()
    {
      public void onComplete(AsyncEvent event)
        throws IOException
      {}
      
      public void onError(AsyncEvent event)
        throws IOException
      {}
      
      public void onStartAsync(AsyncEvent event)
        throws IOException
      {
        event.getAsyncContext().addListener(this);
      }
      
      public void onTimeout(AsyncEvent event)
        throws IOException
      {
        _initial = false;
        event.getAsyncContext().dispatch();
      }
    });
  }
  
  public void addContinuationListener(final ContinuationListener listener)
  {
    AsyncListener wrapped = new AsyncListener()
    {
      public void onComplete(AsyncEvent event)
        throws IOException
      {
        listener.onComplete(Servlet3Continuation.this);
      }
      
      public void onError(AsyncEvent event)
        throws IOException
      {
        listener.onComplete(Servlet3Continuation.this);
      }
      
      public void onStartAsync(AsyncEvent event)
        throws IOException
      {
        event.getAsyncContext().addListener(this);
      }
      
      public void onTimeout(AsyncEvent event)
        throws IOException
      {
        _expired = true;
        listener.onTimeout(Servlet3Continuation.this);
      }
    };
    if (_context != null) {
      _context.addListener(wrapped);
    } else {
      _listeners.add(wrapped);
    }
  }
  
  public void complete()
  {
    AsyncContext context = _context;
    if (context == null) {
      throw new IllegalStateException();
    }
    _context.complete();
  }
  
  public ServletResponse getServletResponse()
  {
    return _response;
  }
  
  public boolean isExpired()
  {
    return _expired;
  }
  
  public boolean isInitial()
  {
    return (_initial) && (_request.getDispatcherType() != DispatcherType.ASYNC);
  }
  
  public boolean isResumed()
  {
    return _resumed;
  }
  
  public boolean isSuspended()
  {
    return _request.isAsyncStarted();
  }
  
  public void keepWrappers()
  {
    _responseWrapped = true;
  }
  
  public void resume()
  {
    AsyncContext context = _context;
    if (context == null) {
      throw new IllegalStateException();
    }
    _resumed = true;
    _context.dispatch();
  }
  
  public void setTimeout(long timeoutMs)
  {
    _timeoutMs = timeoutMs;
    if (_context != null) {
      _context.setTimeout(timeoutMs);
    }
  }
  
  public void suspend(ServletResponse response)
  {
    _response = response;
    _responseWrapped = (response instanceof ServletResponseWrapper);
    _resumed = false;
    _expired = false;
    _context = _request.startAsync();
    _context.setTimeout(_timeoutMs);
    for (AsyncListener listener : _listeners) {
      _context.addListener(listener);
    }
    _listeners.clear();
  }
  
  public void suspend()
  {
    _resumed = false;
    _expired = false;
    _context = _request.startAsync();
    _context.setTimeout(_timeoutMs);
    for (AsyncListener listener : _listeners) {
      _context.addListener(listener);
    }
    _listeners.clear();
  }
  
  public boolean isResponseWrapped()
  {
    return _responseWrapped;
  }
  
  public Object getAttribute(String name)
  {
    return _request.getAttribute(name);
  }
  
  public void removeAttribute(String name)
  {
    _request.removeAttribute(name);
  }
  
  public void setAttribute(String name, Object attribute)
  {
    _request.setAttribute(name, attribute);
  }
  
  public void undispatch()
  {
    if (isSuspended())
    {
      if (ContinuationFilter.__debug) {
        throw new ContinuationThrowable();
      }
      throw __exception;
    }
    throw new IllegalStateException("!suspended");
  }
}

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

import java.util.EventListener;

public abstract interface ContinuationListener
  extends EventListener
{
  public abstract void onComplete(Continuation paramContinuation);
  
  public abstract void onTimeout(Continuation paramContinuation);
}

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

import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletResponseWrapper;
import org.mortbay.log.Log;
import org.mortbay.log.Logger;
import org.mortbay.util.ajax.Continuation;

public class Jetty6Continuation
  implements ContinuationFilter.FilteredContinuation
{
  private static final Logger LOG = Log.getLogger(Jetty6Continuation.class.getName());
  private static final ContinuationThrowable __exception = new ContinuationThrowable();
  private final ServletRequest _request;
  private ServletResponse _response;
  private final Continuation _j6Continuation;
  private Throwable _retry;
  private int _timeout;
  private boolean _initial = true;
  private volatile boolean _completed = false;
  private volatile boolean _resumed = false;
  private volatile boolean _expired = false;
  private boolean _responseWrapped = false;
  private List<ContinuationListener> _listeners;
  
  public Jetty6Continuation(ServletRequest request, Continuation continuation)
  {
    if (!ContinuationFilter._initialized)
    {
      LOG.warn("!ContinuationFilter installed", null, null);
      throw new IllegalStateException("!ContinuationFilter installed");
    }
    _request = request;
    _j6Continuation = continuation;
  }
  
  public void addContinuationListener(ContinuationListener listener)
  {
    if (_listeners == null) {
      _listeners = new ArrayList();
    }
    _listeners.add(listener);
  }
  
  public void complete()
  {
    synchronized (this)
    {
      if (_resumed) {
        throw new IllegalStateException();
      }
      _completed = true;
      if (_j6Continuation.isPending()) {
        _j6Continuation.resume();
      }
    }
  }
  
  public Object getAttribute(String name)
  {
    return _request.getAttribute(name);
  }
  
  public void removeAttribute(String name)
  {
    _request.removeAttribute(name);
  }
  
  public void setAttribute(String name, Object attribute)
  {
    _request.setAttribute(name, attribute);
  }
  
  public ServletResponse getServletResponse()
  {
    return _response;
  }
  
  public boolean isExpired()
  {
    return _expired;
  }
  
  public boolean isInitial()
  {
    return _initial;
  }
  
  public boolean isResumed()
  {
    return _resumed;
  }
  
  public boolean isSuspended()
  {
    return _retry != null;
  }
  
  public void resume()
  {
    synchronized (this)
    {
      if (_completed) {
        throw new IllegalStateException();
      }
      _resumed = true;
      if (_j6Continuation.isPending()) {
        _j6Continuation.resume();
      }
    }
  }
  
  public void setTimeout(long timeoutMs)
  {
    _timeout = (timeoutMs > 2147483647L ? Integer.MAX_VALUE : (int)timeoutMs);
  }
  
  public void suspend(ServletResponse response)
  {
    try
    {
      _response = response;
      _responseWrapped = (_response instanceof ServletResponseWrapper);
      _resumed = false;
      _expired = false;
      _completed = false;
      _j6Continuation.suspend(_timeout);
    }
    catch (Throwable retry)
    {
      _retry = retry;
    }
  }
  
  public void suspend()
  {
    try
    {
      _response = null;
      _responseWrapped = false;
      _resumed = false;
      _expired = false;
      _completed = false;
      _j6Continuation.suspend(_timeout);
    }
    catch (Throwable retry)
    {
      _retry = retry;
    }
  }
  
  public boolean isResponseWrapped()
  {
    return _responseWrapped;
  }
  
  public void undispatch()
  {
    if (isSuspended())
    {
      if (ContinuationFilter.__debug) {
        throw new ContinuationThrowable();
      }
      throw __exception;
    }
    throw new IllegalStateException("!suspended");
  }
  
  public boolean enter(ServletResponse response)
  {
    _response = response;
    _expired = (!_j6Continuation.isResumed());
    if (_initial) {
      return true;
    }
    _j6Continuation.reset();
    if (_expired) {
      if (_listeners != null) {
        for (ContinuationListener l : _listeners) {
          l.onTimeout(this);
        }
      }
    }
    return !_completed;
  }
  
  public boolean exit()
  {
    _initial = false;
    
    Throwable th = _retry;
    _retry = null;
    if ((th instanceof Error)) {
      throw ((Error)th);
    }
    if ((th instanceof RuntimeException)) {
      throw ((RuntimeException)th);
    }
    if (_listeners != null) {
      for (ContinuationListener l : _listeners) {
        l.onComplete(this);
      }
    }
    return true;
  }
}

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

import java.io.IOException;
import javax.servlet.AsyncContext;
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;

class Servlet3Continuation$2
  implements AsyncListener
{
  Servlet3Continuation$2(Servlet3Continuation paramServlet3Continuation, ContinuationListener paramContinuationListener) {}
  
  public void onComplete(AsyncEvent event)
    throws IOException
  {
    val$listener.onComplete(this$0);
  }
  
  public void onError(AsyncEvent event)
    throws IOException
  {
    val$listener.onComplete(this$0);
  }
  
  public void onStartAsync(AsyncEvent event)
    throws IOException
  {
    event.getAsyncContext().addListener(this);
  }
  
  public void onTimeout(AsyncEvent event)
    throws IOException
  {
    Servlet3Continuation.access$102(this$0, true);
    val$listener.onTimeout(this$0);
  }
}

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

import java.lang.reflect.Constructor;
import javax.servlet.ServletRequest;
import javax.servlet.ServletRequestWrapper;
import javax.servlet.ServletResponse;

public class ContinuationSupport
{
  static final boolean __jetty6;
  static final boolean __servlet3;
  static final Class<?> __waitingContinuation;
  static final Constructor<? extends Continuation> __newServlet3Continuation;
  static final Constructor<? extends Continuation> __newJetty6Continuation;
  
  static
  {
    boolean servlet3Support = false;
    Constructor<? extends Continuation> s3cc = null;
    try
    {
      boolean servlet3 = ServletRequest.class.getMethod("startAsync", new Class[0]) != null;
      if (servlet3)
      {
        Class<? extends Continuation> s3c = ContinuationSupport.class.getClassLoader().loadClass("org.eclipse.jetty.continuation.Servlet3Continuation").asSubclass(Continuation.class);
        s3cc = s3c.getConstructor(new Class[] { ServletRequest.class });
        servlet3Support = true;
      }
    }
    catch (Exception e) {}finally
    {
      __servlet3 = servlet3Support;
      __newServlet3Continuation = s3cc;
    }
    boolean jetty6Support = false;
    Constructor<? extends Continuation> j6cc = null;
    try
    {
      Object jetty6ContinuationClass = ContinuationSupport.class.getClassLoader().loadClass("org.mortbay.util.ajax.Continuation");
      boolean jetty6 = jetty6ContinuationClass != null;
      if (jetty6)
      {
        Class<? extends Continuation> j6c = ContinuationSupport.class.getClassLoader().loadClass("org.eclipse.jetty.continuation.Jetty6Continuation").asSubclass(Continuation.class);
        j6cc = j6c.getConstructor(new Class[] { ServletRequest.class, jetty6ContinuationClass });
        jetty6Support = true;
      }
    }
    catch (Exception e) {}finally
    {
      __jetty6 = jetty6Support;
      __newJetty6Continuation = j6cc;
    }
    Object waiting = null;
    try
    {
      waiting = ContinuationSupport.class.getClassLoader().loadClass("org.mortbay.util.ajax.WaitingContinuation");
    }
    catch (Exception e) {}finally
    {
      __waitingContinuation = (Class)waiting;
    }
  }
  
  public static Continuation getContinuation(ServletRequest request)
  {
    Continuation continuation = (Continuation)request.getAttribute("org.eclipse.jetty.continuation");
    if (continuation != null) {
      return continuation;
    }
    while ((request instanceof ServletRequestWrapper)) {
      request = ((ServletRequestWrapper)request).getRequest();
    }
    if (__servlet3) {
      try
      {
        continuation = (Continuation)__newServlet3Continuation.newInstance(new Object[] { request });
        request.setAttribute("org.eclipse.jetty.continuation", continuation);
        return continuation;
      }
      catch (Exception e)
      {
        throw new RuntimeException(e);
      }
    }
    if (__jetty6)
    {
      Object c = request.getAttribute("org.mortbay.jetty.ajax.Continuation");
      try
      {
        if ((c == null) || (__waitingContinuation == null) || (__waitingContinuation.isInstance(c))) {
          continuation = new FauxContinuation(request);
        } else {
          continuation = (Continuation)__newJetty6Continuation.newInstance(new Object[] { request, c });
        }
        request.setAttribute("org.eclipse.jetty.continuation", continuation);
        return continuation;
      }
      catch (Exception e)
      {
        throw new RuntimeException(e);
      }
    }
    throw new IllegalStateException("!(Jetty || Servlet 3.0 || ContinuationFilter)");
  }
  
  @Deprecated
  public static Continuation getContinuation(ServletRequest request, ServletResponse response)
  {
    return getContinuation(request);
  }
}

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

import javax.servlet.ServletResponse;

public abstract interface Continuation
{
  public static final String ATTRIBUTE = "org.eclipse.jetty.continuation";
  
  public abstract void setTimeout(long paramLong);
  
  public abstract void suspend();
  
  public abstract void suspend(ServletResponse paramServletResponse);
  
  public abstract void resume();
  
  public abstract void complete();
  
  public abstract boolean isSuspended();
  
  public abstract boolean isResumed();
  
  public abstract boolean isExpired();
  
  public abstract boolean isInitial();
  
  public abstract boolean isResponseWrapped();
  
  public abstract ServletResponse getServletResponse();
  
  public abstract void addContinuationListener(ContinuationListener paramContinuationListener);
  
  public abstract void setAttribute(String paramString, Object paramObject);
  
  public abstract Object getAttribute(String paramString);
  
  public abstract void removeAttribute(String paramString);
  
  public abstract void undispatch()
    throws ContinuationThrowable;
}

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

public class ContinuationThrowable
  extends Error
{}

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

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class ContinuationFilter
  implements Filter
{
  static boolean _initialized;
  static boolean __debug;
  private boolean _faux;
  private boolean _jetty6;
  private boolean _filtered;
  ServletContext _context;
  private boolean _debug;
  
  public void init(FilterConfig filterConfig)
    throws ServletException
  {
    boolean jetty_7_or_greater = "org.eclipse.jetty.servlet".equals(filterConfig.getClass().getPackage().getName());
    _context = filterConfig.getServletContext();
    
    String param = filterConfig.getInitParameter("debug");
    _debug = ((param != null) && (Boolean.parseBoolean(param)));
    if (_debug) {
      __debug = true;
    }
    param = filterConfig.getInitParameter("jetty6");
    if (param == null) {
      param = filterConfig.getInitParameter("partial");
    }
    if (param != null) {
      _jetty6 = Boolean.parseBoolean(param);
    } else {
      _jetty6 = ((ContinuationSupport.__jetty6) && (!jetty_7_or_greater));
    }
    param = filterConfig.getInitParameter("faux");
    if (param != null) {
      _faux = Boolean.parseBoolean(param);
    } else {
      _faux = ((!jetty_7_or_greater) && (!_jetty6) && (_context.getMajorVersion() < 3));
    }
    _filtered = ((_faux) || (_jetty6));
    if (_debug) {
      _context.log("ContinuationFilter  jetty=" + jetty_7_or_greater + " jetty6=" + _jetty6 + " faux=" + _faux + " filtered=" + _filtered + " servlet3=" + ContinuationSupport.__servlet3);
    }
    _initialized = true;
  }
  
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
    throws IOException, ServletException
  {
    if (_filtered)
    {
      Continuation c = (Continuation)request.getAttribute("org.eclipse.jetty.continuation");
      FilteredContinuation fc;
      if ((_faux) && ((c == null) || (!(c instanceof FauxContinuation))))
      {
        FilteredContinuation fc = new FauxContinuation(request);
        request.setAttribute("org.eclipse.jetty.continuation", fc);
      }
      else
      {
        fc = (FilteredContinuation)c;
      }
      boolean complete = false;
      while (!complete) {
        try
        {
          if ((fc == null) || (fc.enter(response))) {
            chain.doFilter(request, response);
          }
        }
        catch (ContinuationThrowable e)
        {
          debug("faux", e);
        }
        finally
        {
          if (fc == null) {
            fc = (FilteredContinuation)request.getAttribute("org.eclipse.jetty.continuation");
          }
          complete = (fc == null) || (fc.exit());
        }
      }
    }
    else
    {
      try
      {
        chain.doFilter(request, response);
      }
      catch (ContinuationThrowable e)
      {
        debug("caught", e);
      }
    }
  }
  
  private void debug(String string)
  {
    if (_debug) {
      _context.log(string);
    }
  }
  
  private void debug(String string, Throwable th)
  {
    if (_debug) {
      if ((th instanceof ContinuationThrowable)) {
        _context.log(string + ":" + th);
      } else {
        _context.log(string, th);
      }
    }
  }
  
  public void destroy() {}
  
  public static abstract interface FilteredContinuation
    extends Continuation
  {
    public abstract boolean enter(ServletResponse paramServletResponse);
    
    public abstract boolean exit();
  }
}

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

import javax.servlet.ServletResponse;

public abstract interface ContinuationFilter$FilteredContinuation
  extends Continuation
{
  public abstract boolean enter(ServletResponse paramServletResponse);
  
  public abstract boolean exit();
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.continuation.ContinuationFilter.FilteredContinuation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

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