You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ricky Szeto <rs...@cryptologic.com> on 2000/01/31 20:42:24 UTC
Cocoon Questions...
I am in the process of migrating a site from being http-servlet based to
xml-cocoon based. I have two questions that I have been unable to find
answers for:
1) Is there a method of passing initial arguments to a producer? such as
key-value pairs?
and also
2) Short of writing my own processor, what method/way can I use to get
access to HttpServletResponse.encodeURL() ?
Any help is appreciated.
Coccon and XQL queries
Posted by Zeljko Trogrlic <vl...@os.tel.hr>.
Hello,
I plan to use Cocoon with XML database. Database communicates through HTTP
protocol. You send query in a form of get request, and database returns XML
document. Document does not contain name of XSL.
My question is: what's the best way to pass XQL query and name of the
stylesheet and get result from Cocoon?
Thanks.
v
Zeljko Trogrlic
____________________________________________________________
Aeris d.o.o.
Sv. Petka 60 b, HR-31000 Osijek, Croatia
Tel: +385 (31) 50 06 75
Email: mailto:vlatko.trogrlic@os.tel.hr
Re: Cocoon Questions...
Posted by Eric SCHAEFFER <es...@posterconseil.com>.
I tried this to configure my producer, and I found that you need to specify
the producer nickname in the init function...
(I use Cocoon 1.6.1)
(in "file" producer)
public void init(Configurations conf) {
String binary = (String) conf.get("file.binary");
...
}
Eric.
_______________________________________
Eric SCHAEFFER
eschaeffer@posterconseil.com
POSTER CONSEIL
118 rue de Tocqueville
75017 PARIS
FRANCE
Tel. : 33-140541058
Fax : 33-140541059
_______________________________________
----------------------------------------------------------------------------
-----------------------------
Come to the first official Apache Software Foundation Conference!
-----------------------------------
http://ApacheCon.Com ------------------------------------
----- Original Message -----
From: Stefano Mazzocchi <st...@apache.org>
To: <co...@xml.apache.org>
Sent: Tuesday, February 01, 2000 12:05 AM
Subject: Re: Cocoon Questions...
> Mike Engelhart wrote:
> >
> > Ricky Szeto wrote:
> >
> > > Maybe I need to clarify my first question a bit...
> > > I need to pass arguments to the producers only once regarding
initialization
> > > and configuration(ie where the properties file is, where a resource
directory
> > > is.. etc)
> > > I would like to do it such that it is done automatically after the
> > > instantiation of the Producer(before it begins service).
> > >
> > > As for the response obj, looks like I do more reading before I can
decide
> > > which is the best way to go...
> > Sorry about that. I misunderstood. hmmm.... have your tried overriding
> > init()? I"m not sure I understand where in the chain of events you need
to
> > initialize the Producer? I mean isn't it potentially created each time
it is
> > accessed, that is if it's not in the cache somewhere? I don't really
know
>
> Make your producer implement Configurable.
>
> Then write your configurations in cocoon.properties such as
>
> producer.xxx.yyy = zzz
>
> where
>
> xxx is the nickname of the producer (for example, "file")
> yyy is the property you want (for example, "binary")
> zzz is the value (for example. "false)
>
> so
>
> producer.file.binary="false"
>
> then in your code you write
>
> public void init(Configurations conf) {
> String binary = (String) conf.get("binary");
> ...
> }
>
> NOTE: Cocoon will take care of removing the front stuff from your
> configuration keys, so that if you change the nickname of your producer,
> your code doesn't change (separation of contexts all over the place :)
>
> All the cocoon modules work that way.
>
> --
> Stefano Mazzocchi One must still have chaos in oneself to be
> able to give birth to a dancing star.
> <st...@apache.org> Friedrich Nietzsche
> --------------------------------------------------------------------
> Come to the first official Apache Software Foundation Conference!
> ------------------------- http://ApacheCon.Com ---------------------
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
Re: Cocoon Questions...
Posted by Stefano Mazzocchi <st...@apache.org>.
Mike Engelhart wrote:
>
> Ricky Szeto wrote:
>
> > Maybe I need to clarify my first question a bit...
> > I need to pass arguments to the producers only once regarding initialization
> > and configuration(ie where the properties file is, where a resource directory
> > is.. etc)
> > I would like to do it such that it is done automatically after the
> > instantiation of the Producer(before it begins service).
> >
> > As for the response obj, looks like I do more reading before I can decide
> > which is the best way to go...
> Sorry about that. I misunderstood. hmmm.... have your tried overriding
> init()? I"m not sure I understand where in the chain of events you need to
> initialize the Producer? I mean isn't it potentially created each time it is
> accessed, that is if it's not in the cache somewhere? I don't really know
Make your producer implement Configurable.
Then write your configurations in cocoon.properties such as
producer.xxx.yyy = zzz
where
xxx is the nickname of the producer (for example, "file")
yyy is the property you want (for example, "binary")
zzz is the value (for example. "false)
so
producer.file.binary="false"
then in your code you write
public void init(Configurations conf) {
String binary = (String) conf.get("binary");
...
}
NOTE: Cocoon will take care of removing the front stuff from your
configuration keys, so that if you change the nickname of your producer,
your code doesn't change (separation of contexts all over the place :)
All the cocoon modules work that way.
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Come to the first official Apache Software Foundation Conference!
------------------------- http://ApacheCon.Com ---------------------
Re: Cocoon Questions...
Posted by Mike Engelhart <me...@earthtrip.com>.
Ricky Szeto wrote:
> Maybe I need to clarify my first question a bit...
> I need to pass arguments to the producers only once regarding initialization
> and configuration(ie where the properties file is, where a resource directory
> is.. etc)
> I would like to do it such that it is done automatically after the
> instantiation of the Producer(before it begins service).
>
> As for the response obj, looks like I do more reading before I can decide
> which is the best way to go...
Sorry about that. I misunderstood. hmmm.... have your tried overriding
init()? I"m not sure I understand where in the chain of events you need to
initialize the Producer? I mean isn't it potentially created each time it is
accessed, that is if it's not in the cache somewhere? I don't really know
Mike
Re: Cocoon Questions...
Posted by Ricky Szeto <rs...@cryptologic.com>.
Maybe I need to clarify my first question a bit...
I need to pass arguments to the producers only once regarding initialization
and configuration(ie where the properties file is, where a resource directory
is.. etc)
I would like to do it such that it is done automatically after the
instantiation of the Producer(before it begins service).
As for the response obj, looks like I do more reading before I can decide
which is the best way to go...
Thanx Mike
Mike Engelhart wrote:
> Ricky Szeto wrote:
>
> > I am in the process of migrating a site from being http-servlet based to
> > xml-cocoon based. I have two questions that I have been unable to find
> > answers for:
> > 1) Is there a method of passing initial arguments to a producer? such as
> > key-value pairs?
> > and also
>
> Just add the values to the url like you would with a GET/POST from a form:
> yourProducer.xml?PARAM1=one&PARAM2=two
>
> The getDocument() methods of all producers have access to the
> HttpServletRequest object so you can say:
> String paramOne = request.getParameter("PARAM1");
>
> > 2) Short of writing my own processor, what method/way can I use to get
> > access to HttpServletResponse.encodeURL() ?
> >
>
> One way is to use XSP's to create your producers. This makes developing
> producers extremely easy and the XSP classes have a wrapper for the
> HttpServletResponse object so you can use encodeURL() with it.
>
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
Re: Cocoon Questions...
Posted by Mike Engelhart <me...@earthtrip.com>.
Ricky Szeto wrote:
> I am in the process of migrating a site from being http-servlet based to
> xml-cocoon based. I have two questions that I have been unable to find
> answers for:
> 1) Is there a method of passing initial arguments to a producer? such as
> key-value pairs?
> and also
Just add the values to the url like you would with a GET/POST from a form:
yourProducer.xml?PARAM1=one&PARAM2=two
The getDocument() methods of all producers have access to the
HttpServletRequest object so you can say:
String paramOne = request.getParameter("PARAM1");
> 2) Short of writing my own processor, what method/way can I use to get
> access to HttpServletResponse.encodeURL() ?
>
One way is to use XSP's to create your producers. This makes developing
producers extremely easy and the XSP classes have a wrapper for the
HttpServletResponse object so you can use encodeURL() with it.
Mike