Package org.springframework.web.servlet.view.xml

Examples of org.springframework.web.servlet.view.xml.MarshallingView


      ViewResolver viewResolver = new ViewResolver() {
        @Override
        public View resolveViewName(String viewName, Locale locale) throws Exception {
          XStreamMarshaller marshaller = new XStreamMarshaller();
          marshaller.setAutodetectAnnotations(true);
          MarshallingView view = new MarshallingView(marshaller);
         
          return view;
        }
      };
     
View Full Code Here


  public void testXmlOnly() throws Exception {

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Person.class);

    standaloneSetup(new PersonController()).setSingleView(new MarshallingView(marshaller)).build()
      .perform(get("/person/Corea"))
        .andExpect(status().isOk())
        .andExpect(content().mimeType(MediaType.APPLICATION_XML))
        .andExpect(xpath("/person/name/text()").string(equalTo("Corea")));
  }
View Full Code Here

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Person.class);

    List<View> viewList = new ArrayList<View>();
    viewList.add(new MappingJacksonJsonView());
    viewList.add(new MarshallingView(marshaller));

    ContentNegotiatingViewResolver cnViewResolver = new ContentNegotiatingViewResolver();
    cnViewResolver.setDefaultViews(viewList);
    cnViewResolver.setDefaultContentType(MediaType.TEXT_HTML);
View Full Code Here

    this.registry.enableContentNegotiation(view1);

    ContentNegotiatingViewResolver resolver1 = checkAndGetResolver(ContentNegotiatingViewResolver.class);
    assertEquals(Arrays.asList(view1), resolver1.getDefaultViews());

    MarshallingView view2 = new MarshallingView();
    this.registry.enableContentNegotiation(view2);

    ContentNegotiatingViewResolver resolver2 = checkAndGetResolver(ContentNegotiatingViewResolver.class);
    assertEquals(Arrays.asList(view1, view2), resolver2.getDefaultViews());
    assertSame(resolver1, resolver2);
View Full Code Here

  public void testXmlOnly() throws Exception {

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Person.class);

    standaloneSetup(new PersonController()).setSingleView(new MarshallingView(marshaller)).build()
      .perform(get("/person/Corea"))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_XML))
        .andExpect(xpath("/person/name/text()").string(equalTo("Corea")));
  }
View Full Code Here

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Person.class);

    List<View> viewList = new ArrayList<View>();
    viewList.add(new MappingJackson2JsonView());
    viewList.add(new MarshallingView(marshaller));

    ContentNegotiationManager manager = new ContentNegotiationManager(
        new HeaderContentNegotiationStrategy(), new FixedContentNegotiationStrategy(MediaType.TEXT_HTML));

    ContentNegotiatingViewResolver cnViewResolver = new ContentNegotiatingViewResolver();
View Full Code Here

      ViewResolver viewResolver = new ViewResolver() {
        @Override
        public View resolveViewName(String viewName, Locale locale) throws Exception {
          XStreamMarshaller marshaller = new XStreamMarshaller();
          marshaller.setAutodetectAnnotations(true);
          MarshallingView view = new MarshallingView(marshaller);
         
          return view;
        }
      };
     
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.view.xml.MarshallingView

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.