Package org.jboss.resteasy.plugins.providers.atom

Examples of org.jboss.resteasy.plugins.providers.atom.Content


      @Produces("application/atom+xml")
      public Entry getEntry()
      {
         Entry entry = new Entry();
         entry.setTitle("Hello World");
         Content content = new Content();
         content.setJAXBObject(new CustomerAtom("bill"));
         entry.setContent(content);
         return entry;
      }
View Full Code Here


      @Produces("application/atom+xml")
      public Entry getTextEntry()
      {
         Entry entry = new Entry();
         entry.setTitle("Hello World");
         Content content = new Content();
         content.setText("<pre>How are you today?\nNotBad!</pre>");
         content.setType(MediaType.TEXT_HTML_TYPE);
         entry.setContent(content);
         return entry;
      }
View Full Code Here

      @Produces("application/atom+xml")
      public Entry getXmlType()
      {
         Entry entry = new Entry();
         entry.setTitle("Hello World");
         Content content = new Content();
         DataCollectionRecord record = new DataCollectionRecord();
         record.setCollectedData("hello world");
         content.setJAXBObject(record);
         entry.setContent(content);
         return entry;

      }
View Full Code Here

                new Link(
                    "alternate",
                    eventURI,
                    MediaType.APPLICATION_JSON_TYPE));

            Content content = new Content();
            content.setType(MediaType.APPLICATION_XML_TYPE);
            content.setJAXBObject(e);
            entry.setContent(content);
            entry.setSummary(e.getMessageText());
            feed.getEntries().add(entry);
        }
        // Use the most recent event as the feed's published time. Assumes events do not
View Full Code Here

        atomAssetMetadata.setArchived(false);
        atomAssetMetadata.setUuid("testuuid");

        entry.setAnyOtherJAXBObject(atomAssetMetadata);

        Content content = new Content();
        content.setSrc(UriBuilder.fromUri(baseUri).path("binary").build());
        content.setType(MediaType.APPLICATION_OCTET_STREAM_TYPE);

        entry.setContent(content);

        return entry;
    }
View Full Code Here

   @Test
   public void testContentText() throws Exception
   {
      JAXBContext ctx = JAXBContext.newInstance(Content.class);
      Content content = (Content) ctx.createUnmarshaller().unmarshal(new StringReader(XML));
      System.out.println(content.getText());
      System.out.println(content.getLanguage());

   }
View Full Code Here

    * @throws Exception
    */
   @Test
   public void testContentSetElement() throws Exception
   {
      Content c = new Content();
      c.setElement(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument().createElement("Test"));
   }
View Full Code Here

   @Test
   public void testContent() throws Exception
   {

      Content content = new Content();
      content.setJAXBObject(new CustomerAtom("bill"));
      JAXBContext ctx = JAXBContext.newInstance(Content.class, CustomerAtom.class);

      Marshaller marshaller = ctx.createMarshaller();

      marshaller.setProperty("com.sun.xml.bind.indentString", "   ");
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
      StringWriter writer = new StringWriter();

      NamespacePrefixMapper mapper = new NamespacePrefixMapper()
      {
         public String getPreferredPrefix(String namespace, String s1, boolean b)
         {
            if (namespace.equals("http://www.w3.org/2005/Atom"))
            {
               return "atom";
            }
            else return s1;
         }
      };

      ClassResolver resolver = new ClassResolver()
      {
         @Nullable
         public Class<?> resolveElementName(@NotNull String ns, @NotNull String location) throws Exception
         {
            System.out.println("Resolve: " + ns + " " + location);
            return null;
         }
      };

      //marshaller.setProperty(ClassResolver.class.getName(), resolver);

      marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", mapper);
      marshaller.marshal(content, writer);
      marshaller.marshal(content, System.out);

      System.out.println("**********");
      System.out.println(writer.toString());
      content = (Content) ctx.createUnmarshaller().unmarshal(new StringReader(writer.toString()));

      //JAXBElement<Customer> cust = ctx.createUnmarshaller().unmarshal(node, Customer.class);
      //System.out.println(cust.getValue().getName());

      CustomerAtom cust = content.getJAXBObject(CustomerAtom.class);
      System.out.println(cust.getName());
   }
View Full Code Here

      @Produces("application/atom+xml")
      public Entry getEntry()
      {
         Entry entry = new Entry();
         entry.setTitle("Hello World");
         Content content = new Content();
         content.setJAXBObject(new CustomerAtom("bill"));
         entry.setContent(content);
         return entry;
      }
View Full Code Here

      @Produces("application/atom+xml")
      public Entry getTextEntry()
      {
         Entry entry = new Entry();
         entry.setTitle("Hello World");
         Content content = new Content();
         content.setText("<pre>How are you today?\nNotBad!</pre>");
         content.setType(MediaType.TEXT_HTML_TYPE);
         entry.setContent(content);
         return entry;
      }
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.plugins.providers.atom.Content

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.