Well, FireFox is intended for *humans*, so what it does is *rendering* XML
as human-readable HTML. I doubt that this makes pretty sense for a
WebService, which obviously targets in *machines*. Or has JAX-RS just become
the better Servlet API meanwhile and is getting used as a replacement for
other rendering technologies like JSF? ;-)
> -----Original Message-----
> From: Marc.Hadley_at_Sun.COM [mailto:Marc.Hadley_at_Sun.COM]
> Sent: Dienstag, 23. März 2010 22:04
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] marshalling to html templates
>
> You can find the stylesheet that Firefox uses to convert XML to the
> nice HTML tree view you see by default here:
>
> chrome://global/content/xml/XMLPrettyPrint.xsl
>
> It should be possible to tweak this stylesheet with the addition of
> some templates for your elements that contain links to emit a
> surrounding <a href="...">...</a> element to make the links clickable.
>
> Marc.
>
> On Mar 23, 2010, at 4:14 PM, John Calcote wrote:
>
> > Well, mainly our objects are represented by XML data structures, many
> of which contain references to other resources; this is a restful web
> service that runs on XML. I know that restful web services can also be
> run very well on XHTML, which lends itself naturally to browsability.
> But JAXB supports XML (and JSON), not XHTML, so our service runs on
> XML, which isn't quite as easy to browse. Browsers do a good job of
> rendering XML generically, but can't tell the difference between a
> string and a link. I'd like to be able to transform the XML (perhaps
> using a style sheet) into something containing clickable links rather
> than simple strings at the appropriate places, so I don't have to
> manually modify the URL in my browser based on the contents of the XML
> doc I'm viewing.
> >
> > John
> >
> > On 3/23/2010 12:22 PM, Markus Karg wrote:
> >> Well, this just describes an obviously possible technical way, but
> it I
> >> think it would be more interesting to learn what actual semantic
> translation
> >> you like to reach: HTML is about structuring documents into
> chapters, so how
> >> do you plan to structure cars, printers or fruits with HTML?
> >>
> >>
> >>> -----Original Message-----
> >>> From: John Calcote [mailto:john.calcote_at_gmail.com]
> >>> Sent: Montag, 22. März 2010 22:28
> >>> To: users_at_jersey.dev.java.net
> >>> Cc: Markus Karg
> >>> Subject: Re: [Jersey] marshalling to html templates
> >>>
> >>> I've been trying to figure out how to render POJO's into HTML
> documents
> >>> for ReST API browsability. I've since discovered a mechanism that I
> >>> think may just work for me. I'll use JAXB to marshall to XML, then
> (on
> >>> detection of a request for text/html listed first in the accept
> header)
> >>> use JAXP to transform XML to HTML using an XSLT style sheet.
> >>>
> >>> John
> >>>
> >>> On 3/22/2010 12:42 PM, Markus Karg wrote:
> >>>
> >>>> I can imagine that JAXB would be a perfect fit for solutions that
> >>>>
> >>> natively
> >>>
> >>>> deal with documents, since HTML obviously is THE description for
> >>>>
> >>> documents.
> >>>
> >>>> But I actually wonder what the sense of JAXB-to-HTML shall be like
> in
> >>>>
> >>> a
> >>>
> >>>> generic way? I mean, how to encode a "chair", "fruit", or "car"
> into
> >>>>
> >>> a HTML
> >>>
> >>>> document? Ain't it more the case (like Paul says) that you like to
> >>>>
> >>> view
> >>>
> >>>> *descriptions* of objects (i. e. XML ---> XSL ---> HTML)
> instead of
> >>>>
> >>> objects
> >>>
> >>>> themselves?
> >>>>
> >>>>
> >>>>
> >>>>> -----Original Message-----
> >>>>> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
> >>>>> Sent: Montag, 22. März 2010 11:30
> >>>>> To: users_at_jersey.dev.java.net
> >>>>> Subject: Re: [Jersey] marshalling to html templates
> >>>>>
> >>>>> Hi John,
> >>>>>
> >>>>> On Mar 18, 2010, at 6:18 PM, John Calcote wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>> Has anyone ever considered using JAXB and HTML templates to
> >>>>>>
> >>> marshall
> >>>
> >>>>>> Java objects to/from HTML?
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>> There is nothing specifically in JAXB support that, so it would
> >>>>> require some addition stuff. An XML style sheet would IMHO be the
> >>>>>
> >>> best
> >>>
> >>>>> fit, XML to HTML or XHTML, rather than code that operates on the
> >>>>>
> >>> JAXB
> >>>
> >>>>> related classes.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> Seems like a useful thing to do, and I've got a use case for it
> at
> >>>>>> the moment. I have a ReST webapp and client that exchange XML
> >>>>>> messages. For testing and browsability, it would be nice to
> support
> >>>>>> text/html as an accept header mimetype from the browser.
> >>>>>>
> >>>>>> Thoughts?
> >>>>>>
> >>>>>>
> >>>>> That should be possible if you reference a style sheet with the
> XML.
> >>>>> Browsers should be able to process the XML and apply the style
> >>>>>
> >>> sheet.
> >>>
> >>>>> In JAXB one can set the style sheet on the marshaller using the
> >>>>> property:
> >>>>>
> >>>>> https://jaxb.dev.java.net/nonav/2.1.10/docs/
> >>>>> vendorProperties.html#xmlheader
> >>>>> http://n2.nabble.com/Marshaling-JAXB-objects-including-
> >>>>>
> >>> stylesheet-
> >>>
> >>>>> information-td2429726.html
> >>>>>
> >>>>> In JAX-RS/Jersey you can supply a ContextResolver<Marshaller>
> for
> >>>>>
> >>> the
> >>>
> >>>>> JAXB objects.
> >>>>>
> >>>>> Two alternatives if the server supports such style sheet
> >>>>> transformation:
> >>>>>
> >>>>> - write a message body writer supporting JAXB and text/html and
> >>>>>
> >>> reuse
> >>>
> >>>>> the JAXB XML support via the injected Providers interface.
> >>>>>
> >>>>> - write a template provider such that one can specify the style
> >>>>>
> >>> sheet
> >>>
> >>>>> as a view.
> >>>>>
> >>>>> return new Viewable("mystylesheet.xml", myJaxbInstance);
> >>>>>
> >>>>> Paul.
> >>>>>
> >>>>>
> >>>>> -----------------------------------------------------------------
> ---
> >>>>>
> >>> -
> >>>
> >>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> >>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >>>>>
> >>>>>
> >>>> ------------------------------------------------------------------
> ---
> >>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> >>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>> -------------------------------------------------------------------
> --
> >>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> >>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >>>
> >>
> >> --------------------------------------------------------------------
> -
> >> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> >> For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net