// header,body 和 file public static Response msgBodyFile(String header, String body, String filePath) { Response responseMessage = new Response(); responseMessage.setHeader(header); responseMessage.setBody(body); responseMessage.setFilePath(filePath); return responseMessage; }
// header public static Response msgOnlyHeader(String header) { Response responseMessage = new Response(); responseMessage.setHeader(header); return responseMessage; }
// body 和 file public static Response msgHeaderBody(String header, String body) { Response responseMessage = new Response(); responseMessage.setBody(body); responseMessage.setHeader(header); return responseMessage; }
/** * * <li>方法名:createHeader * <li> * <li>返回类型:void * <li>说明: * <li>创建人:陈嗣洪 * <li>创建日期:2011-11-19 * <li>修改人: * <li>修改日期: */ private void createHeader(Response msg) { StringBuilder sb = new StringBuilder(); sb.append("HTTP/1.0 200 OK \r\n").append("\r\n"); msg.setHeader(sb.toString()); // 设置头部信息 }