01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.wicket.response;
18:
19: import java.io.IOException;
20: import java.io.OutputStream;
21:
22: import org.apache.wicket.Response;
23:
24: /**
25: * Response implementation that discards all output.
26: *
27: * @author Jonathan Locke
28: */
29: public class NullResponse extends Response {
30: /** The one and only instance of NullResponse */
31: private static final NullResponse instance = new NullResponse();
32:
33: /**
34: * Private constructor to force use of static factory method.
35: */
36: private NullResponse() {
37: }
38:
39: /**
40: * @return The one and only instance of NullResponse
41: */
42: public static final NullResponse getInstance() {
43: return instance;
44: }
45:
46: /**
47: * @see org.apache.wicket.Response#write(CharSequence)
48: */
49: public void write(CharSequence string) {
50: // Does nothing
51: }
52:
53: /**
54: * @see org.apache.wicket.Response#getOutputStream()
55: */
56: public OutputStream getOutputStream() {
57: return new OutputStream() {
58: public void write(int b) throws IOException {
59: }
60: };
61: }
62: }
|