public String insecureUrl ( HttpServletRequest request , HttpServletResponse response ) throws IOException { String protocol = getProtocol ( request ) ; if ( protocol . equalsIgnoreCase ( HTTPS_PROTOCOL ) ) { int port = mapPort ( TO_INSECURE_PORT_MAP , getPort ( request ) ) ; try { return changeProtocolAndPort ( HTTP_PROTOCOL , port == DEFAULT_HTTP_PORT ? - 1 : port , request ) . toString ( ) ; } catch ( URISyntaxException e ) { throw new IllegalStateException ( "Failed to create URI." , e ) ; } } else { throw new UnsupportedProtocolException ( "Cannot build insecure url for " + protocol ) ; } }
Returns the insecure version of the original URL for the request .