title: Spring RESTful web service using only XML config
body: <p>I've been using only XML configuration to make MVC web applications (no annotation).</p>
  
  <p>Now I want to make a RESTful web service with Spring but I could not find any tutorial that doesn't use annotation.</p>
  
  <p>Is there a way to build a RESTful web service with only XML configuration ?<br>
  Or do I HAVE TO use annotation ? </p>
  
  <p>For example, you can deploy an MVC pattern web application using only XML configuration like below.</p>
  
  <pre><code> &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
        &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt;
        &lt;property name="suffix" value=".jsp" /&gt;
     &lt;/bean&gt;
  
     &lt;bean class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver" id="springParameterMethodNameResolver"&gt;
      &lt;property name="paramName" value="action"/&gt;
     &lt;/bean&gt;
  
     &lt;bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&gt;
      &lt;property name="mappings"&gt;
         &lt;map&gt;
              &lt;entry key="/test.do" &gt;
                  &lt;ref bean="testController"  /&gt;
              &lt;/entry&gt;
              &lt;entry key="/rest/test"&gt;
                  &lt;ref bean="testRESTController"/&gt;
              &lt;/entry&gt;
          &lt;/map&gt;
  
      &lt;/property&gt;
     &lt;/bean&gt;
  
     &lt;!-- My Beans --&gt;
     &lt;bean id="testMethodNameResolver" class="com.rhcloud.riennestmauvais.spring.test.TestMethodNameResolver"&gt;
     &lt;/bean&gt;
  
     &lt;!-- Test --&gt;
     &lt;bean class="com.rhcloud.riennestmauvais.spring.test.TestController" id="testController"&gt;
          &lt;property name="delegate" ref="testDelegate"/&gt;
          &lt;property name="methodNameResolver" ref="testMethodNameResolver"&gt;&lt;/property&gt;
          &lt;!-- &lt;property name="methodNameResolver" ref="springParameterMethodNameResolver"&gt;&lt;/property&gt; --&gt;
     &lt;/bean&gt;
     &lt;bean class="com.rhcloud.riennestmauvais.spring.test.TestDelegate" id="testDelegate"&gt;
     &lt;/bean&gt;
  </code></pre>
  
  <p>However, I hit a wall when I was trying to map a method for URL for example
  HTTP method : <code>POST</code>, URL : <code>/student/1/Adam</code> - so that I could add a student.<br>
  The URL format would be like this: <code>/[resource]/[id]/[name]</code></p>
  
  <p>I could map <code>/student/1/Adam</code> to a controller by putting a pattern in the entry key like:</p>
  
  <pre><code>&lt;entry key="/student/regex-to-allow-number/regex-to-allow-string"&gt;
  </code></pre>
  
  <p>But how should I parse the URI within my controller ? </p>
  
  <p>I could parse the URI by using <code>String.split()</code> or something like that but I'm wondering if there isn't already some solution to this so that I could avoid reinventing the wheel.</p>