cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: RequestDispatcherProvider error dispatching to xhtml in /WEB-INF folder
Date Thu, 11 Dec 2014 14:02:25 GMT
Hi, great,
thanks for the info

Cheers, Sergey
On 11/12/14 13:59, Anthony Fryer wrote:
> It turns out to be a caused by myfaces.  It has the following explicit check
> for the "/WEB-INF" string at the start of the pathInfo...
>
> public void service(ServletRequest request,
> 148                         ServletResponse response)
> 149             throws IOException,
> 150                    ServletException
> 151     {
> 152
> 153         HttpServletRequest httpRequest = ((HttpServletRequest) request);
> 154         String pathInfo = httpRequest.getPathInfo();
> 155
> 156         // if it is a prefix mapping ...
> 157         if (pathInfo != null
> 158                 && (pathInfo.startsWith("/WEB-INF") || pathInfo
> 159                         .startsWith("/META-INF")))
> 160         {
> 161             StringBuffer buffer = new StringBuffer();
> 162
> 163             buffer.append(" Someone is trying to access a secure
> resource : ").append(pathInfo);
> 164             buffer.append("\n remote address is
> ").append(httpRequest.getRemoteAddr());
> 165             buffer.append("\n remote host is
> ").append(httpRequest.getRemoteHost());
> 166             buffer.append("\n remote user is
> ").append(httpRequest.getRemoteUser());
> 167             buffer.append("\n request URI is
> ").append(httpRequest.getRequestURI());
> 168
> 169             log.warn(buffer.toString());
> 170
> 171             // Why does RI return a 404 and not a 403, SC_FORBIDDEN ?
> 172
> 173             ((HttpServletResponse) response)
> 174                     .sendError(HttpServletResponse.SC_NOT_FOUND);
> 175             return;
> 176         }
> ...
>
> I tried removing the "/" from my dispatcher path and it worked :)  My
> configuration now looks like this...
>
> <bean id="dispatchProvider"
>        class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
>        <property name="logRedirects" value="true"/>
>        <property name="classResources">
>           <map>
>              <entry
>
> key="com.virginaustralia.checkin_api.v3.model.ItineraryReadRS"
>                 value="WEB-INF/view/faces/rest/reservation.xhtml" />
>           </map>
>        </property>
>        <property name="beanNames">
>            <map>
>                <entry
> key="com.virginaustralia.checkin_api.v3.model.ItineraryReadRS"
> value="reservation"/>
>            </map>
>        </property>
>     </bean>
>
> Using "WEB-INF" instead of "/WEB-INF" at the start makes it pass the myfaces
> check and fortunately the relative path seems to work.
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/RequestDispatcherProvider-error-dispatching-to-xhtml-in-WEB-INF-folder-tp5752229p5752232.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Mime
View raw message