HI Christian

On Fri, Jun 17, 2011 at 9:48 AM, Christian Schneider
<[email protected]> wrote:
> Hi Eduard,
>
> nice to hear from you.
>
> Take a look at the code at
> org.apache.cxf.transport.http.HTTPConduit.handleHttpRetryException(HttpRetryException,
> HttpURLConnection)
>
> The code currently handles HTTP 301 and 302 only. But it would be easy to
> add handling for 307 there. If it has no adverse side effects I could add
> 307.
> Interestingly the class java.net.HttpURLConnection does not seem to have a
> constant for 307. Is this perhaps new ?
>
I think it should be safe start handling 307 and 303 [1].

307 has the precondition that auto-redirect must not be attempted
unless the original HTTP method was GET or HEAD, so I guess we can
ignore 307 auto-redirects for POSTs/etc
303 requires the use of GET in the auto-redirect

Cheers, Sergey

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

> Christian
>
>
> Am 17.06.2011 10:37, schrieb ehildebrandt:
>>
>> Hi,
>>
>> I’m using CXF 2.4.1-SNAPSHOT to access a REST-Service. The service
>> responses
>> with a redirect (HTTP-Code: 307). How can I configure CXF to automatically
>> follow the redirect?
>> I tried to set the “AutoRedirect” property to “true”:
>>
>> <http-conf:conduit name="*.http-conduit">
>>         <http-conf:client AutoRedirect="true"/>
>> </http-conf:conduit>
>>
>> But it seems that it’s not working. Do you have any idea what is wrong?
>> Your help is very appreciated.
>>
>> Best regards,
>>
>> Eduard
>>
>>
>> This is the log:
>>
>> [INFO] [talledLocalContainer] --------------------------------------
>> [INFO] [talledLocalContainer] 10:17:30,691 INFO  [LoggingOutInterceptor]
>> Outbound Message
>> [INFO] [talledLocalContainer] ---------------------------
>> [INFO] [talledLocalContainer] ID: 71
>> [INFO] [talledLocalContainer] Address:
>>
>> http://localhost:8080/fedora/objects/escidoc:19003/datastreams/redirect_image/content
>> [INFO] [talledLocalContainer] Http-Method: GET
>> [INFO] [talledLocalContainer] Content-Type: application/xml
>> [INFO] [talledLocalContainer] Headers: {Content-Type=[application/xml],
>> Accept=[text/xml], Authorization=[Basic ZmVkb3JhQWRtaW46ZmVkb3JhQWRtaW4=],
>> Connection=[K
>> eep-Alive]}
>> [INFO] [talledLocalContainer] --------------------------------------
>> [INFO] [talledLocalContainer] 10:17:30,707 INFO  [LoggingInInterceptor]
>> Inbound Message
>> [INFO] [talledLocalContainer] ----------------------------
>> [INFO] [talledLocalContainer] ID: 71
>> [INFO] [talledLocalContainer] Response-Code: 307
>> [INFO] [talledLocalContainer] Encoding: ISO-8859-1
>> [INFO] [talledLocalContainer] Content-Type:
>> [INFO] [talledLocalContainer] Headers: {Cache-Control=[no-cache],
>> Content-Length=[0], Date=[Fri, 17 Jun 2011 08:17:30 GMT], Expires=[Thu, 01
>> Jan 1970 01:00:00 C
>> ET], Location=[http://localhost:8080/images/escidoc-banner.jpg],
>> Pragma=[No-cache], Server=[Apache-Coyote/1.1], X-Powered-By=[Servlet 2.4;
>> JBoss-4.2.3.GA (build
>> : SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0]}
>> [INFO] [talledLocalContainer] --------------------------------------
>>
>> --
>> View this message in context:
>> http://cxf.547215.n5.nabble.com/Auto-redirect-on-HTTP-Code-307-tp4498124p4498124.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>
>

Reply via email to