You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Kavanagh <da...@dotech.com> on 2003/03/14 02:16:17 UTC

is this kosher?

I've written this HTTPTransformer which takes some simple XML containing 
link information (href, method) and returns either html (run through 
JTidy), xml (from the web server), or xml containing the location of the 
file that was downloaded (if type wasn't text/html* or text/xml*). Now, 
I'd like to be able to return the HTTP response code in a way that would 
let a selector decide what to do next.
Would it be taboo to add a parameter to those passed in via the setup() 
method on AbstractSAXTransformer? Would that parameter even become 
available, or is this one just a private copy?
I was thinking I'd also write a simple selector (like the 
ParameterSelector) which would take a list of strings to be tested (i.e. 
test="one|two|three|four"). That way, I can check for a bunch of return 
codes. The other option is to write a selector that understands some 
better expressions like test="param<500 && param >=400".
Please tell me if I'm barking up the wrong tree, or of someone has 
already implemented something like I'm talking about. I do have the 
HTTPTransformer working, I just need to address the return code issue. 
I'd prefer to have the sitemap define the action based on result code.

Thanks,
David


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


Re: is this kosher?

Posted by Irv Salisbury III <ir...@dotech.com>.
Couple of thoughts here.  First, if you are suggesting adding an extra 
parameter to the signature call of the setup method, that won't work.  I 
don't think that is what you are asking, but I'd thought I'd address it 
anyway.  

Second, I think there is a slightly different way to go about doing 
this.  Have your HTTPTransformer dump the response code and any other 
relevant data into an XML structure, and put this structure BOTH in the 
pipeline and in the session.  (You could also just use a simple session 
attribute like HTTPTransformer-RESPONSE-CODE) This lets users of your 
HTTPTransformer either use another transformer to deal with the response 
codes, or use actions,selectors, etc to deal with the response, as they 
all have access to the session.  I am defintely more partial to actions, 
as they can do all the work of a selector and more.

I don't know if it is possible or not, but your HTTPTransformer could 
also be rewritten as an action, which would let it do it's work and 
return the response code all in one shot.  If all your HTTPTransformer 
takes in is an href and a method, this wouldn't be a huge deal.  

Irv

David Kavanagh wrote:

> I've written this HTTPTransformer which takes some simple XML 
> containing link information (href, method) and returns either html 
> (run through JTidy), xml (from the web server), or xml containing the 
> location of the file that was downloaded (if type wasn't text/html* or 
> text/xml*). Now, I'd like to be able to return the HTTP response code 
> in a way that would let a selector decide what to do next.
> Would it be taboo to add a parameter to those passed in via the 
> setup() method on AbstractSAXTransformer? Would that parameter even 
> become available, or is this one just a private copy?
> I was thinking I'd also write a simple selector (like the 
> ParameterSelector) which would take a list of strings to be tested 
> (i.e. test="one|two|three|four"). That way, I can check for a bunch of 
> return codes. The other option is to write a selector that understands 
> some better expressions like test="param<500 && param >=400".
> Please tell me if I'm barking up the wrong tree, or of someone has 
> already implemented something like I'm talking about. I do have the 
> HTTPTransformer working, I just need to address the return code issue. 
> I'd prefer to have the sitemap define the action based on result code.
>
> Thanks,
> David
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org





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


Re: is this kosher?

Posted by Charles Yates <ce...@stanford.edu>.
I'm thinking that you can't do you would like to do because as I 
understand it, the pipeline is assembled before generation starts.  
You're talking about putting a pipeline together based on something that 
happens in the generation component.  Cart before the horse.  Closing 
the barn door after . . .   oh never mind.  Perhaps you can pass the 
response code as an attribute in your SAX events and do your conditional 
processing in the transformer.

Charles

David Kavanagh wrote:

> I think people misunderstood something I said.
> One parameter to the setup() method in AbstractSAXTransformer is of 
> type Parameters. I was asking if this is considered mutable. Should I 
> be able to modify the Parameters object (by adding another key/value)? 
> Is it OK to pass values forward in the pipline by this method?
> Irv suggested using the session object which I'll also go along with. 
> I'm just wondering what is the accepted mechanism.
>
> David
>
> Conal Tuohy wrote:
>
>>-----Original Message-----
>>From: David Kavanagh [mailto:dak@dotech.com]
>>
>>  
>>
>>>Well, maybe..
>>>Just as a matter of protocol, isn't adding a new
>>>component something a cocoon user would do? I'm not
>>>really messing with cocoon internals. I'm just
>>>implementing published interfaces.
>>>    
>>>
>>
>>except didn't you ask about passing an extra parameter to a method in one of
>>these interfaces? I think your problem/question is architectural, and that's
>>why I think cocoon-dev would be better.
>>
>>Con
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>>  
>>
>



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


Re: is this kosher?

Posted by David Kavanagh <da...@dotech.com>.
I think people misunderstood something I said.
One parameter to the setup() method in AbstractSAXTransformer is of type 
Parameters. I was asking if this is considered mutable. Should I be able 
to modify the Parameters object (by adding another key/value)? Is it OK 
to pass values forward in the pipline by this method?
Irv suggested using the session object which I'll also go along with. 
I'm just wondering what is the accepted mechanism.

David

Conal Tuohy wrote:

>-----Original Message-----
>From: David Kavanagh [mailto:dak@dotech.com]
>
>  
>
>>Well, maybe..
>>Just as a matter of protocol, isn't adding a new
>>component something a cocoon user would do? I'm not
>>really messing with cocoon internals. I'm just
>>implementing published interfaces.
>>    
>>
>
>except didn't you ask about passing an extra parameter to a method in one of
>these interfaces? I think your problem/question is architectural, and that's
>why I think cocoon-dev would be better.
>
>Con
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>  
>


RE: is this kosher?

Posted by Conal Tuohy <co...@paradise.net.nz>.
-----Original Message-----
From: David Kavanagh [mailto:dak@dotech.com]

>Well, maybe..
>Just as a matter of protocol, isn't adding a new
>component something a cocoon user would do? I'm not
>really messing with cocoon internals. I'm just
>implementing published interfaces.

except didn't you ask about passing an extra parameter to a method in one of
these interfaces? I think your problem/question is architectural, and that's
why I think cocoon-dev would be better.

Con



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


Re: is this kosher?

Posted by David Kavanagh <da...@dotech.com>.
Well, maybe..
Just as a matter of protocol, isn't adding a new component something a 
cocoon user would do? I'm not really messing with cocoon internals. I'm 
just implementing published interfaces. Anyone?

David

Conal Tuohy wrote:

>You should really be asking this kind of question on the cocoon-dev list,
>I'd say.
>
>Cheers!
>
>Con
>
>  
>
>>-----Original Message-----
>>From: David Kavanagh [mailto:dak@dotech.com]
>>
>>
>>I've written this HTTPTransformer which takes some simple XML
>>    
>>
><snip/>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org
>  
>


RE: is this kosher?

Posted by Conal Tuohy <co...@paradise.net.nz>.
You should really be asking this kind of question on the cocoon-dev list,
I'd say.

Cheers!

Con

> -----Original Message-----
> From: David Kavanagh [mailto:dak@dotech.com]
>
>
> I've written this HTTPTransformer which takes some simple XML
<snip/>


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