Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
HttpExchange |
|
| 1.0;1 |
1 | /** |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * 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.camel.component.http; |
|
18 | ||
19 | import javax.servlet.http.HttpServletRequest; |
|
20 | import javax.servlet.http.HttpServletResponse; |
|
21 | ||
22 | import org.apache.camel.impl.DefaultExchange; |
|
23 | ||
24 | /** |
|
25 | * Represents a HTTP exchange which exposes the underlying HTTP abtractions via |
|
26 | * {@link #getRequest()} and {@link #getResponse()} |
|
27 | * |
|
28 | * @version $Revision: 563665 $ |
|
29 | */ |
|
30 | public class HttpExchange extends DefaultExchange { |
|
31 | private final HttpEndpoint endpoint; |
|
32 | private HttpServletRequest request; |
|
33 | private HttpServletResponse response; |
|
34 | ||
35 | public HttpExchange(HttpEndpoint endpoint) { |
|
36 | 3 | super(endpoint.getContext()); |
37 | 3 | this.endpoint = endpoint; |
38 | 3 | } |
39 | ||
40 | public HttpExchange(HttpEndpoint endpoint, HttpServletRequest request, HttpServletResponse response) { |
|
41 | 2 | this(endpoint); |
42 | 2 | this.request = request; |
43 | 2 | this.response = response; |
44 | 2 | setIn(new HttpMessage(this, request)); |
45 | 2 | } |
46 | ||
47 | ||
48 | /** |
|
49 | * Returns the underlying Servlet request for inbound HTTP requests |
|
50 | * |
|
51 | * @return the underlying Servlet request for inbound HTTP requests |
|
52 | */ |
|
53 | public HttpServletRequest getRequest() { |
|
54 | 0 | return request; |
55 | } |
|
56 | ||
57 | /** |
|
58 | * Returns the underlying Servlet response for inbound HTTP requests |
|
59 | * |
|
60 | * @return the underlying Servlet response for inbound HTTP requests |
|
61 | */ |
|
62 | public HttpServletResponse getResponse() { |
|
63 | 0 | return response; |
64 | } |
|
65 | ||
66 | public HttpEndpoint getEndpoint() { |
|
67 | 2 | return endpoint; |
68 | } |
|
69 | } |