I needed a generator that takes a URL and downloads the content from it, but _also_ allows for an arbitrary HTTP method and HTTP headers to be set with the request. Not sure if anyone else needs one, but if they do (and don't just want to write it themselves as it was pretty simple):
not-so-syntax highlighted: http://svn.saurik.com/repos/groupnetwork/trunk/backend/source/com/groupnetwo rk/cocoon/HttpGenerator.java syntax highlighted (in case you just want to look at it, although this URL might break in a few days): http://www.jayfreeman.com/cartouche/svn/saurik.com/groupnetwork/backend/sour ce/com/groupnetwork/cocoon/HttpGenerator.java Maybe there's a way to already do this using stuff that comes with Cocoon (in which case I'd be interested if someone would tell me how, hehe), but I couldn't find it :(. If anyone has any other comments or suggestions, I'd love to hear them. I'm using it to do PROPFINDs against WebDAV servers: 337 <map:match pattern="cartouche/svn/*/*/**/"> 338 <map:generate type="http" src="http://svn.{1}/repos/{2}/trunk/{3}/"> 339 <map:parameter name="HTTP_METHOD" value="PROPFIND"/> 340 <map:parameter name="Depth" value="1"/> 341 </map:generate> 342 <map:serialize type="xml"/> 343 </map:match> Example output of that here (until I get a stylesheet running for it, hehe, but you can just ?cocoon-view=content then): http://www.jayfreeman.com/cartouche/svn/saurik.com/groupnetwork/backend/sour ce/com/groupnetwork/cocoon/ Another option I was thinking of was to write a psuedo protocol for it, but they never seemed as flexible to me as generators (although generators have the icky problem that they can't interact in a pipeline fashion with non-XML transformers, so things like ImageReader can really only take input from a psuedo protocol, not from something like a reader version of HttpGenerator... although I guess you could attack it with the cocoon:// protocol... I don't know, generators seem like a stretched concept... if you expect people to do that you really could just give them a single "xml" generator that reads from the cocoon psuedo protocol, and all existing generators become readers... albeit that wouldn't be so efficient, hehe)... that would require a seperate pseudo-protocol definition for every single set of methods and headers, and would make it really difficult to get request information interacting with it (like if you want to set a header based on a request parameter), no? Or do I just not know enough about pseudo-protocols? ;) Sincerely, Jay Freeman (saurik) [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
