Mercurial Hosting > luan
changeset 929:3191abe890ef
remove isInitial()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 09 Oct 2016 19:13:46 -0600 |
parents | 23a57aad34c0 |
children | cd080b7bcf49 |
files | src/org/eclipse/jetty/continuation/Continuation.java src/org/eclipse/jetty/server/AbstractHttpConnection.java src/org/eclipse/jetty/server/AsyncContinuation.java src/org/eclipse/jetty/server/Server.java src/org/eclipse/jetty/server/handler/RequestLogHandler.java |
diffstat | 5 files changed, 31 insertions(+), 120 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/continuation/Continuation.java Sun Oct 09 18:54:32 2016 -0600 +++ b/src/org/eclipse/jetty/continuation/Continuation.java Sun Oct 09 19:13:46 2016 -0600 @@ -337,7 +337,7 @@ * thread has returned to the container after suspend has been * called and during any subsequent redispatch. */ - boolean isInitial(); +// boolean isInitial(); /* ------------------------------------------------------------ */ /**
--- a/src/org/eclipse/jetty/server/AbstractHttpConnection.java Sun Oct 09 18:54:32 2016 -0600 +++ b/src/org/eclipse/jetty/server/AbstractHttpConnection.java Sun Oct 09 19:13:46 2016 -0600 @@ -416,8 +416,8 @@ // within the call to unhandle(). final Server server=_server; - boolean handling = _request._async.handling() && server!=null && server.isRunning(); - if(handling) + _request._async.handling(); + if(server!=null && server.isRunning()) { _request.setHandled(false); @@ -454,17 +454,9 @@ if (_out!=null) _out.reopen(); - if (_request._async.isInitial()) - { - _request.setDispatcherType(DispatcherType.REQUEST); - _connector.customize(_endp, _request); - server.handle(this); - } - else - { - _request.setDispatcherType(DispatcherType.ASYNC); - server.handleAsync(this); - } + _request.setDispatcherType(DispatcherType.REQUEST); + _connector.customize(_endp, _request); + server.handle(this); } catch (ContinuationThrowable e) {
--- a/src/org/eclipse/jetty/server/AsyncContinuation.java Sun Oct 09 18:54:32 2016 -0600 +++ b/src/org/eclipse/jetty/server/AsyncContinuation.java Sun Oct 09 19:13:46 2016 -0600 @@ -81,7 +81,6 @@ /* ------------------------------------------------------------ */ private int _state; - private boolean _initial; private volatile boolean _responseWrapped; private long _timeoutMs=DEFAULT_TIMEOUT; private AsyncEventState _event; @@ -91,7 +90,6 @@ protected AsyncContinuation() { _state=__IDLE; - _initial=true; } /* ------------------------------------------------------------ */ @@ -178,18 +176,15 @@ return _responseWrapped; } - /* ------------------------------------------------------------ */ - /* (non-Javadoc) - * @see javax.servlet.ServletRequest#isInitial() - */ +/* public boolean isInitial() { synchronized(this) { - return _initial; + return true; } } - +*/ /* ------------------------------------------------------------ */ /* (non-Javadoc) * @see javax.servlet.ServletRequest#isSuspended() @@ -252,31 +247,22 @@ (_state==__DISPATCHED)?"DISPATCHED": (_state==__UNCOMPLETED)?"UNCOMPLETED": (_state==__COMPLETED)?"COMPLETE": - ("UNKNOWN?"+_state))+ - (_initial?",initial":""); + ("UNKNOWN?"+_state)); } } - /* ------------------------------------------------------------ */ - /** - * @return false if the handling of the request should not proceed - */ - protected boolean handling() + protected synchronized void handling() { - synchronized (this) + switch(_state) { - switch(_state) - { - case __IDLE: - _initial=true; - _state=__DISPATCHED; - if (_asyncListeners!=null) - _asyncListeners.clear(); - return true; - - default: - throw new IllegalStateException(this.getStatusString()); - } + case __IDLE: + _state=__DISPATCHED; + if (_asyncListeners!=null) + _asyncListeners.clear(); + return; + + default: + throw new IllegalStateException(this.getStatusString()); } } @@ -301,18 +287,9 @@ } } - /* ------------------------------------------------------------ */ public void dispatch() { - boolean dispatch=false; - synchronized (this) - { - switch(_state) - { - default: - throw new IllegalStateException(this.getStatusString()); - } - } + throw new UnsupportedOperationException(); } /* ------------------------------------------------------------ */ @@ -448,7 +425,6 @@ default: _state=__IDLE; } - _initial = true; _responseWrapped=false; cancelTimeout(); _timeoutMs=DEFAULT_TIMEOUT; @@ -494,19 +470,14 @@ } } - /* ------------------------------------------------------------ */ public void dispatch(ServletContext context, String path) { - _event._dispatchContext=context; - _event.setPath(path); - dispatch(); + throw new UnsupportedOperationException(); } - /* ------------------------------------------------------------ */ public void dispatch(String path) { - _event.setPath(path); - dispatch(); + throw new UnsupportedOperationException(); } /* ------------------------------------------------------------ */
--- a/src/org/eclipse/jetty/server/Server.java Sun Oct 09 18:54:32 2016 -0600 +++ b/src/org/eclipse/jetty/server/Server.java Sun Oct 09 19:13:46 2016 -0600 @@ -157,48 +157,6 @@ handle(target, request, request, response); } - /* ------------------------------------------------------------ */ - /* Handle a request from a connection. - * Called to handle a request on the connection when either the header has been received, - * or after the entire request has been received (for short requests of known length), or - * on the dispatch of an async request. - */ - public void handleAsync(AbstractHttpConnection connection) throws IOException, ServletException - { - final AsyncContinuation async = connection.getRequest().getAsyncContinuation(); - final AsyncContinuation.AsyncEventState state = async.getAsyncEventState(); - - final Request baseRequest=connection.getRequest(); - final String path=state.getPath(); - - if (path!=null) - { - // this is a dispatch with a path - final String contextPath=state.getServletContext().getContextPath(); - HttpURI uri = new HttpURI(URIUtil.addPaths(contextPath,path)); - baseRequest.setUri(uri); - baseRequest.setRequestURI(null); - baseRequest.setPathInfo(baseRequest.getRequestURI()); - if (uri.getQuery()!=null) - baseRequest.mergeQueryString(uri.getQuery()); //we have to assume dispatch path and query are UTF8 - } - - final String target=baseRequest.getPathInfo(); - final HttpServletRequest request=(HttpServletRequest)async.getRequest(); - final HttpServletResponse response=(HttpServletResponse)async.getResponse(); - - if (LOG.isDebugEnabled()) - { - LOG.debug("REQUEST "+target+" on "+connection); - handle(target, baseRequest, request, response); - LOG.debug("RESPONSE "+target+" "+connection.getResponse().getStatus()); - } - else - handle(target, baseRequest, request, response); - - } - - public void join() throws InterruptedException { threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
--- a/src/org/eclipse/jetty/server/handler/RequestLogHandler.java Sun Oct 09 18:54:32 2016 -0600 +++ b/src/org/eclipse/jetty/server/handler/RequestLogHandler.java Sun Oct 09 19:13:46 2016 -0600 @@ -35,8 +35,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.continuation.Continuation; -import org.eclipse.jetty.continuation.ContinuationListener; import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.server.AsyncContinuation; import org.eclipse.jetty.server.Request; @@ -65,11 +63,7 @@ public void handle(String target, final Request baseRequest, HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { - AsyncContinuation continuation = baseRequest.getAsyncContinuation(); - if (!continuation.isInitial()) - { - baseRequest.setDispatchTime(System.currentTimeMillis()); - } + baseRequest.setDispatchTime(System.currentTimeMillis()); try { @@ -173,17 +167,13 @@ buf.append(' '); buf.append(request.getProtocol()); buf.append("\" "); - if (request.getAsyncContinuation().isInitial()) - { - int status = response.getStatus(); - if (status <= 0) - status = 404; - buf.append((char)('0' + ((status / 100) % 10))); - buf.append((char)('0' + ((status / 10) % 10))); - buf.append((char)('0' + (status % 10))); - } - else - buf.append("Async"); + + int status = response.getStatus(); + if (status <= 0) + status = 404; + buf.append((char)('0' + ((status / 100) % 10))); + buf.append((char)('0' + ((status / 10) % 10))); + buf.append((char)('0' + (status % 10))); long responseLength = response.getContentCount(); if (responseLength >= 0)