You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Roland Weber (JIRA)" <ji...@apache.org> on 2007/02/03 19:57:05 UTC

[jira] Created: (HTTPCORE-39) refactor HttpStatus

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


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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469987 ] 

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

Hello Bindul,

The ReasonPhraseCatalog is an interface. The implementation in the first patch is hard-coded, as the code is taken from the HttpStatus class.
I'd like to have an implementation based on ResourceBundle, but I see it as a low priority. It's also up for discussion whether that kind of class should be in HttpCore. We prefer not to have fixed/default locations for parameters, and the bundle could be seen as such.

Thanks for the suggestion,
   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
>
>
> 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


[jira] Reopened: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber reopened HTTPCORE-39:
----------------------------------


I'm afraid this needs some more cleanup. Now that we have a factory interface for looking up the reason phrase for a status code, it is no longer appropriate to handle this completely under the cover. I see two options: expect a reason phrase whenever there is a status code (two methods in HttpResponse), or else give BasicHttpResponse an optional reason phrase catalog to perform the lookup.
The first option assigns the lookup responsibility to the application. The second one has an inconsistency if the status line is set as an object, in which case the application would still have to do the lookup.

The first option is more appealing to me because the lookup responsibility is assigned clearly.
I'll prepare a patch for review. It's going to be nasty :-(

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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12471393 ] 

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

Hi Oleg,

example 1 - WebSphere Portal Server. The locale for the response (content) is determined by the following priorities:
a) preferredLocale in the User object
b) Accept-Language header in the request
c) system default locale
(b) and (c) can be addressed based on the request only, but (a) requires access to the session. On login, the
user object is not even available until after authentication information in the request has been processed. 

example 2: At least one client had the requirement to switch the language by clicking on a link in the web page.
When the language is changed, the information is in the request URI. Before and afterwards, it is in the session.

In general, the logic for selecting the language of the response (content) can be located anywhere in the request
processing. To NLS-enable the reason phrase, we can require to move that logic into the reason phrase catalog,
or we can provide a way for the request processing logic to specify the language after the response is created.
We could also change the services to allow for request processing that creates a new response object, but that
has a magnitude which definitely is out of proportion for such a minor problem.

I'll prepare a patch based on the setLocale() option this week-end.

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, 2k7-02-06-impl-catalog.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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470054 ] 

Oleg Kalnichevski commented on HTTPCORE-39:
-------------------------------------------

Do we really need to drag the whole context into this? Wouldn't just a request suffice?

Oleg

> 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


[jira] Updated: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber updated HTTPCORE-39:
---------------------------------

    Attachment: 2k7-02-03-HttpStatus.txt

Ok, I had the purpose of the HttpStatus class wrong yesterday. No wonder Oleg didn't understand my ideas :-)
Anyway, here is a patch that allows for NLS of reason phrases. It's not complete, since we'd have to get HttpContext down to the HttpResponseFactory in order to determine the language based on the request.
And I've hacked a reference to an implementation class into BasicHttpResponse. I'd prefer to change the behavior of the two-arguments constructor to omit the reason phrase altogether.

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
>
>
> 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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470976 ] 

Oleg Kalnichevski commented on HTTPCORE-39:
-------------------------------------------

How about this?

(1) Remove dependency on HttpContext from ReasonPhraseCatalog  

public interface ReasonPhraseCatalog {

    public String getReason(int status, Locale locale);

}

(2) DefaultHttpResponseFactory is responsible for injecting ReasonPhraseCatalog and Locale to  BasicHttpResponse

Oleg

> 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, 2k7-02-06-impl-catalog.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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472012 ] 

Oleg Kalnichevski commented on HTTPCORE-39:
-------------------------------------------

Hi Roland,

I think it is rather unfortunate we dragged the whole localization story into Core, but since we did it, we should at the very least be consistent and put setLocale() and getLocale methods to the HttpMessage interface, and mot just HttpResponse. At some point of time we also may want to add request interceptors to set the locale for HTTP requests.

I can live with the patch. Please go ahead and commit

Oleg

> 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, 2k7-02-06-impl-catalog.txt, 2k7-02-10-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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470056 ] 

Oleg Kalnichevski commented on HTTPCORE-39:
-------------------------------------------

So be it. Go ahead and commit the patch.

Oleg

> 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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472015 ] 

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

Patch checked in as is.

The reason phrase is the only user-facing protocol-level text in RFC 2616 that I'm aware of. As such, I think it's the HTTP inventors who dragged localization into the core of HTTP. Localization of other content is typically handled on the application level, which should have access to the HttpContext for passing the locale around. But if you like it better that way, I can move the set/getLocale up to the message level tomorrow. I'm leaving this issue open until this matter is resolved.

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, 2k7-02-06-impl-catalog.txt, 2k7-02-10-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


[jira] Resolved: (HTTPCORE-39) refactor HttpStatus

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-39.
---------------------------------------

    Resolution: Fixed

Ok. One may argue a single locale object is not sufficient as an HTTP request can have multiple languages in the Accept-Language header. I can live with things as they are.

Oleg

> 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, 2k7-02-06-impl-catalog.txt, 2k7-02-10-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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470988 ] 

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

Hi Oleg,

it looks better on the first and second glance. The problem is that the locale needs to be available at the time the response object is created. In HttpService and it's NIO counterparts, the response is initially created very early, to be updated in some cases and replaced with a newly created response in others. If request handlers are invoked and there is no error, the response is not replaced and the locale would have been determined before the request handling.
If we add HttpResponse.setLocale() to allow for request handlers that determine the locale dynamically, it could work. But do you like that better? And HttpService et al would need to be revised so they either don't replace the response object, or somehow get the locale set there and push it into the factory when creating the replacement. Not replacing is the easier version.

Personally, I like the idea of passing the context around to wherever custom code might need it. It's a convenient way for application developers to deliver their custom data to the various plug-in points in the framework.

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, 2k7-02-06-impl-catalog.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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12471029 ] 

Oleg Kalnichevski commented on HTTPCORE-39:
-------------------------------------------

> The problem is that the locale needs to be available at the time the response object is created

We always have a HTTP request object when creating an HTTP response, so Locale can be determined at the HTTP response creation time. And I do see a point in resetting the Locale on the response object at a later time. What for? Having said that, I could live with setLocale() method.

Oleg

> 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, 2k7-02-06-impl-catalog.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


[jira] Updated: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber updated HTTPCORE-39:
---------------------------------

    Attachment: 2k7-02-04-status-followup.txt

Here is the followup patch that brings HttpContext down to the response factory. Please review.

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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469979 ] 

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

Correction: HttpStatus does NOT represent a status. The static methods for looking up associated messages is the only purpose. Suggested improvements:
- define interface ReasonPhraseCatalog
- move HttpStatus to impl.EnglishReasonPhraseCatalog

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
>
>
> 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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470038 ] 

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

Patch committed with minor modifications (HttpStatus is now an interface, test class is renamed to TestEnglishReasonPhraseCatalog).
I'm leaving this issue open for the followup mentioned above.

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
>
>
> 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


[jira] Updated: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber updated HTTPCORE-39:
---------------------------------

    Attachment: 2k7-02-06-impl-catalog.txt

Here's my suggestion. Option 3 takes out most of the nastiness: response.setStatusCode updates the status code and resets the reason phrase to null. Handlers can use response.setReasonPhrase at will. Only if the reason phrase is null after the handling, the service will perform a catalog lookup.
I've thrown in some additional JavaDocs, in particular the @throws in HttpResponse.

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, 2k7-02-06-impl-catalog.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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469994 ] 

Oleg Kalnichevski commented on HTTPCORE-39:
-------------------------------------------

Looks good to me. I would prefer to keep ResourceBundle stuff out of HttpCore, though

Oleg

> 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
>
>
> 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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470318 ] 

Oleg Kalnichevski commented on HTTPCORE-39:
-------------------------------------------

Now I am beginning to regret we have introduced ReasonPhraseCatalog at all. One can override the reason phrase in HttpService whichever way their heart desires. This problem does not seem to have an elegant generic solution, so probably it should not be a part of HttpCore at all.

Yes, NIO extensions do make use of HttpRequestHandler interface.

Oleg

> 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


[jira] Closed: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber closed HTTPCORE-39.
--------------------------------

    Resolution: Fixed

patch committed

> 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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Bindul Bhowmik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469984 ] 

Bindul Bhowmik commented on HTTPCORE-39:
----------------------------------------

Random thought: Could the ReasonPhraseCatalog be an actual implementation backed by a resource bundle? We could provide the default English phrases for the catalog, and users would be able to 'plug-in' their implementations?


> 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
>
>
> 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


[jira] Updated: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber updated HTTPCORE-39:
---------------------------------

    Attachment: 2k7-02-10-status-followup.txt

Here's a new take. I definitely had to change fewer classes in NIO this time.
The required modifications to HttpClient and HttpAsync are included.

I made one minor functional modification for which I had to adapt a test case:
if there is no reason phrase, a space character will apear after the status code anyway.
The reason is this test case which I noticed recently:

TestStatusLine.testParseSuccess:
        //this is not strictly valid, but is lienent
        statusLine = BasicStatusLine.parse("HTTP/1.1 200");

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, 2k7-02-06-impl-catalog.txt, 2k7-02-10-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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470055 ] 

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

Hi Oleg,

a real-world server that is NLS enabled will determine the language early in the request processing phase, based on the request and/or session information and/or user profile information. It can then store the Locale object in the context, which allows for a simple lookup in the response factory.
The alternative is to duplicate the language selection in the response factory, which would not have access to session or user information.

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


[jira] Commented: (HTTPCORE-39) refactor HttpStatus

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ 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