title: Setting Response Headers of HTTPServeletResponse
body: <p>So, I am constructing a URL from values from a database. Now, I want to make sure that the response headers are what I specify for this URL. How do I achieve this?  </p>
  
  <p>For instance, if I construct a URL such as <code>www.google.com/username=ak&amp;password=bk</code>, I want to make sure that the connection is keep alive for the response that you get when you hit the URL. How do I do this within JSP/Java?</p>
  
  <p>The reason being, I'm trying to render a video on an <code>iOS</code> device from my <code>CMS</code> however this doesn't work and from what I have read, the response headers must be set. How do I set response headers for a URL that I might hit? </p>
  
  <p>The following method is how I am setting the response however the response is not the url I make. The URL I make is something like <code>www.uisghsfgsgsfg.com/cs/sksjdgs/appl</code>. I am confused as to what the response means in the context of this page. </p>
  
  <pre><code>class URLConstructor extends HttpServlet {
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     response.setHeader("Accept-Ranges", "bytes");
     response.setHeader("Connection", "Keep-Alive");
     ByteArrayOutputStream byteStream =
         new ByteArrayOutputStream(512);
     response.setContentLength(byteStream.size());
     response.addHeader("Connection", "Keep-Alive");
  }
  }
  </code></pre>