code: 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);
      }
    }
docs: Returns the insecure version of the original URL for the request.
  
  @param request the secure request that was made.
  @param response the response for the request.
  @return the insecure version of the original URL for the request.
  @throws IOException if the url could not be created.