title: java - creating web server - handling incoming http requests
body: <p>I am trying to write a web server in Java (this is my first time so an extremely simple web server).  I am not sure how to process the http get and post requests.</p>
  
  <p>Write now all I have is a loop with a server socket excepting connections and using a BufferedReader to take in the incoming message (as text).</p>
  
  <p>I know that you can extend a Servlet class and make use of </p>
  
  <ul>
  <li><code>protected void doGet(HttpServletRequest servlet_request, HttpServletResponse servlet_response)</code>, and </li>
  <li><code>protected void doPost(HttpServletRequest servlet_request, HttpServletResponse servlet_response)</code></li>
  </ul>
  
  <p>but I cannot work out how to transform/extract a raw incoming message from the socket into the parameters needed for the doGet() and doPost().</p>
  
  <p>Would someone be able to give a basic example and/or explanation of what to do?</p>
  
  <p>Many thanks</p>
  
  <p>Also, as an after thought, would it be simple to extend the web server to process JSP pages?</p>
  
  <p>Any help is greatly appreciated. </p>