Package org.springframework.http.converter.xml

Examples of org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter


    if (romePresent) {
      this.messageConverters.add(new AtomFeedHttpMessageConverter());
      this.messageConverters.add(new RssChannelHttpMessageConverter());
    }
    if (jaxb2Present) {
      this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (jackson2Present) {
      this.messageConverters.add(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
View Full Code Here



  public AllEncompassingFormHttpMessageConverter() {
    addPartConverter(new SourceHttpMessageConverter());
    if (jaxb2Present) {
      addPartConverter(new Jaxb2RootElementHttpMessageConverter());
    }
    if (jackson2Present) {
      addPartConverter(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
View Full Code Here

    messageConverters.add(new SourceHttpMessageConverter<Source>());
    messageConverters.add(new XmlAwareFormHttpMessageConverter());

    ClassLoader classLoader = getClass().getClassLoader();
    if (ClassUtils.isPresent("javax.xml.bind.Binder", classLoader)) {
      messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", classLoader)) {
      messageConverters.add(new MappingJacksonHttpMessageConverter());
    }
    if (ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", classLoader)) {
View Full Code Here

    this.messageConverters.add(new StringHttpMessageConverter());
    this.messageConverters.add(new ResourceHttpMessageConverter());
    this.messageConverters.add(new SourceHttpMessageConverter());
    this.messageConverters.add(new XmlAwareFormHttpMessageConverter());
    if (jaxb2Present) {
      this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (jacksonPresent) {
      this.messageConverters.add(new MappingJacksonHttpMessageConverter());
    }
    if (romePresent) {
View Full Code Here

    if (romePresent) {
      messageConverters.add(new AtomFeedHttpMessageConverter());
      messageConverters.add(new RssChannelHttpMessageConverter());
    }
    if (jaxb2Present) {
      messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (jackson2Present) {
      messageConverters.add(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
View Full Code Here

        new Person("Yehudi Menuhin").setSomeBoolean(true));

    this.people = new PeopleWrapper(composers, performers);

    List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
    converters.add(new Jaxb2RootElementHttpMessageConverter());

    this.restTemplate = new RestTemplate();
    this.restTemplate.setMessageConverters(converters);

    this.mockServer = MockRestServiceServer.createServer(this.restTemplate);
View Full Code Here

        new Person("Robert Schumann").setSomeDouble(Double.NaN));

    this.people = new PeopleWrapper(composers);

    List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
    converters.add(new Jaxb2RootElementHttpMessageConverter());

    this.restTemplate = new RestTemplate();
    this.restTemplate.setMessageConverters(converters);

    this.mockServer = MockRestServiceServer.createServer(this.restTemplate);
View Full Code Here

        user.setName("zhang");

        String uri = baseUri;
        String createdLocation = baseUri + "/" + 1;

        restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(new Jaxb2RootElementHttpMessageConverter()));
        ResponseEntity<User> responseEntity = restTemplate.postForEntity(uri, user, User.class);

        assertEquals(createdLocation, responseEntity.getHeaders().get("Location").get(0));
        assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
        assertEquals(user, responseEntity.getBody());
View Full Code Here

        user.setName("zhang");

        String uri = baseUri;
        String createdLocation = baseUri + "/" + 1;

        restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(new Jaxb2RootElementHttpMessageConverter()));
        ResponseEntity<User> responseEntity = restTemplate.postForEntity(uri, user, User.class);

        assertEquals(createdLocation, responseEntity.getHeaders().get("Location").get(0));
        assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
View Full Code Here

        mockServer
                .expect(requestTo(uri))  //验证请求URI
                .andExpect(xpath("/user/name/text()").string(user.getName())) //验证请求的JSON数据
                .andRespond(withCreatedEntity(URI.create(createdLocation)).body(userXml).contentType(MediaType.APPLICATION_XML)); //添加响应信息

        restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(new Jaxb2RootElementHttpMessageConverter()));
        ResponseEntity<User> responseEntity = restTemplate.postForEntity(uri, user, User.class);

        assertEquals(createdLocation, responseEntity.getHeaders().get("Location").get(0));
        assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
View Full Code Here

TOP

Related Classes of org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter

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.