KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > webdav > logger > StatusHttpServletResponseWrapper


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/logger/StatusHttpServletResponseWrapper.java,v 1.2 2004/07/28 09:32:36 ib Exp $
3  * $Revision: 1.2 $
4  * $Date: 2004/07/28 09:32:36 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24
25 package org.apache.slide.webdav.logger;
26
27 import java.io.IOException JavaDoc;
28
29 import javax.servlet.http.HttpServletResponse JavaDoc;
30 import javax.servlet.http.HttpServletResponseWrapper JavaDoc;
31
32 import org.apache.slide.common.Domain;
33
34 /**
35  * This class supports additional set-methods and a re-readable
36  * inputstream to the interface javax.servlet.http.HttpServletResponse.
37  *
38  * Christopher Lenz (cmlenz at apache.org)
39  *
40  * @version 0.1
41  *
42  * @invariant (inputStream != null)
43  *
44  * @see javax.servlet.http.HttpServletResponse
45  *
46  */

47 public class StatusHttpServletResponseWrapper extends HttpServletResponseWrapper JavaDoc
48 {
49
50     
51     private int statusCode = -1;
52     private String JavaDoc statusText = "";
53     
54     /**
55      * This constructor creates an re-writable HttpServletResüpmse.
56      *
57      * @pre (response != null)
58      * @post
59      *
60      * @param response HttpServletResponse
61      *
62      * @time
63      * @space
64      */

65     public StatusHttpServletResponseWrapper(HttpServletResponse JavaDoc response) {
66         super(response);
67         Domain.debug("Create XHttpServletResponseFacade");
68     }
69
70
71     public int getStatus() {
72         return statusCode;
73     }
74     public String JavaDoc getStatusText() {
75         return statusText;
76     }
77     public void setStatus(int sc) {
78         statusCode = sc;
79         super.setStatus(sc);
80     }
81     public void setStatus(int sc, String JavaDoc msg) {
82         statusCode = sc;
83         statusText = msg;
84         super.setStatus(sc, msg);
85     }
86     public void sendError( int sc ) throws IOException JavaDoc {
87         statusCode = sc;
88         super.sendError(sc);
89     }
90     public void sendError( int sc, String JavaDoc msg ) throws IOException JavaDoc {
91         statusCode = sc;
92         statusText = msg;
93         super.sendError(sc, msg);
94     }
95 }
96
Popular Tags