Jersey Static Content Filtering

I am trying to use static content (an HTML form that calls the Jersey REST resource) from the same webapp as the servlet that processes the resource requests. As far as I understand, I can filter requests for static content away from the Jersey servlet. My web.xmllooks like this, but at the moment I can’t access the static content or resource ... both worked separately.

<filter>
    <filter-name>my-filter</filter-name>
    <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
    <init-param>
        <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
        <param-value>/*.html</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>my-filter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
    <servlet-name>my-service</servlet-name>
    <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>com.mydomain.ws.myservice</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>my-service</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>
+3
source share
2 answers

FWIW , , , param- WebContentRegex . , , , , , . - /.*.html.

+3

, , :

<servlet-mapping>
    <servlet-name>ServletAdaptor</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
0

Source: https://habr.com/ru/post/1770612/


All Articles