title: Servlet mapping with spring
body: <p>In my web.xml I have the following mapping</p>
  
  <pre><code>&lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mySite&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.html&lt;/url-pattern&gt; 
  &lt;/servlet-mapping&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mySite&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/articles/*&lt;/url-pattern&gt; 
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Currently it handles urls with a file extension of .html fine. However, I want to be able to handle urls of the type <strong>http://localhost:8080/MySite-Web/articles/testMe</strong> ie any path without a file extension prefixed by articles.</p>
  
  <p>The spring mapping I have tried is.</p>
  
  <pre><code>@RequestMapping(value = "/articles/*")
  public ModelAndView getArticles(HttpServletResponse response, HttpServletRequest request
          ) throws java.lang.Exception {
  
      System.out.println("Handle any path prefixed with /articles/ ");
      return null;
  }
  </code></pre>
  
  <p>in my Spring configuration I am using the following</p>
  
  <pre><code>&lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
      &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>edit: </p>
  
  <p>Here's the Dispatcher Servlet mapping</p>
  
  <pre><code>&lt;servlet&gt;
          &lt;description&gt;
          servlet&lt;/description&gt;
          &lt;servlet-name&gt;MySite&lt;/servlet-name&gt;
          &lt;servlet-class&gt;
          org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;classpath:MySite-web-context.xml&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  </code></pre>
  
  <p>here's the MySite-web.context.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:tx="http://www.springframework.org/schema/tx" 
      xmlns:aop="http://www.springframework.org/schema/aop"
      xmlns:jee="http://www.springframework.org/schema/jee" 
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:lang="http://www.springframework.org/schema/lang"
      xmlns:security="http://www.springframework.org/schema/security"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
        http://www.springframework.org/schema/tx
        http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://www.springframework.org/schema/jee
        http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
        http://www.springframework.org/schema/lang
        http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
        http://www.springframework.org/schema/security 
        http://www.springframework.org/schema/security/spring-security-2.0.1.xsd"&gt;
  
  
      &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
  
      &lt;bean id="beanNameViewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver" /&gt;
  
      &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
          &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt;
      &lt;/bean&gt;
  
                  &lt;context:component-scan base-package="com.mysite" scoped-proxy="interfaces" /&gt;
  
  
  
  &lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
  &lt;property name="maxUploadSize"&gt;
               &lt;value&gt;-1&lt;/value&gt; &lt;!-- 10MB limit  --&gt;
           &lt;/property&gt;
  &lt;/bean&gt;
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>It looks like all the path info is stripped by the time it hits RequestMapping if I map to just /test</p>
  
  <pre><code>@RequestMapping(value = "/test")
  </code></pre>
  
  <p>it works okay and if</p>
  
  <p>I System.out.println(request.getPathInfo()); I just get <strong>/test</strong> with no <strong>/articles</strong> ???</p>
  
  <p>Cheers in advance.</p>