hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roland Weber (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HTTPCORE-39) refactor HttpStatus
Date Mon, 05 Feb 2007 18:44:05 GMT

    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470311
] 

Roland Weber commented on HTTPCORE-39:
--------------------------------------

It's nastier than I thought. HttpService relies heavily on HttpResponse.setStatusCode(int),
in methods that are probably supposed to be overridden in derived classes. In some places
a new response is created, in others the existing one gets updated. On the other hand, hiding
the reason phrase lookup in BasicHttpResponse would not only require the catalog but also
the HttpContext to be stored there.
While I'm tempted to just leave things as they are, I think I've hit a point where our API
design actually needs improvement. I'll sleep over it and will come up with a patch later
this week.

Oleg, does the NIO stuff (and Synapse) depend on HttpService and/or HttpRequestHandler? Request
handlers have the response object and the HttpContext, but they don't know the factory that
created the response, which is where the logic for the reason phrase lookup is hidden.

A third option would be to simply clear the reason phrase when the status code is updated,
and perform the lookup just before the response is actually sent. That would also allow the
response handlers to set a reason phrase of their choosing. For example, I have used exception
messages as reason phrases before. 

cheers,
  Roland


> refactor HttpStatus
> -------------------
>
>                 Key: HTTPCORE-39
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-39
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>         Assigned To: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha4
>
>         Attachments: 2k7-02-03-HttpStatus.txt, 2k7-02-04-status-followup.txt
>
>
> The HttpStatus class not only represents a status code with associated message, it also
has static factory methods for creating objects with hard-coded english status messages. Suggested
improvements:
> - define HttpStatusFactory in the API
> - move the factory method stuff to impl, for example EnglishHttpStatusFactory
> - reduce HttpStatus class to representation only, final and serializable
> patch to follow when I find the time
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message