jeudi 5 mai 2016

Prefixing strut2 url

My web application is using strut and spring webservice. In order to distinguish web application and web service, I try to use with URL pattern.

web.xml

<filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        </filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name> 
        <url-pattern>/web/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>mvc-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <url-pattern>/service/*</url-pattern>
    </servlet-mapping>

All url start with /service will go with REST and all url start with /web will be responsible to struts.

The problem here is I do not know how to prepend URL part /web to struct. Please kindly advice.




Aucun commentaire:

Enregistrer un commentaire