cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: why path_info is contextPath + req.getPathInfo()
Date Mon, 25 Jul 2011 17:08:19 GMT
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


Mime
View raw message