You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Ben Perkins (JIRA)" <ji...@apache.org> on 2009/07/17 16:03:15 UTC

[jira] Created: (HTTPCLIENT-862) Extend the client's redirect handling interface to allow control of the content of the redirect

Extend the client's redirect handling interface to allow control of the content of the redirect
-----------------------------------------------------------------------------------------------

                 Key: HTTPCLIENT-862
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-862
             Project: HttpComponents HttpClient
          Issue Type: Improvement
          Components: HttpClient
    Affects Versions: 4.0 Beta 2
            Reporter: Ben Perkins


The existing RedirectHandler interface provides the ability influence which situations cause redirects, but gives you no control over the content of the redirect itself.  For example, if you want the client follow the redirect of a POST request with a POST request to the new location, you can't do it.  DefaultRequestDirector decides what method will be used on the redirect request and as of the most recent patch, it's always either a HEAD or a GET.

One option for resolving this might be extending the RedirectHandler interface to be a factory for creating the redirect request object.  The the DefaultRequestDirector could then be changed to ask the RedirectHandler to create the appropriate request for the situation.

Thanks,
Ben

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCLIENT-862) Extend the client's redirect handling interface to allow control of the content of the redirect

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

Oleg Kalnichevski updated HTTPCLIENT-862:
-----------------------------------------

    Fix Version/s: 4.1.0

> Extend the client's redirect handling interface to allow control of the content of the redirect
> -----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-862
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-862
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 2
>            Reporter: Ben Perkins
>             Fix For: 4.1.0
>
>
> The existing RedirectHandler interface provides the ability influence which situations cause redirects, but gives you no control over the content of the redirect itself.  For example, if you want the client follow the redirect of a POST request with a POST request to the new location, you can't do it.  DefaultRequestDirector decides what method will be used on the redirect request and as of the most recent patch, it's always either a HEAD or a GET.
> One option for resolving this might be extending the RedirectHandler interface to be a factory for creating the redirect request object.  The the DefaultRequestDirector could then be changed to ask the RedirectHandler to create the appropriate request for the situation.
> Thanks,
> Ben

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCLIENT-862) Extend the client's redirect handling interface to allow control of the content of the redirect

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

Oleg Kalnichevski resolved HTTPCLIENT-862.
------------------------------------------

    Resolution: Fixed

Fixed in SVN trunk. 

Ben, could you please review / test the new API?

Oleg

> Extend the client's redirect handling interface to allow control of the content of the redirect
> -----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-862
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-862
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 2
>            Reporter: Ben Perkins
>             Fix For: 4.1 Alpha1
>
>
> The existing RedirectHandler interface provides the ability influence which situations cause redirects, but gives you no control over the content of the redirect itself.  For example, if you want the client follow the redirect of a POST request with a POST request to the new location, you can't do it.  DefaultRequestDirector decides what method will be used on the redirect request and as of the most recent patch, it's always either a HEAD or a GET.
> One option for resolving this might be extending the RedirectHandler interface to be a factory for creating the redirect request object.  The the DefaultRequestDirector could then be changed to ask the RedirectHandler to create the appropriate request for the situation.
> Thanks,
> Ben

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCLIENT-862) Extend the client's redirect handling interface to allow control of the content of the redirect

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

Oleg Kalnichevski resolved HTTPCLIENT-862.
------------------------------------------

    Resolution: Fixed

Fixed in SVN trunk. Please re-test

Oleg

> Extend the client's redirect handling interface to allow control of the content of the redirect
> -----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-862
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-862
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 2, 4.1 Alpha1
>            Reporter: Ben Perkins
>             Fix For: 4.1 Alpha2
>
>
> The existing RedirectHandler interface provides the ability influence which situations cause redirects, but gives you no control over the content of the redirect itself.  For example, if you want the client follow the redirect of a POST request with a POST request to the new location, you can't do it.  DefaultRequestDirector decides what method will be used on the redirect request and as of the most recent patch, it's always either a HEAD or a GET.
> One option for resolving this might be extending the RedirectHandler interface to be a factory for creating the redirect request object.  The the DefaultRequestDirector could then be changed to ask the RedirectHandler to create the appropriate request for the situation.
> Thanks,
> Ben

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-862) Extend the client's redirect handling interface to allow control of the content of the redirect

Posted by "Ben Perkins (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12782281#action_12782281 ] 

Ben Perkins commented on HTTPCLIENT-862:
----------------------------------------

Thanks Oleg.  Yes, I will take a look.

> Extend the client's redirect handling interface to allow control of the content of the redirect
> -----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-862
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-862
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 2
>            Reporter: Ben Perkins
>             Fix For: 4.1 Alpha1
>
>
> The existing RedirectHandler interface provides the ability influence which situations cause redirects, but gives you no control over the content of the redirect itself.  For example, if you want the client follow the redirect of a POST request with a POST request to the new location, you can't do it.  DefaultRequestDirector decides what method will be used on the redirect request and as of the most recent patch, it's always either a HEAD or a GET.
> One option for resolving this might be extending the RedirectHandler interface to be a factory for creating the redirect request object.  The the DefaultRequestDirector could then be changed to ask the RedirectHandler to create the appropriate request for the situation.
> Thanks,
> Ben

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Reopened: (HTTPCLIENT-862) Extend the client's redirect handling interface to allow control of the content of the redirect

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

Ben Perkins reopened HTTPCLIENT-862:
------------------------------------


Oleg,

I finally got a chance to test the new RedirectStrategy interface.  It does give me the flexibility I need, but there's an implementation issue relating to entity enclosing methods like PUT and POST.

In DefaultRequestDirector.handleResponse (currently line 1008), the code does this:

            RequestWrapper wrapper = new RequestWrapper(redirect);
            wrapper.setParams(params);

But in HttpRequestExecutor.doSendRequest (currently line 213), the code has this check:

        if (request instanceof HttpEntityEnclosingRequest) {

Because a RequestWrapper is not an HttpEntityEnclosingRequest, we'll never enter this on a redirect.  And if we don't enter this, we'll never emit the entity body.  This means that even though I can use the new interfaces to cause the client to follow a POST redirect with a POST, I can't get the payload to be sent when the redirect is followed.  

It appears that if handleResponse created an EntityEnclosingRequestWrapper when the redirect object is a PUT or POST, it would solve this problem.

Thoughts?

Thanks again.
Ben

> Extend the client's redirect handling interface to allow control of the content of the redirect
> -----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-862
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-862
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 2
>            Reporter: Ben Perkins
>             Fix For: 4.1 Alpha1
>
>
> The existing RedirectHandler interface provides the ability influence which situations cause redirects, but gives you no control over the content of the redirect itself.  For example, if you want the client follow the redirect of a POST request with a POST request to the new location, you can't do it.  DefaultRequestDirector decides what method will be used on the redirect request and as of the most recent patch, it's always either a HEAD or a GET.
> One option for resolving this might be extending the RedirectHandler interface to be a factory for creating the redirect request object.  The the DefaultRequestDirector could then be changed to ask the RedirectHandler to create the appropriate request for the situation.
> Thanks,
> Ben

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Updated: (HTTPCLIENT-862) Extend the client's redirect handling interface to allow control of the content of the redirect

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

Oleg Kalnichevski updated HTTPCLIENT-862:
-----------------------------------------

    Affects Version/s: 4.1 Alpha1
        Fix Version/s:     (was: 4.1 Alpha1)
                       4.1 Alpha2

It is an unfortunate oversight on my part. The fix is basically a one liner but it will have until 4.1 alpha2

Oleg

> Extend the client's redirect handling interface to allow control of the content of the redirect
> -----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-862
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-862
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 2, 4.1 Alpha1
>            Reporter: Ben Perkins
>             Fix For: 4.1 Alpha2
>
>
> The existing RedirectHandler interface provides the ability influence which situations cause redirects, but gives you no control over the content of the redirect itself.  For example, if you want the client follow the redirect of a POST request with a POST request to the new location, you can't do it.  DefaultRequestDirector decides what method will be used on the redirect request and as of the most recent patch, it's always either a HEAD or a GET.
> One option for resolving this might be extending the RedirectHandler interface to be a factory for creating the redirect request object.  The the DefaultRequestDirector could then be changed to ask the RedirectHandler to create the appropriate request for the situation.
> Thanks,
> Ben

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Commented: (HTTPCLIENT-862) Extend the client's redirect handling interface to allow control of the content of the redirect

Posted by "Ben Perkins (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789492#action_12789492 ] 

Ben Perkins commented on HTTPCLIENT-862:
----------------------------------------

Synced the trunk; rebuilt; retested.  It works for me now. Thanks Oleg.

- Ben

> Extend the client's redirect handling interface to allow control of the content of the redirect
> -----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-862
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-862
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 2, 4.1 Alpha1
>            Reporter: Ben Perkins
>             Fix For: 4.1 Alpha2
>
>
> The existing RedirectHandler interface provides the ability influence which situations cause redirects, but gives you no control over the content of the redirect itself.  For example, if you want the client follow the redirect of a POST request with a POST request to the new location, you can't do it.  DefaultRequestDirector decides what method will be used on the redirect request and as of the most recent patch, it's always either a HEAD or a GET.
> One option for resolving this might be extending the RedirectHandler interface to be a factory for creating the redirect request object.  The the DefaultRequestDirector could then be changed to ask the RedirectHandler to create the appropriate request for the situation.
> Thanks,
> Ben

-- 
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org