001/* 002 * Copyright 2002-2017 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.web.context.request; 018 019/** 020 * Extension of the {@link WebRequest} interface, exposing the 021 * native request and response objects in a generic fashion. 022 * 023 * <p>Mainly intended for framework-internal usage, 024 * in particular for generic argument resolution code. 025 * 026 * @author Juergen Hoeller 027 * @since 2.5.2 028 */ 029public interface NativeWebRequest extends WebRequest { 030 031 /** 032 * Return the underlying native request object. 033 * @see javax.servlet.http.HttpServletRequest 034 * @see javax.portlet.ActionRequest 035 * @see javax.portlet.RenderRequest 036 */ 037 Object getNativeRequest(); 038 039 /** 040 * Return the underlying native response object, if any. 041 * @see javax.servlet.http.HttpServletResponse 042 * @see javax.portlet.ActionResponse 043 * @see javax.portlet.RenderResponse 044 */ 045 Object getNativeResponse(); 046 047 /** 048 * Return the underlying native request object, if available. 049 * @param requiredType the desired type of request object 050 * @return the matching request object, or {@code null} if none 051 * of that type is available 052 * @see javax.servlet.http.HttpServletRequest 053 * @see javax.portlet.ActionRequest 054 * @see javax.portlet.RenderRequest 055 */ 056 <T> T getNativeRequest(Class<T> requiredType); 057 058 /** 059 * Return the underlying native response object, if available. 060 * @param requiredType the desired type of response object 061 * @return the matching response object, or {@code null} if none 062 * of that type is available 063 * @see javax.servlet.http.HttpServletResponse 064 * @see javax.portlet.ActionResponse 065 * @see javax.portlet.RenderResponse 066 */ 067 <T> T getNativeResponse(Class<T> requiredType); 068 069}