org.apache.tomcat.websocket.Constants Java Examples
The following examples show how to use
org.apache.tomcat.websocket.Constants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpgradeUtil.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * Checks to see if this is an HTTP request that includes a valid upgrade * request to web socket. * <p> * Note: RFC 2616 does not limit HTTP upgrade to GET requests but the Java * WebSocket spec 1.0, section 8.2 implies such a limitation and RFC * 6455 section 4.1 requires that a WebSocket Upgrade uses GET. */ public static boolean isWebSocketUpgradeRequest(ServletRequest request, ServletResponse response) { return ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse) && headerContainsToken((HttpServletRequest) request, Constants.UPGRADE_HEADER_NAME, Constants.UPGRADE_HEADER_VALUE) && "GET".equals(((HttpServletRequest) request).getMethod())); }
Example #2
Source File: UpgradeUtil.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * Checks to see if this is an HTTP request that includes a valid upgrade * request to web socket. * <p> * Note: RFC 2616 does not limit HTTP upgrade to GET requests but the Java * WebSocket spec 1.0, section 8.2 implies such a limitation and RFC * 6455 section 4.1 requires that a WebSocket Upgrade uses GET. */ public static boolean isWebSocketUpgradeRequest(ServletRequest request, ServletResponse response) { return ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse) && headerContainsToken((HttpServletRequest) request, Constants.UPGRADE_HEADER_NAME, Constants.UPGRADE_HEADER_VALUE) && "GET".equals(((HttpServletRequest) request).getMethod())); }
Example #3
Source File: UpgradeUtil.java From Tomcat8-Source-Read with MIT License | 3 votes |
/** * Checks to see if this is an HTTP request that includes a valid upgrade * request to web socket. * <p> * Note: RFC 2616 does not limit HTTP upgrade to GET requests but the Java * WebSocket spec 1.0, section 8.2 implies such a limitation and RFC * 6455 section 4.1 requires that a WebSocket Upgrade uses GET. * @param request The request to check if it is an HTTP upgrade request for * a WebSocket connection * @param response The response associated with the request * @return <code>true</code> if the request includes an HTTP Upgrade request * for the WebSocket protocol, otherwise <code>false</code> */ public static boolean isWebSocketUpgradeRequest(ServletRequest request, ServletResponse response) { return ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse) && headerContainsToken((HttpServletRequest) request, Constants.UPGRADE_HEADER_NAME, Constants.UPGRADE_HEADER_VALUE) && "GET".equals(((HttpServletRequest) request).getMethod())); }