1 19 20 package com.sslexplorer.server.jetty; 21 22 import java.io.IOException ; 23 import java.io.OutputStream ; 24 25 import javax.servlet.http.Cookie ; 26 27 import org.mortbay.http.HttpResponse; 28 29 import com.sslexplorer.boot.RequestHandlerResponse; 30 31 public class ResponseAdapter implements RequestHandlerResponse { 32 33 private HttpResponse response; 34 35 public ResponseAdapter(HttpResponse response) { 36 this.response = response; 37 } 38 39 public HttpResponse getHttpResponse() { 40 return response; 41 } 42 43 public void setField(String header, String value) { 44 response.setField(header, value); 45 } 46 47 public void sendRedirect(String url) throws IOException { 48 response.sendRedirect(url); 49 } 50 51 public void addCookie(Cookie cookie) { 52 response.addSetCookie(cookie); 53 } 54 public void sendError(int code, String message) throws IOException { 55 response.sendError(code, message); 56 57 } 58 59 public void setStatus(int status) { 60 response.setStatus(status); 61 62 } 63 64 public void setContentLength(int length) { 65 response.setContentLength(length); 66 67 } 68 69 public void setReason(String reason) { 70 response.setReason(reason); 71 } 72 73 public void removeField(String name) { 74 response.removeField(name); 75 } 76 77 public void addField(String header, String value) { 78 response.addField(header, value); 79 } 80 81 public OutputStream getOutputStream() { 82 return response.getOutputStream(); 83 } 84 85 public void setCharacterEncoding(String charset) { 86 response.setCharacterEncoding(charset, true); 87 } 88 89 } 90 | Popular Tags |