Package http.content.header

Examples of http.content.header.HttpHeader


    InputStream in = null;
    /**
     * Attempts to open a FileInputStream on the file, this is used for
     * reading it's content.
     */
    HttpHeader header = new HttpHeader(socket, f.getPath());
    try {
      in = new BufferedInputStream(new FileInputStream(f));
      Log.fine("200: %s", f.getPath());
    } catch (FileNotFoundException e) {
      Log.fine("404: %s", get);
      try {
        socketOut.write(header.get404());
      } catch (IOException e1) {
        Log.fine("Unable to write 404 to output stream.");
      }
      return;
    }
    try {
      socketOut.write(header.get200());
    } catch (IOException e1) {
      Log.info("Unable to write header to output stream for: %s", getIp());
    }
    try {
      socketOut.write(header.getContentLength(in.available()));
      socketOut.write(CRLF.getBytes());
    } catch (IOException e1) {
      Log.info("Unable to write content length to the header for: %s",
          getIp());
      e1.printStackTrace();
View Full Code Here

TOP

Related Classes of http.content.header.HttpHeader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.