You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Gianugo Rabellino <g....@bibop.it> on 2001/08/30 23:47:30 UTC

Confused about serialization API

Hi,

I'm a bit confused about the serialization API in Cocoon 2. I'm writing a
serializer and I need access to some informations normally available in
generators/transformers via the Map passed in the setup() method. I see that
serializers do not have this approach, all they need is to set the
OutputStream to write to. Is that on purpose or am I missing something?  Is
there a way to retrieve the information I need?

TIA,

--
Gianugo Rabellino


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: Confused about serialization API

Posted by giacomo <gi...@apache.org>.
On Fri, 31 Aug 2001, Gianugo Rabellino wrote:

> On Fri, Aug 31, 2001 at 06:24:08AM -0700, Davanum Srinivas wrote:
>
> > As i answered earlier, you can inject a transformer in between that will resolver the relative
> > URL's and pump in the absolute url's just before your serializer is called. Will this work?
>
> It will certainly. Probably a plain XSLT transformation with some
> string manipulation would be enough to make URLs absolute so
> there's even no need to write a custom transformer.
>
> I'm still wondering, though, even after reading some mail
> archives, what's wrong inside the idea of Serializers being
> part as a whole of the Cocoon system with access to the
> execution environment: most probably I'm not
> getting the point, but I can't see what would be wrong in
> having even those components know about the context they're
> running into. Giacomo said in a previous thread:
>
> > I'm still not conviced about the change and thus are -1 until someone
> > come along with better arguments why a serializer need access to the
> > environment.

Yes, I've said that and to tell you why I need to dig deep into a mail
archive to get the answers why we've decided to have the
serializers
do exactly this sole thing (serializing) without they have a need of the
environmental things they run in. This makes serializers as simple as
possible and thus we don't pass them any objectModel etc.

I'm honest, I don't remember why we decided that way.

Giacomo

>
> My argument in favor of the setup() approach is that I just
> banged my head against the wall of not being able to resolve
> relative URLs. This is not allowing me to insert images inside
> PDF files, just to cite an example.
>
> I'm not getting how putting another transformation
> step instead of getting a parameter from the environment can
> be a better solution: I tend to think that in the best case
> it turns out into an error-prone, difficult to maintain
> and redundant sitemap, if a serialization to some particular
> formats (actually any XSL:FO format as far as I can tell)
> needs a transformation just for being usable by the serializer.
>
> I'm not arguing at all, actually I assume that if this has
> been done on purpose and discussed there must have been a very
> good reason: I just would like to be enlightened on this
> issue, since probably I'm not getting a basic point in the
> Cocoon flow and design. Please shed some light. :)
>
> Thanks again,
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: Confused about serialization API

Posted by Gianugo Rabellino <g....@bibop.it>.
On Fri, Aug 31, 2001 at 06:24:08AM -0700, Davanum Srinivas wrote:

> As i answered earlier, you can inject a transformer in between that will resolver the relative
> URL's and pump in the absolute url's just before your serializer is called. Will this work?

It will certainly. Probably a plain XSLT transformation with some
string manipulation would be enough to make URLs absolute so 
there's even no need to write a custom transformer.

I'm still wondering, though, even after reading some mail 
archives, what's wrong inside the idea of Serializers being
part as a whole of the Cocoon system with access to the
execution environment: most probably I'm not
getting the point, but I can't see what would be wrong in 
having even those components know about the context they're
running into. Giacomo said in a previous thread:

> I'm still not conviced about the change and thus are -1 until someone
> come along with better arguments why a serializer need access to the
> environment.

My argument in favor of the setup() approach is that I just
banged my head against the wall of not being able to resolve
relative URLs. This is not allowing me to insert images inside
PDF files, just to cite an example. 

I'm not getting how putting another transformation
step instead of getting a parameter from the environment can
be a better solution: I tend to think that in the best case
it turns out into an error-prone, difficult to maintain
and redundant sitemap, if a serialization to some particular 
formats (actually any XSL:FO format as far as I can tell) 
needs a transformation just for being usable by the serializer.

I'm not arguing at all, actually I assume that if this has
been done on purpose and discussed there must have been a very 
good reason: I just would like to be enlightened on this
issue, since probably I'm not getting a basic point in the
Cocoon flow and design. Please shed some light. :)

Thanks again,

-- 
Gianugo Rabellino

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: Confused about serialization API

Posted by Davanum Srinivas <di...@yahoo.com>.
Gianugo,

As i answered earlier, you can inject a transformer in between that will resolver the relative
URL's and pump in the absolute url's just before your serializer is called. Will this work?

Please don't treat my answer as absolute. Let us get others opinion as well. Also see previous
email discussion on the subject:

http://mailman.real-time.com/pipermail/cocoon-devel/2001-May/007246.html
http://mailman.real-time.com/pipermail/cocoon-devel/2001-May/007246.html

Thanks,
dims

--- Gianugo Rabellino <g....@bibop.it> wrote:
> Dims,
> 
> thanks for your reply. I'm quite surprised of this approach
> and would really appreciate to get a grasp on the reason
> for doing this (since I'm sure there must be a good one :)).
> 
> I'm still a bit confused and hope there is a way to get 
> around this issue: actually my problem is to resolve relative
> URL in document streams (which is not an issue for HTML where
> URLs are resolved by a browser but it's a serious limitations 
> for serializers based on XSL:FO, since they need to embed 
> the resource right into the stream). AFAIK this is not possible
> even with the current FOPSerializer, which doesn't work - at
> least on my setup - with relative URLs and this can be quite 
> an issue for applications that need to generate formats other
> than HTML. Should I assume that the official Cocoon answer is
> "keep your links absolute"? 
> 
> Thanks again,
> 
> -- 
> Gianugo Rabellino
> 
> 
> On Fri, Aug 31, 2001 at 05:11:42AM -0700, Davanum Srinivas wrote:
> > Gianugo,
> > 
> > Yes. This is on purpose. If you are really keen on it, then you can add a new transformer that
> can
> > modify the sax stream as needed, followed by one of the regular serializers like XML or HTML
> > serializer.
> > 
> > Thanks,
> > dims
> > 
> > --- Gianugo Rabellino <g....@bibop.it> wrote:
> > > Hi,
> > > 
> > > I'm a bit confused about the serialization API in Cocoon 2. I'm writing a
> > > serializer and I need access to some informations normally available in
> > > generators/transformers via the Map passed in the setup() method. I see that
> > > serializers do not have this approach, all they need is to set the
> > > OutputStream to write to. Is that on purpose or am I missing something?  Is
> > > there a way to retrieve the information I need?
> > > 
> > > TIA,
> > > 
> > > --
> > > Gianugo Rabellino
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > > 
> > 
> > 
> > =====
> > Davanum Srinivas, JNI-FAQ Manager
> > http://www.jGuru.com/faq/JNI
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
> > http://im.yahoo.com
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> > 
> 
> -- 
> Gianugo Rabellino                             Via Comune Antico, 43
> C.T.O.                                    20125 Milano (MI) - Italy
> Bibop Research, Int. S.p.A.     info@bibop.it - http://www.bibop.it
> 
>   "No fim tudo acaba bem. Se ainda nao esta bem, e' porque ainda 
>    nao chegou ao fim" - Fernando Sabino
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: Confused about serialization API

Posted by Gianugo Rabellino <g....@bibop.it>.
Dims,

thanks for your reply. I'm quite surprised of this approach
and would really appreciate to get a grasp on the reason
for doing this (since I'm sure there must be a good one :)).

I'm still a bit confused and hope there is a way to get 
around this issue: actually my problem is to resolve relative
URL in document streams (which is not an issue for HTML where
URLs are resolved by a browser but it's a serious limitations 
for serializers based on XSL:FO, since they need to embed 
the resource right into the stream). AFAIK this is not possible
even with the current FOPSerializer, which doesn't work - at
least on my setup - with relative URLs and this can be quite 
an issue for applications that need to generate formats other
than HTML. Should I assume that the official Cocoon answer is
"keep your links absolute"? 

Thanks again,

-- 
Gianugo Rabellino


On Fri, Aug 31, 2001 at 05:11:42AM -0700, Davanum Srinivas wrote:
> Gianugo,
> 
> Yes. This is on purpose. If you are really keen on it, then you can add a new transformer that can
> modify the sax stream as needed, followed by one of the regular serializers like XML or HTML
> serializer.
> 
> Thanks,
> dims
> 
> --- Gianugo Rabellino <g....@bibop.it> wrote:
> > Hi,
> > 
> > I'm a bit confused about the serialization API in Cocoon 2. I'm writing a
> > serializer and I need access to some informations normally available in
> > generators/transformers via the Map passed in the setup() method. I see that
> > serializers do not have this approach, all they need is to set the
> > OutputStream to write to. Is that on purpose or am I missing something?  Is
> > there a way to retrieve the information I need?
> > 
> > TIA,
> > 
> > --
> > Gianugo Rabellino
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> > 
> 
> 
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
> 
> __________________________________________________
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
> http://im.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 

-- 
Gianugo Rabellino                             Via Comune Antico, 43
C.T.O.                                    20125 Milano (MI) - Italy
Bibop Research, Int. S.p.A.     info@bibop.it - http://www.bibop.it

  "No fim tudo acaba bem. Se ainda nao esta bem, e' porque ainda 
   nao chegou ao fim" - Fernando Sabino

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: Confused about serialization API

Posted by Davanum Srinivas <di...@yahoo.com>.
Gianugo,

Yes. This is on purpose. If you are really keen on it, then you can add a new transformer that can
modify the sax stream as needed, followed by one of the regular serializers like XML or HTML
serializer.

Thanks,
dims

--- Gianugo Rabellino <g....@bibop.it> wrote:
> Hi,
> 
> I'm a bit confused about the serialization API in Cocoon 2. I'm writing a
> serializer and I need access to some informations normally available in
> generators/transformers via the Map passed in the setup() method. I see that
> serializers do not have this approach, all they need is to set the
> OutputStream to write to. Is that on purpose or am I missing something?  Is
> there a way to retrieve the information I need?
> 
> TIA,
> 
> --
> Gianugo Rabellino
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org