KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > core > ServletResponseAdapter


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