KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > server > jetty > ResponseAdapter


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.server.jetty;
21
22 import java.io.IOException JavaDoc;
23 import java.io.OutputStream JavaDoc;
24
25 import javax.servlet.http.Cookie JavaDoc;
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 JavaDoc header, String JavaDoc value) {
44         response.setField(header, value);
45     }
46
47     public void sendRedirect(String JavaDoc url) throws IOException JavaDoc {
48         response.sendRedirect(url);
49     }
50
51     public void addCookie(Cookie JavaDoc cookie) {
52         response.addSetCookie(cookie);
53     }
54     public void sendError(int code, String JavaDoc message) throws IOException JavaDoc {
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 JavaDoc reason) {
70         response.setReason(reason);
71     }
72
73     public void removeField(String JavaDoc name) {
74         response.removeField(name);
75     }
76
77     public void addField(String JavaDoc header, String JavaDoc value) {
78         response.addField(header, value);
79     }
80
81     public OutputStream JavaDoc getOutputStream() {
82         return response.getOutputStream();
83     }
84     
85     public void setCharacterEncoding(String JavaDoc charset) {
86         response.setCharacterEncoding(charset, true);
87     }
88
89 }
90
Popular Tags