Package org.springframework.http

Examples of org.springframework.http.HttpInputMessage


  @SuppressWarnings({ "unchecked", "rawtypes", "resource" })
  protected ModelAndView getModelAndView(ServletWebRequest webRequest, ApiError error)
      throws HttpMessageNotWritableException, IOException {
   
    if (error != null) {
      HttpInputMessage inputMessage = new ServletServerHttpRequest(webRequest.getRequest());
     
      List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept();
      if (acceptedMediaTypes.isEmpty()) {
        acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
      }
     
      MediaType.sortByQualityValue(acceptedMediaTypes);
View Full Code Here


  @Override
  protected void doFilterInternal(final HttpServletRequest request, HttpServletResponse response,
      FilterChain filterChain) throws ServletException, IOException {

    if (("PUT".equals(request.getMethod()) || "PATCH".equals(request.getMethod())) && isFormContentType(request)) {
      HttpInputMessage inputMessage = new ServletServerHttpRequest(request) {
        @Override
        public InputStream getBody() throws IOException {
          return request.getInputStream();
        }
      };
View Full Code Here

  @Override
  protected <T> Object readWithMessageConverters(NativeWebRequest webRequest,
      MethodParameter methodParam,  Type paramType) throws IOException, HttpMediaTypeNotSupportedException {

    final HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
    HttpInputMessage inputMessage = new ServletServerHttpRequest(servletRequest);

    RequestBody annot = methodParam.getParameterAnnotation(RequestBody.class);
    if (!annot.required()) {
      InputStream inputStream = inputMessage.getBody();
      if (inputStream == null) {
        return null;
      }
      else if (inputStream.markSupported()) {
        inputStream.mark(1);
View Full Code Here

  }

  private HttpEntity resolveHttpEntityRequest(MethodParameter methodParam, NativeWebRequest webRequest)
      throws Exception {

    HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
    Class<?> paramType = getHttpEntityType(methodParam);
    Object body = readWithMessageConverters(methodParam, inputMessage, paramType);
    return new HttpEntity<Object>(body, inputMessage.getHeaders());
  }
View Full Code Here

  @Override
  protected void doFilterInternal(final HttpServletRequest request, HttpServletResponse response,
      FilterChain filterChain) throws ServletException, IOException {

    if ("PUT".equals(request.getMethod()) && isFormContentType(request)) {
      HttpInputMessage inputMessage = new ServletServerHttpRequest(request) {
        @Override
        public InputStream getBody() throws IOException {
          return request.getInputStream();
        }
      };
View Full Code Here

    else if ("javax.servlet.http.Part".equals(parameter.getParameterType().getName())) {
      arg = servletRequest.getPart(partName);
    }
    else {
      try {
        HttpInputMessage inputMessage = new RequestPartServletServerHttpRequest(servletRequest, partName);
        arg = readWithMessageConverters(inputMessage, parameter, parameter.getParameterType());
        if (arg != null) {
          Annotation[] annotations = parameter.getParameterAnnotations();
          for (Annotation annot : annotations) {
            if (annot.annotationType().getSimpleName().startsWith("Valid")) {
View Full Code Here

   * @throws HttpMediaTypeNotSupportedException if no suitable message converter is found
   */
  protected <T> Object readWithMessageConverters(NativeWebRequest webRequest, MethodParameter methodParam, Class<T> paramType) throws IOException,
      HttpMediaTypeNotSupportedException {
     
        HttpInputMessage inputMessage = createInputMessage(webRequest);
        return readWithMessageConverters(inputMessage, methodParam, paramType);
      }
View Full Code Here

                  ModelAndViewContainer mavContainer,
                  NativeWebRequest webRequest,
                  WebDataBinderFactory binderFactory)
      throws IOException, HttpMediaTypeNotSupportedException {

    HttpInputMessage inputMessage = createInputMessage(webRequest);
    Class<?> paramType = getHttpEntityType(parameter);

    Object body = readWithMessageConverters(webRequest, parameter, paramType);
    return new HttpEntity<Object>(body, inputMessage.getHeaders());
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  private ModelAndView handleResponseBody(Object returnValue, ServletWebRequest webRequest)
      throws ServletException, IOException {

    HttpInputMessage inputMessage = new ServletServerHttpRequest(webRequest.getRequest());
    List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept();
    if (acceptedMediaTypes.isEmpty()) {
      acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
    }
    MediaType.sortByQualityValue(acceptedMediaTypes);
    HttpOutputMessage outputMessage = new ServletServerHttpResponse(webRequest.getResponse());
View Full Code Here

  public Object resolveArgument(
      MethodParameter parameter, ModelAndViewContainer mavContainer,
      NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
      throws IOException, HttpMediaTypeNotSupportedException {

    HttpInputMessage inputMessage = createInputMessage(webRequest);
    Type paramType = getHttpEntityType(parameter);

    Object body = readWithMessageConverters(webRequest, parameter, paramType);
    return new HttpEntity<Object>(body, inputMessage.getHeaders());
  }
View Full Code Here

TOP

Related Classes of org.springframework.http.HttpInputMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.