Java Code Examples for org.springframework.http.server.ServletServerHttpRequest#getHeaders()
The following examples show how to use
org.springframework.http.server.ServletServerHttpRequest#getHeaders() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpEntityMethodProcessor.java From spring-analysis-note with MIT License | 6 votes |
@Override @Nullable public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws IOException, HttpMediaTypeNotSupportedException { ServletServerHttpRequest inputMessage = createInputMessage(webRequest); Type paramType = getHttpEntityType(parameter); if (paramType == null) { throw new IllegalArgumentException("HttpEntity parameter '" + parameter.getParameterName() + "' in method " + parameter.getMethod() + " is not parameterized"); } Object body = readWithMessageConverters(webRequest, parameter, paramType); if (RequestEntity.class == parameter.getParameterType()) { return new RequestEntity<>(body, inputMessage.getHeaders(), inputMessage.getMethod(), inputMessage.getURI()); } else { return new HttpEntity<>(body, inputMessage.getHeaders()); } }
Example 2
Source File: HttpEntityMethodProcessor.java From java-technology-stack with MIT License | 6 votes |
@Override @Nullable public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws IOException, HttpMediaTypeNotSupportedException { ServletServerHttpRequest inputMessage = createInputMessage(webRequest); Type paramType = getHttpEntityType(parameter); if (paramType == null) { throw new IllegalArgumentException("HttpEntity parameter '" + parameter.getParameterName() + "' in method " + parameter.getMethod() + " is not parameterized"); } Object body = readWithMessageConverters(webRequest, parameter, paramType); if (RequestEntity.class == parameter.getParameterType()) { return new RequestEntity<>(body, inputMessage.getHeaders(), inputMessage.getMethod(), inputMessage.getURI()); } else { return new HttpEntity<>(body, inputMessage.getHeaders()); } }
Example 3
Source File: HttpEntityMethodProcessor.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws IOException, HttpMediaTypeNotSupportedException { ServletServerHttpRequest inputMessage = createInputMessage(webRequest); Type paramType = getHttpEntityType(parameter); if (paramType == null) { throw new IllegalArgumentException("HttpEntity parameter '" + parameter.getParameterName() + "' in method " + parameter.getMethod() + " is not parameterized"); } Object body = readWithMessageConverters(webRequest, parameter, paramType); if (RequestEntity.class == parameter.getParameterType()) { return new RequestEntity<Object>(body, inputMessage.getHeaders(), inputMessage.getMethod(), inputMessage.getURI()); } else { return new HttpEntity<Object>(body, inputMessage.getHeaders()); } }
Example 4
Source File: HttpEntityMethodProcessor.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws IOException, HttpMediaTypeNotSupportedException { ServletServerHttpRequest inputMessage = createInputMessage(webRequest); Type paramType = getHttpEntityType(parameter); Object body = readWithMessageConverters(webRequest, parameter, paramType); if (RequestEntity.class == parameter.getParameterType()) { return new RequestEntity<Object>(body, inputMessage.getHeaders(), inputMessage.getMethod(), inputMessage.getURI()); } else { return new HttpEntity<Object>(body, inputMessage.getHeaders()); } }
Example 5
Source File: DefaultHandlerExceptionResolverTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void handleNoHandlerFoundException() throws Exception { ServletServerHttpRequest req = new ServletServerHttpRequest( new MockHttpServletRequest("GET","/resource")); NoHandlerFoundException ex = new NoHandlerFoundException(req.getMethod().name(), req.getServletRequest().getRequestURI(),req.getHeaders()); ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex); assertNotNull("No ModelAndView returned", mav); assertTrue("No Empty ModelAndView returned", mav.isEmpty()); assertEquals("Invalid status code", 404, response.getStatus()); }
Example 6
Source File: ResponseEntityExceptionHandlerTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void noHandlerFoundException() { ServletServerHttpRequest req = new ServletServerHttpRequest( new MockHttpServletRequest("GET","/resource")); Exception ex = new NoHandlerFoundException(req.getMethod().toString(), req.getServletRequest().getRequestURI(),req.getHeaders()); testException(ex); }
Example 7
Source File: DefaultHandlerExceptionResolverTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void handleNoHandlerFoundException() throws Exception { ServletServerHttpRequest req = new ServletServerHttpRequest( new MockHttpServletRequest("GET","/resource")); NoHandlerFoundException ex = new NoHandlerFoundException(req.getMethod().name(), req.getServletRequest().getRequestURI(),req.getHeaders()); ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex); assertNotNull("No ModelAndView returned", mav); assertTrue("No Empty ModelAndView returned", mav.isEmpty()); assertEquals("Invalid status code", 404, response.getStatus()); }
Example 8
Source File: ResponseEntityExceptionHandlerTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void noHandlerFoundException() { ServletServerHttpRequest req = new ServletServerHttpRequest( new MockHttpServletRequest("GET","/resource")); Exception ex = new NoHandlerFoundException(req.getMethod().toString(), req.getServletRequest().getRequestURI(),req.getHeaders()); testException(ex); }
Example 9
Source File: DefaultHandlerExceptionResolverTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void handleNoHandlerFoundException() throws Exception { ServletServerHttpRequest req = new ServletServerHttpRequest( new MockHttpServletRequest("GET","/resource")); NoHandlerFoundException ex = new NoHandlerFoundException(req.getMethod().name(), req.getServletRequest().getRequestURI(),req.getHeaders()); ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex); assertNotNull("No ModelAndView returned", mav); assertTrue("No Empty ModelAndView returned", mav.isEmpty()); assertEquals("Invalid status code", 404, response.getStatus()); }
Example 10
Source File: ResponseEntityExceptionHandlerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void noHandlerFoundException() { ServletServerHttpRequest req = new ServletServerHttpRequest( new MockHttpServletRequest("GET","/resource")); Exception ex = new NoHandlerFoundException(req.getMethod().toString(), req.getServletRequest().getRequestURI(),req.getHeaders()); testException(ex); }