users@jersey.java.net

Re: Chain of readers/writers

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 14 Jan 2008 11:41:48 +0100

Hi Jose,

Jose Antonio Illescas del Olmo wrote:
> Is there something as a chain of readers/writers?
>

No, not directly (see below).


> Can you see as filter(on servlet environment) or standar Readers/Writers
> or XSLT pipeline (output of a Writer is the input of another Writer)
>
> Java Instance -[XMLWriter]-> XML -[XSLWriter]-> XSL-FO
> -[FOPWriter]-> PDF
>
> Can be very useful...
>

The current way the readers/writers are defined i am not sure it makes
much sense. In your example the resulting media type would be PDF but
the starting media type would i presume be XML? nor would be very
efficient since the contract of chaining, as the interfaces are
currently defined, would be the media type and bytes.

IMHO the best approach to chaining (which i think is related to Frank's
email) would be to plug a chaining mechanism supported by a writer. Thus
the writer is kept simple with a clear relationship between a resource,
a returned Java type and a media type, but it is possible to adapt and
add your own features in an implementation.

For the 0.6 release we will be working towards a more modular approach
to readers and writers such that a HTTP method can return a model
instance and that model can be transformed to the produced media type.

Then we want to support pluggable transforming engines (e.g. like
Velocity). I think this is the place where transforming filters might
work best. Since often when transforming there is another piece of
information that declares the structure of the content that is to be
transformed and the flow of transformation.

I believe one approach that might be interesting to experiment with that
could support your requirements is an XProc [1] writer. There could be a
XProc document associated with the resource and a XProc writer takes the
document (much like a JSP engine takes a JSP document) and the model.

Paul.

[1] http://www.w3.org/TR/xproc/

>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net For
> additional commands, e-mail: users-help_at_jersey.dev.java.net

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109