Package org.springframework.http

Examples of org.springframework.http.HttpInputMessage


    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());
        WebDataBinder binder = binderFactory.createBinder(request, arg, partName);
        if (arg != null) {
          validate(binder, parameter);
        }
View Full Code Here


   * @throws HttpMediaTypeNotSupportedException if no suitable message converter is found
   */
  protected <T> Object readWithMessageConverters(NativeWebRequest webRequest,
      MethodParameter methodParam, Type paramType) throws IOException, HttpMediaTypeNotSupportedException {

    HttpInputMessage inputMessage = createInputMessage(webRequest);
    return readWithMessageConverters(inputMessage, methodParam, paramType);
  }
View Full Code Here

    private void handleResponseBody(Object returnValue, ServletWebRequest webRequest)
        throws Exception {
      if (returnValue == null) {
        return;
      }
      HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
      HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest);
      writeWithMessageConverters(returnValue, inputMessage, outputMessage);
    }
View Full Code Here

    private void handleHttpEntityResponse(HttpEntity<?> responseEntity, ServletWebRequest webRequest)
        throws Exception {
      if (responseEntity == null) {
        return;
      }
      HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
      HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest);
      if (responseEntity instanceof ResponseEntity && outputMessage instanceof ServerHttpResponse) {
        ((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity) responseEntity).getStatusCode());
      }
      HttpHeaders entityHeaders = responseEntity.getHeaders();
View Full Code Here

    private void handleResponseBody(Object returnValue, ServletWebRequest webRequest)
        throws Exception {
      if (returnValue == null) {
        return;
      }
      HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
      HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest);
      writeWithMessageConverters(returnValue, inputMessage, outputMessage);
    }
View Full Code Here

    private void handleHttpEntityResponse(HttpEntity<?> responseEntity, ServletWebRequest webRequest)
        throws Exception {
      if (responseEntity == null) {
        return;
      }
      HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
      HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest);
      if (responseEntity instanceof ResponseEntity && outputMessage instanceof ServerHttpResponse) {
        ((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity) responseEntity).getStatusCode());
      }
      HttpHeaders entityHeaders = responseEntity.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

            String s = (o instanceof byte[] ? new String((byte[]) o) : (String) o);
            if (s.charAt(0) == '{' || s.charAt(0) == '[') {
              // Looks like it might be a JSON string. Use the JSON converter
              for (HttpMessageConverter conv : getRestTemplate().getMessageConverters()) {
                if (conv instanceof MappingJacksonHttpMessageConverter) {
                  o = conv.read(requiredType, new HttpInputMessage() {
                    public InputStream getBody() throws IOException {
                      Object body = response.getBody();
                      return new ByteArrayInputStream(
                          (body instanceof byte[] ? (byte[]) body : ((String) body)
                              .getBytes()));
View Full Code Here

  public void handleHttpEntityResponse(HttpEntity<?> responseEntity, ServletWebRequest webRequest) throws Exception {
    if (responseEntity == null) {
      return;
    }
    HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
    HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest);
    if (responseEntity instanceof ResponseEntity && outputMessage instanceof ServerHttpResponse) {
      ((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity<?>) responseEntity).getStatusCode());
    }
    HttpHeaders entityHeaders = responseEntity.getHeaders();
View Full Code Here

       
        Method method = FastJsonHttpMessageConverter.class.getDeclaredMethod("supports", Class.class);
        method.setAccessible(true);
        method.invoke(converter, int.class);

        HttpInputMessage input = new HttpInputMessage() {

            public HttpHeaders getHeaders() {
                // TODO Auto-generated method stub
                return null;
            }
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.