You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by qiuboboy <qi...@gmail.com> on 2011/07/23 08:05:23 UTC
why path_info is contextPath + req.getPathInfo()
hi,every body
when i extends CXFServlet to dispacth request by http header Content-Type,i found that in AbstractHTTPDestination#setupMessage
inMessage.put(Message.REQUEST_URI, req.getRequestURI());
inMessage.put(Message.PATH_INFO, contextPath + req.getPathInfo());
the two statements above ,the first put Message.REQUEST_URI into inMessage ,and the second put Message.PATH_INFO into inMessage,if my request url is http://localhost:8080/cxf/ws/rest1/roomservice/room/12 and
org.apache.cxf.request.uri=/cxf/ws/rest1/roomservice/room/12,
org.apache.cxf.message.Message.PATH_INFO=/cxf/rest1/roomservice/room/12
why servlet-mapping "ws" is removed?
2011-07-23
qiuboboy
Re: why path_info is contextPath + req.getPathInfo()
Posted by bohr qiu <qi...@gmail.com>.
thanks your reply.i will create a patch.
在 2011-7-26 上午1:08,"Sergey Beryozkin" <sb...@gmail.com>写道:
>
> Hi
>
>> hi,every body when i extends CXFServlet to dispacth request by http
header Content-Type,i found that in AbstractHTTPDestination#setupMessage
>> inMessage.put(Message.REQUEST_URI, req.getRequestURI());
>> inMessage.put(Message.PATH_INFO, contextPath + req.getPathInfo());
>>
>> the two statements above ,the first put Message.REQUEST_URI into
inMessage ,and the second put Message.PATH_INFO into inMessage,if my request
url is http://localhost:8080/cxf/ws/rest1/roomservice/room/12 and
org.apache.cxf.request.uri=/cxf/ws/rest1/roomservice/room/12,
org.apache.cxf.message.Message.PATH_INFO=/cxf/rest1/roomservice/room/12
>> why servlet-mapping "ws" is removed?
>
>
> I can see PATH_INFO is used by some CXF code, but the only reason it works
is because the code which relies upon it checks it againt Message.BASE_PATH
which also misses servletPath().
>
> Would you be interested in creating a patch ?
>
> Adding
>
> String contextServletPath = contextPath + req.getServletPath();
> inMessage.put(Message.PATH_INFO, contextServletPath +
req.getPathInfo());
>
> instead of
>
> inMessage.put(Message.PATH_INFO, contextPath + req.getPathInfo());
>
> and also replacing few lines below
>
> String basePath = getBasePath(contextPath);
> with
> String basePath = getBasePath(contextServletPath);
>
> should do it.
>
> verify this fix if you can, otherwise please open a JIRA and we will look
into it...
>
> Cheers, Sergey
>
>
>
>
>>
>> 2011-07-23
>>
>>
>>
>> qiuboboy
>
>
Re: why path_info is contextPath + req.getPathInfo()
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
> hi,every body
> when i extends CXFServlet to dispacth request by http header Content-Type,i found that in AbstractHTTPDestination#setupMessage
> inMessage.put(Message.REQUEST_URI, req.getRequestURI());
> inMessage.put(Message.PATH_INFO, contextPath + req.getPathInfo());
>
> the two statements above ,the first put Message.REQUEST_URI into inMessage ,and the second put Message.PATH_INFO into inMessage,if my request url is http://localhost:8080/cxf/ws/rest1/roomservice/room/12 and
> org.apache.cxf.request.uri=/cxf/ws/rest1/roomservice/room/12,
> org.apache.cxf.message.Message.PATH_INFO=/cxf/rest1/roomservice/room/12
> why servlet-mapping "ws" is removed?
I can see PATH_INFO is used by some CXF code, but the only reason it
works is because the code which relies upon it checks it againt
Message.BASE_PATH which also misses servletPath().
Would you be interested in creating a patch ?
Adding
String contextServletPath = contextPath + req.getServletPath();
inMessage.put(Message.PATH_INFO, contextServletPath +
req.getPathInfo());
instead of
inMessage.put(Message.PATH_INFO, contextPath + req.getPathInfo());
and also replacing few lines below
String basePath = getBasePath(contextPath);
with
String basePath = getBasePath(contextServletPath);
should do it.
verify this fix if you can, otherwise please open a JIRA and we will
look into it...
Cheers, Sergey
>
> 2011-07-23
>
>
>
> qiuboboy