title: Get the currently used protocol name from HttpServletRequest?
body: <p>I'm constructing a new URL in a Spring MVC controller, to be passed back to the client.   Currently I'm trying this:</p>
  
  <pre><code>// httpRequest is the current HttpServletRequest
  
  new URL(httpRequest.getProtocol(),
      httpRequest.getServerName(),
      httpRequest.getServerPort(),
      httpRequest.getContextPath().concat("/foo/bar.html"));
  </code></pre>
  
  <p>Problem is that <code>httpRequest.getProtocol()</code> gives me "HTTP/1.1" instead of just "HTTP".    I can trim it but wondered if there was a more elegant way.</p>