Spring Framework NativeWebRequest - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework NativeWebRequest class.

This code example shows how to use the following methods:getNativeResponse
		if (mavContainer != null) {
		HttpServletResponse response = webRequest.getNativeResponse(HttpServletResponse.class);
		Class<?> paramType = parameter.getParameterType();
		if (ServletResponse.class.isAssignableFrom(paramType)) {
			Object nativeResponse = webRequest.getNativeResponse(paramType);
			if (nativeResponse == null) {
				throw new IllegalStateException(
						"Current response is not of type [" + paramType.getName() + "]: " + response);
			return nativeResponse;
		else if (OutputStream.class.isAssignableFrom(paramType)) {
			return response.getOutputStream();
		else if (Writer.class.isAssignableFrom(paramType)) {
This code example shows how to use the following methods:getAttribute, getParameter
	protected String getRequestValueForAttribute(String attributeName, NativeWebRequest request) { 
		Map<String, String> variables = getUriTemplateVariables(request); 
		if (StringUtils.hasText(variables.get(attributeName))) { 
			return variables.get(attributeName); 
		else if (StringUtils.hasText(request.getParameter(attributeName))) { 
			return request.getParameter(attributeName); 
		else { 
			return null; 
	protected final Map<String, String> getUriTemplateVariables(NativeWebRequest request) { 
		Map<String, String> variables = 
				(Map<String, String>) request.getAttribute( 
		return (variables != null ? variables : Collections.<String, String>emptyMap()); 

This code example shows how to use the following methods:getAttribute
See Code Examples for Spring Framework NativeWebRequest Methods: