Hi
This property was added to make sure that when a WebClient instance is
reused and it has been redirected to a new URI then this new URI will be
effective in the subsequent invocations.
I can see it can have side-effects for Authorization-based retransmits,
and I've got it fixed.
The easy fix/workaround is not to init a WebClient with a URI like
"http://localhost:8080/api-ws/ws/rs/v1/ci/COMPANY/2222" but with
"http://localhost:8080/api-ws/ws/rs/v1/" and then build a current URI
with path(). Can not be easy with proxies so for now do not reuse the
same proxy when testing the authorization retransmits
Thanks, SErgey
On 02/01/15 17:16, psd wrote:
Hi All,
I'm facing this strange problem where URL generated by client appears to be
wrong. This is what is happening.
I have a Maven Test class which has around 7 test cases. First test always
passes & rest all fail. For every test it sends 2 rest requests, first
request without "Authorization" header, & when server responds saying "401
Unauthorized", second request with "Authorization" header.
(I'm skipping request that contains Authorization header here in below e.g.)
here base URL is: "http://localhost:8080/api-ws/ws/rs/v1" and method that is
invoked has part "/ci/COMPANY/2222"
I seems that it generates correct URL for first test & wrong ones for rest
of them. So e.g.
1. First Test generated URL:
GET /api-ws/ws/rs/v1/ci/COMPANY/2222 HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
2. Second:
GET /api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid! HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
and so on...
for last test:
GET
/api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid!/ci/ACTION/1111/ci/COMPANY/%20%20%201111/ci/invalid!/2222/ci/ACTION/%20%20%20
HTTP/1.1
Content-Type: application/xml
Accept: application/csv
User-Agent: Apache CXF 3.0.2
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8080
Connection: keep-alive
When I debug through cxf client (3.0.2) source, I found that class
"org.apache.cxf.transport.http.HTTPConduit" sets property
"transport.retransmit.url" on outMessage in method retransmit().
After second successful request call, class
"org.apache.cxf.jaxrs.client.AbstractClient" changes baseURL in method
completeExchange() after looking at "transport.retransmit.url" in outMessage
from "http://localhost:8080/api-ws/ws/rs/v1" to
"http://localhost:8080/api-ws/ws/rs/v1/ci/COMPANY/2222" and hence second
test fails.. as it tries to call baseURL + "/ci/ACTION/invalid!" i.e.
"http://localhost:8080/api-ws/ws/rs/v1/ci/COMPANY/2222/ci/ACTION/invalid!"
which obviously isn't correct.
I saw conversation between Daniel & Sergey at
http://irclogs.dankulp.com/logs/irclogger_log/cxf/?date=2013-10-01,Tue&text=on
but couldn't understand much. Can Daniel/Sergey please have a look to see
what I may be missing?
- psd
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-JAXRS-client-Base-URL-is-incorrect-tp5752768.html
Sent from the cxf-user mailing list archive at Nabble.com.