Android Open Source - GenericServer H T M L Reply






From Project

Back to project page GenericServer.

License

The source code is released under:

GNU General Public License

If you think the Android project GenericServer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.davecoss.android.genericserver;
//w ww.  j av  a  2 s  . com
import java.io.PrintWriter;

public class HTMLReply extends HTTPReply {
  
  public HTMLReply(String title, String content) {
    super(title, content);
  }
  
  public HTMLReply(String title, String content, String status) {
    super(title, content, status);
  }
  
  @Override
  public String get_content_type() {
    return "Content-Type: text/html; charset=UTF-8";
  }
  
  public void dump_html_header(PrintWriter output) {
    output.println("<!DOCTYPE html>");
    output.println("<html>\n<head>");
    output.println("<title>" + this.title + "</title>");
    output.println("</head>\n<body>");

  }
  
  public void dump_footer(PrintWriter output) {
    output.println("</body>");
    output.println("</html>");
    output.println("");
  }
  
  @Override
  public void dump_body(PrintWriter output)
  {
    

    dump_html_header(output);
    
    output.println(this.content);
    
    dump_footer(output);
    
    output.println("");
    output.flush();
  }
  
  public static HTMLReply invalid_request() {
    return new HTMLReply("Invalid Request", "Invalid Request", HTTPReply.STATUS_ERROR);
  }
}




Java Source Code List

com.davecoss.android.genericserver.BuildInfo.java
com.davecoss.android.genericserver.Console.java
com.davecoss.android.genericserver.EmptyRequest.java
com.davecoss.android.genericserver.FileError.java
com.davecoss.android.genericserver.FileReply.java
com.davecoss.android.genericserver.GenericServer.java
com.davecoss.android.genericserver.HTMLReply.java
com.davecoss.android.genericserver.HTTPError.java
com.davecoss.android.genericserver.HTTPReply.java
com.davecoss.android.genericserver.HTTPRequest.java
com.davecoss.android.genericserver.ImageReply.java
com.davecoss.android.genericserver.InvalidPostData.java
com.davecoss.android.genericserver.InvalidRequestData.java
com.davecoss.android.genericserver.JSONReply.java
com.davecoss.android.genericserver.Module.java
com.davecoss.android.genericserver.Plugin.java
com.davecoss.android.genericserver.SSLServer.java
com.davecoss.android.genericserver.ServerBundle.java
com.davecoss.android.genericserver.ServerHandler.java
com.davecoss.android.genericserver.Standalone.java
com.davecoss.android.genericserver.StreamReply.java
com.davecoss.android.genericserver.UserFile.java