Hi
On 05/09/12 12:12, Hoppe, Michael wrote:
Dear list,

I have an application that uses cxf version 2.6.2 and has several
rest-endpoints. Additionally it serves static pages.

So I configured the CXFServlet to serve requests with particular
extensions as static pages.

My configuration in web.xml:

<servlet>

<servlet-name>CXFServlet</servlet-name>

<display-name>CXF Servlet</display-name>

<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>

<init-param>

<param-name>static-resources-list</param-name>

<param-value>

(\S)+\.html

(\S)+\.xml

(\S)+\.jpg

(\S)+\.png

(\S)+\.gif

(\S)+\.xsl

(\S)+\.xsd

(\S)+\.css

</param-value>

</init-param>

</servlet>

This works fine.

Now I want to add a welcome-page when a user requests the application
root-path.

Ie request to http://servername.com/escidoc returns
http://servername.com/escidoc/index.html

I tried this by adding the following init-param to my servlet-configuration:

<init-param>

<param-name>static-welcome-file</param-name>

<param-value>/index.html</param-value>

</init-param>

So when I now call http://servername.com/escidoc, index.html is
returned. So this works fine.

But when I call another static page like

http://servername.com/escidoc/test.xml

also index.html is returned.

Is this a bug or do I do something wrong?

It is a bug - I can see in the code that the static file property is checked only if it is set - I'll get it fixed.

Can you avoid using the static file property and use the following instead:

<init-param>
                <param-name>redirects-list</param-name>
                <param-value>
                  /
                </param-value>
            </init-param>
            <init-param>
                <param-name>redirect-attributes</param-name>
                <param-value>
                  javax.servlet.include.request_uri
                </param-value>
            </init-param>
            <init-param>
                <param-name>redirect-servlet-name</param-name>
                <param-value>default</param-value>
            </init-param>

These parameters will only affect

'http://servername.com/escidoc' requests. You may also want to consider redirecting to the default servlet for getting all the root static resources served

HTH, Sergey


Thanks for your help + greetings

M.Hoppe

*Dr. Michael Hoppe*
e-Science

IT, Development & Applied Research
Phone +49 7247 808-251
Fax +49 7247 808-133
[email protected]


*FIZ Karlsruhe – Leibniz Institute for Information Infrastructure*
Hermann-von-Helmholtz-Platz 1
76344 Eggenstein-Leopoldshafen, Germany

www.fiz-karlsruhe.de <http://www.fiz-karlsruhe.de/>



-------------------------------------------------------

Fachinformationszentrum Karlsruhe, Gesellschaft für
wissenschaftlich-technische Information mbH.
Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim
HRB 101892.
Geschäftsführerin: Sabine Brünger-Weilandt.
Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner.

Reply via email to