httpresponse.java
来自「OpenMap是一个基于JavaBeansTM的开发工具包。利用OpenMap你」· Java 代码 · 共 84 行
JAVA
84 行
// **********************************************************************// // <copyright>// // BBN Technologies// 10 Moulton Street// Cambridge, MA 02138// (617) 873-8000// // Copyright (C) BBNT Solutions LLC. All rights reserved.// // </copyright>// **********************************************************************// // $Source: /cvs/distapps/openmap/src/wmsservlet/WEB-INF/src/com/bbn/openmap/wmsservlet/HttpResponse.java,v $// $RCSfile: HttpResponse.java,v $// $Revision: 1.1.2.2 $// $Date: 2007/08/13 16:48:47 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.wmsservlet;import java.io.IOException;import java.io.OutputStream;import javax.servlet.http.HttpServletResponse;import com.bbn.openmap.layer.util.http.IHttpResponse;/** */public class HttpResponse implements IHttpResponse { protected HttpServletResponse httpResponse; /** * Initialize the input <code>Reader</code> and output <code>Writer</code> * and start the connection thread. * * @param client_socket * the client's socket * @param server * the server object */ public HttpResponse(HttpServletResponse response) { this.httpResponse = response; } /** * Write a String response encoded as UTF-8 to the OutputStream. * * @param out * the OutputStream of the response. * @param contentType * the content type of the response. * @param response * the string containing the response. */ public void writeHttpResponse(String contentType, String response) throws IOException { writeHttpResponse(contentType, response.getBytes("UTF-8")); } /** * Write a byte[] response to the OutputStream. * * @param out * the OutputStream of the response. * @param contentType * the content type of the response. * @param response * the byte array containing the response. */ public void writeHttpResponse(String contentType, byte[] response) throws IOException { httpResponse.setContentType(contentType); httpResponse.setContentLength(response.length); OutputStream out = httpResponse.getOutputStream(); out.write(response, 0, response.length); out.flush(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?