--- Andy Hedges <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] wrote:
> 
> >I like the elegance of this.
> >Would it also be possible to add this to Response:
> >
> >public abstract int getCode();
> >  
> >
> What do you intent to do with the code? I think the idea is that all 
> protocol codes/outcome can be mapped to the response class below.

I need to be able to get to HTTP status codes.
Response is nice and generic, but for my purposes it also hides too
much.

> >Most protocols return status codes in responses, I think.

If my assumption above is correct, then adding public abstract int
getCode() method would make sense for most protocols.

Otis

> >--- Doug Cutting <[EMAIL PROTECTED]> wrote:
> >
> >  
> >
> >>Clermont, Roger C EIS-NWD Contractor wrote:
> >>    
> >>
> >>>My idea is along the lines of throwing a
> >>>RedirectException from the protocol, catching it in the
> appropriate
> >>>      
> >>>
> >>place and
> >>    
> >>
> >>>then handling it.
> >>>      
> >>>
> >>As a design rule, Exceptions should not be used for normal control
> >>flow, 
> >>and redirects are arguably normal control flow.
> >>
> >>A better design might be something like:
> >>
> >>public interface Protocol {
> >>   Response getResponse(String url);
> >>}
> >>
> >>public abstract class Response {
> >>   public abstract Okay extends Response {
> >>     public Content getContent();
> >>   }
> >>
> >>   public abstract Redirect extends Response {
> >>     public String toUrl();
> >>   }
> >>
> >>   public abstract RetryLater extends Response {
> >>     public String getReason();
> >>   }
> >>
> >>   public abstract Gone extends Response {
> >>     public String getReason();
> >>   }
> >>}
> >>
> >>Then, the fetcher could easily implement redirect logic.
> >>
> >>What do folks think of this API proposal?
> >>
> >>Doug
> >>
> >>
> >>-------------------------------------------------------
> >>This SF.net email is sponsored by: IT Product Guide on
> >>ITManagersJournal
> >>Use IT products in your business? Tell us what you think of them.
> >>Give us
> >>Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find
> >>out more
> >>http://productguide.itmanagersjournal.com/guidepromo.tmpl
> >>_______________________________________________
> >>Nutch-developers mailing list
> >>[EMAIL PROTECTED]
> >>https://lists.sourceforge.net/lists/listinfo/nutch-developers
> >>
> >>    
> >>
> >
> >
> >
> >-------------------------------------------------------
> >This SF.net email is sponsored by: IT Product Guide on
> ITManagersJournal
> >Use IT products in your business? Tell us what you think of them.
> Give us
> >Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find
> out more
> >http://productguide.itmanagersjournal.com/guidepromo.tmpl
> >_______________________________________________
> >Nutch-developers mailing list
> >[EMAIL PROTECTED]
> >https://lists.sourceforge.net/lists/listinfo/nutch-developers
> >  
> >
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on
> ITManagersJournal
> Use IT products in your business? Tell us what you think of them.
> Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find
> out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Nutch-developers mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nutch-developers
> 



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Nutch-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nutch-developers

Reply via email to