|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
DecodedRequest.java | - | 100% | 100% | 100% |
|
1 |
// Copyright 2004, 2005 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.tapestry.request;
|
|
16 |
|
|
17 |
import javax.servlet.http.HttpServletRequest;
|
|
18 |
|
|
19 |
/**
|
|
20 |
* Contains properties of an {@link javax.servlet.http.HttpServletRequest}that have been extracted
|
|
21 |
* from the request (or otherwise determined). An instance of this is created by an
|
|
22 |
* {@link org.apache.tapestry.request.IRequestDecoder}. The decoder must set the serverName and
|
|
23 |
* requestURI properties, and should set the scheme and server port properties.
|
|
24 |
*
|
|
25 |
* @see IRequestDecoder
|
|
26 |
* @author Howard Lewis Ship
|
|
27 |
* @since 2.2
|
|
28 |
*/
|
|
29 |
|
|
30 |
public class DecodedRequest |
|
31 |
{ |
|
32 |
private String _scheme = "http"; |
|
33 |
|
|
34 |
private String _serverName;
|
|
35 |
|
|
36 |
private String _requestURI;
|
|
37 |
|
|
38 |
private int _serverPort = 80; |
|
39 |
|
|
40 | 2 |
public DecodedRequest()
|
41 |
{ |
|
42 |
} |
|
43 |
|
|
44 |
/**
|
|
45 |
* Initializes default values for the properties from the request provided.
|
|
46 |
*
|
|
47 |
* @since 4.0
|
|
48 |
*/
|
|
49 |
|
|
50 | 1 |
public DecodedRequest(HttpServletRequest request)
|
51 |
{ |
|
52 | 1 |
_scheme = request.getScheme(); |
53 | 1 |
_serverName = request.getServerName(); |
54 | 1 |
_requestURI = request.getRequestURI(); |
55 | 1 |
_serverPort = request.getServerPort(); |
56 |
} |
|
57 |
|
|
58 |
/**
|
|
59 |
* Default value is 80.
|
|
60 |
*/
|
|
61 |
|
|
62 | 2 |
public int getServerPort() |
63 |
{ |
|
64 | 2 |
return _serverPort;
|
65 |
} |
|
66 |
|
|
67 |
/**
|
|
68 |
* Default value is 'http'.
|
|
69 |
*/
|
|
70 |
|
|
71 | 2 |
public String getScheme()
|
72 |
{ |
|
73 | 2 |
return _scheme;
|
74 |
} |
|
75 |
|
|
76 |
/**
|
|
77 |
* No default, a value must be set by the decoder.
|
|
78 |
*/
|
|
79 |
|
|
80 | 2 |
public String getServerName()
|
81 |
{ |
|
82 | 2 |
return _serverName;
|
83 |
} |
|
84 |
|
|
85 |
/**
|
|
86 |
* No default, a value must be set by the decoder.
|
|
87 |
*/
|
|
88 |
|
|
89 | 3 |
public String getRequestURI()
|
90 |
{ |
|
91 | 3 |
return _requestURI;
|
92 |
} |
|
93 |
|
|
94 | 1 |
public void setServerPort(int serverPort) |
95 |
{ |
|
96 | 1 |
_serverPort = serverPort; |
97 |
} |
|
98 |
|
|
99 | 1 |
public void setScheme(String scheme) |
100 |
{ |
|
101 | 1 |
_scheme = scheme; |
102 |
} |
|
103 |
|
|
104 | 1 |
public void setServerName(String serverName) |
105 |
{ |
|
106 | 1 |
_serverName = serverName; |
107 |
} |
|
108 |
|
|
109 | 2 |
public void setRequestURI(String URI) |
110 |
{ |
|
111 | 2 |
_requestURI = URI; |
112 |
} |
|
113 |
|
|
114 |
} |
|