On Wed, Jun 14, 2006 at 11:30:54PM +0200, David 'Bombe' Roden wrote: > On Wednesday 14 June 2006 23:01, Florent Daigni?re wrote: > > > With cyberdo's api they just have access to a String iirc... But yes, > > using Exceptions is a good idea. > > In my opinions using exceptions for something like that is not a good > idea. Exceptions should be used to denote error conditions.
Well we already have a RedirectException don't we? > > Apart from that, maybe we could expose some kind of Reponse object, just > like the Servlet API? We should keep it as simple as possible while still exposing the required functionality. Cyberdo's API has it returning a String which is sent to the caller. If the plugin normally returns small amounts of data then an exception is a logical extension for the exceptional condition of having to redirect - hence RedirectException on Toadlet. However, if the plugin may return large amounts of data, it needs to either return a Bucket, or write to a method (as Toadlets do). If it writes to a method we can provide a method for writing a redirect, and others for arbitrary HTTP response codes and headers. So perhaps we should have two plugin APIs for HTTP? The very simple HTTP plugin API (return HTML as a string, limited length, if you need to redirect throw an exception), and the complex more toadlet like API. > > David -- Matthew J Toseland - toad at amphibian.dyndns.org Freenet Project Official Codemonkey - http://freenetproject.org/ ICTHUS - Nothing is impossible. Our Boss says so. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: <https://emu.freenetproject.org/pipermail/tech/attachments/20060615/9c7b4fa4/attachment.pgp>
