Package org.springframework.http.converter

Examples of org.springframework.http.converter.HttpMessageNotReadableException


    try {
      Reader reader = new InputStreamReader(inputMessage.getBody(), charset);
      return (T) feedInput.build(reader);
    }
    catch (FeedException ex) {
      throw new HttpMessageNotReadableException("Could not read WireFeed: " + ex.getMessage(), ex);
    }
  }
View Full Code Here


  private Object readJavaType(JavaType javaType, HttpInputMessage inputMessage) {
    try {
      return this.objectMapper.readValue(inputMessage.getBody(), javaType);
    }
    catch (IOException ex) {
      throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

        throw new HttpMessageConversionException("Could not read class [" + clazz +
            "]. Only DOMSource, SAXSource, and StreamSource are supported.");
      }
    }
    catch (TransformerException ex) {
      throw new HttpMessageNotReadableException("Could not transform from [" + source + "] to [" + clazz + "]",
          ex);
    }
  }
View Full Code Here

        throw new TypeMismatchException(result, clazz);
      }
      return result;
    }
    catch (UnmarshallingFailureException ex) {
      throw new HttpMessageNotReadableException("Could not read [" + clazz + "]", ex);
    }
  }
View Full Code Here

  private Object readJavaType(JavaType javaType, HttpInputMessage inputMessage) {
    try {
      return this.objectMapper.readValue(inputMessage.getBody(), javaType);
    }
    catch (IOException ex) {
      throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

        event = moveToNextElement(streamReader);
      }
      return result;
    }
    catch (UnmarshalException ex) {
      throw new HttpMessageNotReadableException("Could not unmarshal to [" + elementClass + "]: " + ex.getMessage(), ex);
    }
    catch (JAXBException ex) {
      throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
    }
    catch (XMLStreamException ex) {
View Full Code Here

    JavaType javaType = getJavaType(clazz);
    try {
      return this.objectMapper.readValue(inputMessage.getBody(), javaType);
    }
    catch (JsonProcessingException ex) {
      throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

    try {
      JAXBElement<? extends I> jaxbElement = createUnmarshaller().unmarshal(source, internalClass);
      return convertToExternal(jaxbElement.getValue());
    }
    catch (UnmarshalException ex) {
      throw new HttpMessageNotReadableException("Could not unmarshal to [" + clazz + "]: " + ex.getMessage(), ex);
    }
    catch (JAXBException ex) {
      throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

      ImageReader imageReader = imageReaders.next();
      ImageReadParam irp = imageReader.getDefaultReadParam();
      imageReader.setInput(new MemoryCacheImageInputStream(photo), true);
      body = imageReader.read(0, irp);
    } else {
      throw new HttpMessageNotReadableException("Could not find javax.imageio.ImageReader for Content-Type ["
          + contentType + "]");
    }
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.IMAGE_JPEG);
    return new ResponseEntity<BufferedImage>(body, headers, HttpStatus.OK);
View Full Code Here

      ImageReader imageReader = imageReaders.next();
      ImageReadParam irp = imageReader.getDefaultReadParam();
      imageReader.setInput(new MemoryCacheImageInputStream(photo), true);
      body = imageReader.read(0, irp);
    } else {
      throw new HttpMessageNotReadableException("Could not find javax.imageio.ImageReader for Content-Type ["
          + contentType + "]");
    }
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.IMAGE_JPEG);
    return new ResponseEntity<BufferedImage>(body, headers, HttpStatus.OK);
View Full Code Here

TOP

Related Classes of org.springframework.http.converter.HttpMessageNotReadableException

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.