Author: markt Date: Sat Nov 24 17:11:29 2012 New Revision: 1413205 URL: http://svn.apache.org/viewvc?rev=1413205&view=rev Log: Change Request API to use Servlet 3.1 API for HTTP Upgrade - WebSocket is now broken - Upgrade process is broken / incomplete
Modified: tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java tomcat/trunk/java/org/apache/catalina/connector/Request.java tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java Modified: tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java?rev=1413205&r1=1413204&r2=1413205&view=diff ============================================================================== --- tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java (original) +++ tomcat/trunk/java/javax/servlet/http/HttpServletRequest.java Sat Nov 24 17:11:29 2012 @@ -494,7 +494,10 @@ public interface HttpServletRequest exte /** * Start the HTTP upgrade process and pass the connection to the provided * protocol handler once the current request/response pair has completed - * processing. + * processing. Calling this method sets the response status to {@link + * HttpServletResponse#SC_SWITCHING_PROTOCOLS} and flushes the response. + * Protocol specific headers must have already been set before this method + * is called. * * @since Servlet 3.1 */ Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1413205&r1=1413204&r2=1413205&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Sat Nov 24 17:11:29 2012 @@ -76,7 +76,6 @@ import org.apache.catalina.mapper.Mappin import org.apache.catalina.util.ParameterMap; import org.apache.catalina.util.StringParser; import org.apache.coyote.ActionCode; -import org.apache.coyote.http11.upgrade.UpgradeInbound; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.ExceptionUtils; @@ -1862,12 +1861,18 @@ public class Request // --------------------------------------------- HttpServletRequest Methods /** - * TODO SERVLET 3.1 + * {@inheritDoc} + * + * @since Servlet 3.1 */ @Override public void upgrade(ProtocolHandler handler) throws IOException { - // TODO Auto-generated method stub + coyoteRequest.action(ActionCode.UPGRADE, handler); + // Output required by RFC2616. Protocol specific headers should have + // already been set. + response.setStatus(HttpServletResponse.SC_SWITCHING_PROTOCOLS); + response.flushBuffer(); } /** @@ -2639,23 +2644,8 @@ public class Request } - // --------------------------------------------------------- Upgrade Methods - - public void doUpgrade(UpgradeInbound inbound) - throws IOException { - - coyoteRequest.action(ActionCode.UPGRADE, inbound); - - // Output required by RFC2616. Protocol specific headers should have - // already been set. - response.setStatus(HttpServletResponse.SC_SWITCHING_PROTOCOLS); - response.flushBuffer(); - } - - // ------------------------------------------------------ Protected Methods - protected Session doGetSession(boolean create) { // There cannot be a session if no context has been assigned yet Modified: tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java?rev=1413205&r1=1413204&r2=1413205&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java Sat Nov 24 17:11:29 2012 @@ -42,7 +42,6 @@ import javax.servlet.http.ProtocolHandle import org.apache.catalina.Globals; import org.apache.catalina.security.SecurityUtil; -import org.apache.coyote.http11.upgrade.UpgradeInbound; import org.apache.tomcat.util.res.StringManager; /** @@ -1088,37 +1087,22 @@ public class RequestFacade implements Ht } /** - * Sets the response status to {@link - * HttpServletResponse#SC_SWITCHING_PROTOCOLS} and flushes the response. - * Protocol specific headers must have already been set before this method - * is called. + * {@inheritDoc} * - * @param inbound The handler for all further incoming data on the current - * connection. - * - * @throws IOException If the upgrade fails (e.g. if the response has - * already been committed. - */ - public void doUpgrade(UpgradeInbound inbound) - throws IOException { - request.doUpgrade(inbound); - } - - - /** - * TODO SERVLET 3.1 + * @since Servlet 3.1 */ @Override public long getContentLengthLong() { return request.getContentLengthLong(); } - /** - * TODO SERVLET 3.1 - */ @Override + * {@inheritDoc} + * + * @since Servlet 3.1 + */ + @Override public void upgrade(ProtocolHandler handler) throws IOException { + request.upgrade(handler); } - - } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org