1 //
2 // ========================================================================
3 // Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
8 //
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
11 //
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
14 //
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
17 //
18
19 package org.eclipse.jetty.http.spi;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.io.OutputStream;
24 import java.net.InetSocketAddress;
25 import java.net.URI;
26
27 import javax.servlet.http.HttpServletRequest;
28 import javax.servlet.http.HttpServletResponse;
29
30 import com.sun.net.httpserver.Headers;
31 import com.sun.net.httpserver.HttpContext;
32 import com.sun.net.httpserver.HttpExchange;
33 import com.sun.net.httpserver.HttpPrincipal;
34
35 /* ------------------------------------------------------------ */
36 /**
37 */
38 public class JettyHttpExchange extends HttpExchange implements JettyExchange
39 {
40 private JettyHttpExchangeDelegate _delegate;
41
42 public JettyHttpExchange(HttpContext jaxWsContext, HttpServletRequest req, HttpServletResponse resp)
43 {
44 super();
45 _delegate = new JettyHttpExchangeDelegate(jaxWsContext,req,resp);
46 }
47
48 /* ------------------------------------------------------------ */
49 /**
50 * @see org.eclipse.jetty.http.spi.JettyExchange#hashCode()
51 */
52 @Override
53 public int hashCode()
54 {
55 return _delegate.hashCode();
56 }
57
58 /* ------------------------------------------------------------ */
59 /**
60 * @see org.eclipse.jetty.http.spi.JettyExchange#getRequestHeaders()
61 */
62 @Override
63 public Headers getRequestHeaders()
64 {
65 return _delegate.getRequestHeaders();
66 }
67
68 /* ------------------------------------------------------------ */
69 /**
70 * @see org.eclipse.jetty.http.spi.JettyExchange#getResponseHeaders()
71 */
72 @Override
73 public Headers getResponseHeaders()
74 {
75 return _delegate.getResponseHeaders();
76 }
77
78 /* ------------------------------------------------------------ */
79 /**
80 * @see org.eclipse.jetty.http.spi.JettyExchange#getRequestURI()
81 */
82 @Override
83 public URI getRequestURI()
84 {
85 return _delegate.getRequestURI();
86 }
87
88 /* ------------------------------------------------------------ */
89 /**
90 * @see org.eclipse.jetty.http.spi.JettyExchange#getRequestMethod()
91 */
92 @Override
93 public String getRequestMethod()
94 {
95 return _delegate.getRequestMethod();
96 }
97
98 /* ------------------------------------------------------------ */
99 /**
100 * @see org.eclipse.jetty.http.spi.JettyExchange#getHttpContext()
101 */
102 @Override
103 public HttpContext getHttpContext()
104 {
105 return _delegate.getHttpContext();
106 }
107
108 /* ------------------------------------------------------------ */
109 /**
110 * @see org.eclipse.jetty.http.spi.JettyExchange#close()
111 */
112 @Override
113 public void close()
114 {
115 _delegate.close();
116 }
117
118 /* ------------------------------------------------------------ */
119 /**
120 * @see org.eclipse.jetty.http.spi.JettyExchange#equals(java.lang.Object)
121 */
122 @Override
123 public boolean equals(Object obj)
124 {
125 return _delegate.equals(obj);
126 }
127
128 /* ------------------------------------------------------------ */
129 /**
130 * @see org.eclipse.jetty.http.spi.JettyExchange#getRequestBody()
131 */
132 @Override
133 public InputStream getRequestBody()
134 {
135 return _delegate.getRequestBody();
136 }
137
138 /* ------------------------------------------------------------ */
139 /**
140 * @see org.eclipse.jetty.http.spi.JettyExchange#getResponseBody()
141 */
142 @Override
143 public OutputStream getResponseBody()
144 {
145 return _delegate.getResponseBody();
146 }
147
148 /* ------------------------------------------------------------ */
149 /**
150 * @see org.eclipse.jetty.http.spi.JettyExchange#sendResponseHeaders(int, long)
151 */
152 @Override
153 public void sendResponseHeaders(int rCode, long responseLength) throws IOException
154 {
155 _delegate.sendResponseHeaders(rCode,responseLength);
156 }
157
158 /* ------------------------------------------------------------ */
159 /**
160 * @see org.eclipse.jetty.http.spi.JettyExchange#getRemoteAddress()
161 */
162 @Override
163 public InetSocketAddress getRemoteAddress()
164 {
165 return _delegate.getRemoteAddress();
166 }
167
168 /* ------------------------------------------------------------ */
169 /**
170 * @see org.eclipse.jetty.http.spi.JettyExchange#getResponseCode()
171 */
172 @Override
173 public int getResponseCode()
174 {
175 return _delegate.getResponseCode();
176 }
177
178 /* ------------------------------------------------------------ */
179 /**
180 * @see org.eclipse.jetty.http.spi.JettyExchange#getLocalAddress()
181 */
182 @Override
183 public InetSocketAddress getLocalAddress()
184 {
185 return _delegate.getLocalAddress();
186 }
187
188 /* ------------------------------------------------------------ */
189 /**
190 * @see org.eclipse.jetty.http.spi.JettyExchange#getProtocol()
191 */
192 @Override
193 public String getProtocol()
194 {
195 return _delegate.getProtocol();
196 }
197
198 /* ------------------------------------------------------------ */
199 /**
200 * @see org.eclipse.jetty.http.spi.JettyExchange#getAttribute(java.lang.String)
201 */
202 @Override
203 public Object getAttribute(String name)
204 {
205 return _delegate.getAttribute(name);
206 }
207
208 /* ------------------------------------------------------------ */
209 /**
210 * @see org.eclipse.jetty.http.spi.JettyExchange#setAttribute(java.lang.String, java.lang.Object)
211 */
212 @Override
213 public void setAttribute(String name, Object value)
214 {
215 _delegate.setAttribute(name,value);
216 }
217
218 /* ------------------------------------------------------------ */
219 /**
220 * @see org.eclipse.jetty.http.spi.JettyExchange#setStreams(java.io.InputStream, java.io.OutputStream)
221 */
222 @Override
223 public void setStreams(InputStream i, OutputStream o)
224 {
225 _delegate.setStreams(i,o);
226 }
227
228 /* ------------------------------------------------------------ */
229 /**
230 * @see org.eclipse.jetty.http.spi.JettyExchange#getPrincipal()
231 */
232 @Override
233 public HttpPrincipal getPrincipal()
234 {
235 return _delegate.getPrincipal();
236 }
237
238 /* ------------------------------------------------------------ */
239 /**
240 * @see org.eclipse.jetty.http.spi.JettyExchange#setPrincipal(com.sun.net.httpserver.HttpPrincipal)
241 */
242 public void setPrincipal(HttpPrincipal principal)
243 {
244 _delegate.setPrincipal(principal);
245 }
246
247 /* ------------------------------------------------------------ */
248 /**
249 * @see org.eclipse.jetty.http.spi.JettyExchange#toString()
250 */
251 @Override
252 public String toString()
253 {
254 return _delegate.toString();
255 }
256
257 }