public static URI getRequestURI(HttpRequestMessage request, IoSession session) { URI requestURI = request.getRequestURI(); String host = request.getHeader("Host"); return getRequestURI(requestURI, host, session); }
public static void handleExtensionNegotiationException(HttpAcceptSession session, List<String> clientRequestedExtensions, ProtocolException e, Logger logger) { // This happens when the extension negotiation leads to // a fatal failure; the session should be closed because // the service REQUIRED some extension that the client // did not request. if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) { // KG-10384: make sure port is explicitly included in the request URI we use for lookup since it is always // included when the service registry is created since we force use of explicit port in accepts. // TODO: consider doing this "at the edge" when the HTTP request object (or http session) is created. URI requestURI = HttpUtils.getRequestURI(session.getRequestURL(), session.getReadHeader("Host"), session); logger.debug(format( "Rejected %s request for URI \"%s\" on session '%s': failed to negotiate client requested extensions '%s'" + " due to exception %s", session.getMethod(), requestURI, session, clientRequestedExtensions, e.toString())); } } session.setStatus(HttpStatus.CLIENT_NOT_FOUND); session.setReason("WebSocket Extensions not found or invalid"); session.close(false); }