Package org.springframework.http.converter

Examples of org.springframework.http.converter.HttpMessageConversionException


      int counter = 0;
      for (Node node : titles) {
        traffic.addIncident(((Element)node).getTextContent(), ((Element)description.get(counter++)).getTextContent());
      }
    } catch (Exception e) {
      throw new HttpMessageConversionException("Failed to convert response to: " + clazz, e);
    }
    return traffic;
  }
View Full Code Here


    try {
      JAXBContext jaxbContext = getJaxbContext(clazz);
      return jaxbContext.createMarshaller();
    }
    catch (JAXBException ex) {
      throw new HttpMessageConversionException(
          "Could not create Marshaller for class [" + clazz + "]: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

    try {
      JAXBContext jaxbContext = getJaxbContext(clazz);
      return jaxbContext.createUnmarshaller();
    }
    catch (JAXBException ex) {
      throw new HttpMessageConversionException(
          "Could not create Unmarshaller for class [" + clazz + "]: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

      try {
        jaxbContext = JAXBContext.newInstance(clazz);
        this.jaxbContexts.putIfAbsent(clazz, jaxbContext);
      }
      catch (JAXBException ex) {
        throw new HttpMessageConversionException(
            "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex);
      }
    }
    return jaxbContext;
  }
View Full Code Here

      else if (StreamSource.class.equals(clazz) || Source.class.equals(clazz)) {
        ByteArrayInputStream bis = transformToByteArrayInputStream(source);
        return (T) new StreamSource(bis);
      }
      else {
        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 + "]",
View Full Code Here

        else if (elementClass.isAnnotationPresent(XmlType.class)) {
          result.add(unmarshaller.unmarshal(streamReader, elementClass).getValue());
        }
        else {
          // should not happen, since we check in canRead(Type)
          throw new HttpMessageConversionException("Could not unmarshal to [" + elementClass + "]");
        }
        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) {
      throw new HttpMessageConversionException(ex.getMessage(), ex);
    }
  }
View Full Code Here

        if (jaxbContext == null) {
            try {
                jaxbContext = JAXBContext.newInstance(clazz);
                jaxbContexts.putIfAbsent(clazz, jaxbContext);
            } catch (JAXBException ex) {
                throw new HttpMessageConversionException(
                        "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex);
            }
        }
        return jaxbContext;
    }
View Full Code Here

    }
    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

    }
    catch (MarshalException ex) {
      throw new HttpMessageNotWritableException("Could not marshal [" + accessToken + "]: " + ex.getMessage(), ex);
    }
    catch (JAXBException ex) {
      throw new HttpMessageConversionException("Could not instantiate JAXBContext: " + ex.getMessage(), ex);
    }
  }
View Full Code Here

        if (jaxbContext == null) {
            try {
                jaxbContext = JAXBContext.newInstance(clazz);
                jaxbContexts.putIfAbsent(clazz, jaxbContext);
            } catch (JAXBException ex) {
                throw new HttpMessageConversionException(
                        "Could not instantiate JAXBContext for class [" + clazz + "]: " + ex.getMessage(), ex);
            }
        }
        return jaxbContext;
    }
View Full Code Here

TOP

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

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.