1 package com.sslexplorer.core; 2 3 import java.io.IOException ; 4 import java.io.OutputStream ; 5 6 import javax.servlet.http.Cookie ; 7 import javax.servlet.http.HttpServletResponse ; 8 9 import com.sslexplorer.boot.RequestHandlerResponse; 10 11 public class ServletResponseAdapter implements RequestHandlerResponse { 12 13 HttpServletResponse response; 14 public ServletResponseAdapter(HttpServletResponse response) { 15 this.response = response; 16 } 17 public void setField(String header, String value) { 18 response.setHeader(header, value); 19 } 20 21 public void addField(String header, String value) { 22 response.addHeader(header, value); 23 } 24 25 public void removeField(String header) { 26 response.setHeader(header, null); 27 28 } 29 30 public void sendError(int status, String message) throws IOException { 31 response.sendError(status, message); 32 } 33 34 public void setStatus(int status) { 35 response.setStatus(status); 36 } 37 38 public void setContentLength(int length) { 39 response.setContentLength(length); 40 } 41 42 public void setReason(String reason) { 43 44 } 45 46 public OutputStream getOutputStream() throws IOException { 47 return response.getOutputStream(); 48 } 49 50 public void sendRedirect(String url) throws IOException { 51 response.sendRedirect(url); 52 } 53 54 public void addCookie(Cookie cookie) { 55 response.addCookie(cookie); 56 57 } 58 59 public void setCharacterEncoding(String charset) { 60 response.setCharacterEncoding(charset); 61 } 62 63 } 64 | Popular Tags |