Examples of createUnmarshaller()


Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations);
         Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream);
         if (entry.getContent() != null) entry.getContent().setFinder(finder);
         return entry;
      }
      catch (JAXBException e)
      {
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations);
         Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream);
         for (Entry entry : feed.getEntries())
         {
            if (entry.getContent() != null) entry.getContent().setFinder(finder);
         }
         return feed;
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

      throws IOException {
    try {
      InputPart rootPart = xopPackage.getRootPart();
      JAXBContext jaxb = findJAXBContext(type, annotations, rootPart
          .getMediaType(), true);
      Unmarshaller unmarshaller = jaxb.createUnmarshaller();
      unmarshaller
          .setAttachmentUnmarshaller(new XopAttachmentUnmarshaller(
              xopPackage));
      return unmarshaller.unmarshal(new StreamSource(rootPart.getBody(
          InputStream.class, null)));
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

            catch (NumberFormatException ignored)
            {
            }
         }
         JAXBContext jaxb = findJAXBContext(type, annotations, mediaType, true);
         Unmarshaller unmarshaller = jaxb.createUnmarshaller();
         unmarshaller = decorateUnmarshaller(type, annotations, mediaType, unmarshaller);
         return (T) unmarshaller.unmarshal(new StreamSource(entityStream));
      }
      catch (JAXBException e)
      {
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

      @Consumes(MediaType.APPLICATION_ATOM_XML)
      public void putFeed(Feed feed) throws Exception
      {
         String content = feed.getEntries().get(0).getContent();
         JAXBContext ctx = JAXBContext.newInstance(Customer.class);
         Customer cust = (Customer) ctx.createUnmarshaller().unmarshal(new StringReader(content));
         Assert.assertEquals("bill", cust.getName());

      }

      @GET
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

   public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException
   {
      try
      {
         JAXBContext jaxb = findJAXBContext(type, annotations, mediaType, true);
         Unmarshaller unmarshaller = jaxb.createUnmarshaller();
         Object obj = unmarshaller.unmarshal(entityStream);
         if (obj instanceof JAXBElement)
         {
            JAXBElement element = (JAXBElement) obj;
            return element.getValue();
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

      @Consumes(MediaType.APPLICATION_ATOM_XML)
      public void putFeed(Entry entry) throws Exception
      {
         String content = entry.getContent();
         JAXBContext ctx = JAXBContext.newInstance(Customer.class);
         Customer cust = (Customer) ctx.createUnmarshaller().unmarshal(new StringReader(content));
         Assert.assertEquals("bill", cust.getName());

      }
   }
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

      PostMethod method = new PostMethod(url);
      method.addRequestHeader("Content-Type", "application/xml");
      method.setRequestBody(s);
      int status = client.executeMethod(method);
      Assert.assertEquals(200, status);
      foo = (RealFoo) ctx.createUnmarshaller().unmarshal(method.getResponseBodyAsStream());
      Assert.assertEquals(((RealFoo) foo).getName(), "bill");
   }

}
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

      System.out.println(s);

      ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
      StreamSource source = new StreamSource(is);
      JAXBContext ctx2 = JAXBContext.newInstance(JaxbMap.class);
      element = ctx2.createUnmarshaller().unmarshal(source, JaxbMap.class);

      Element entry = (Element) element.getValue().getValue().get(0);

      JAXBContext ctx3 = JAXBContext.newInstance(JaxbMap.Entry.class);
      JAXBElement<JaxbMap.Entry> e = ctx3.createUnmarshaller().unmarshal(entry, JaxbMap.Entry.class);
View Full Code Here

Examples of javax.xml.bind.JAXBContext.createUnmarshaller()

      element = ctx2.createUnmarshaller().unmarshal(source, JaxbMap.class);

      Element entry = (Element) element.getValue().getValue().get(0);

      JAXBContext ctx3 = JAXBContext.newInstance(JaxbMap.Entry.class);
      JAXBElement<JaxbMap.Entry> e = ctx3.createUnmarshaller().unmarshal(entry, JaxbMap.Entry.class);

      System.out.println("hello");

   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.