View Javadoc
1   /*
2    * Copyright 2002-2013 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.web.context.request;
18  
19  /**
20   * Extension of the {@link WebRequest} interface, exposing the
21   * native request and response objects in a generic fashion.
22   *
23   * <p>Mainly intended for framework-internal usage,
24   * in particular for generic argument resolution code.
25   *
26   * @author Juergen Hoeller
27   * @since 2.5.2
28   */
29  public interface NativeWebRequest extends WebRequest {
30  
31  	/**
32  	 * Return the underlying native request object, if available.
33  	 * @see javax.servlet.http.HttpServletRequest
34  	 * @see javax.portlet.ActionRequest
35  	 * @see javax.portlet.RenderRequest
36  	 */
37  	Object getNativeRequest();
38  
39  	/**
40  	 * Return the underlying native response object, if available.
41  	 * @see javax.servlet.http.HttpServletResponse
42  	 * @see javax.portlet.ActionResponse
43  	 * @see javax.portlet.RenderResponse
44  	 */
45  	Object getNativeResponse();
46  
47  	/**
48  	 * Return the underlying native request object, if available.
49  	 * @param requiredType the desired type of request object
50  	 * @return the matching request object, or {@code null} if none
51  	 * of that type is available
52  	 * @see javax.servlet.http.HttpServletRequest
53  	 * @see javax.portlet.ActionRequest
54  	 * @see javax.portlet.RenderRequest
55  	 */
56  	<T> T getNativeRequest(Class<T> requiredType);
57  
58  	/**
59  	 * Return the underlying native response object, if available.
60  	 * @param requiredType the desired type of response object
61  	 * @return the matching response object, or {@code null} if none
62  	 * of that type is available
63  	 * @see javax.servlet.http.HttpServletResponse
64  	 * @see javax.portlet.ActionResponse
65  	 * @see javax.portlet.RenderResponse
66  	 */
67  	<T> T getNativeResponse(Class<T> requiredType);
68  
69  }