<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=sorriso" rel="nofollow">Sorriso</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-8930?redirect=false" rel="nofollow">SPR-8930</a></strong> and commented</p>
<p dir="auto">the full code source having the issue can be found here:</p>
<p dir="auto"><a href="https://github.com/sorriso/TodoSRV">https://github.com/sorriso/TodoSRV</a></p>
<p dir="auto">this is a small application architecture sample (still under improvement / development) of a full todos application<br>
with a RIA javascript application on client side (using sproutcore 2.0, jquery)<br>
and a spring Resful server (using mybatis, c3p0 and mysql) with spring security</p>
<ul dir="auto">
<li>database must be create first</li>
<li>just change springframework version from 3.0.6.RELEASE to 3.1.0.RC2 (and vice versa) in pom.xml file to (de)activate error msg</li>
<li>launch the application on a tomcat 7 server (via eclipse by example)</li>
<li>open the url <a href="http://localhost:8080/TodoSRV" rel="nofollow">http://localhost:8080/TodoSRV</a></li>
<li>login with user / user -&gt; if exists todos item list appears (GET command allowed)<br>
if not create 2 or 3 todo item (POST command allowed)<br>
AND REFRESH the page in order to avoid a bug (who have no link with this issue) who duplicate todo items</li>
<li>mark as "done" a todo item -&gt; error in webInspector / firebug console -&gt; POST command not allowed<br>
(this action works fine with 3.0.6.RELEASE)</li>
<li>if a todo item is already marked as done, clear action works fine (DELETED command allowed)</li>
</ul>
<p dir="auto">filter hiddenHttpMethodFilter have been added in web.xml file</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.1 RC2</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=asarkar" rel="nofollow">Abhijit Sarkar</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9359?redirect=false" rel="nofollow">SPR-9359</a></strong> and commented</p>
<p dir="auto">Background: I opened an improvement <a href="https://jira.spring.io/browse/SWS-746" rel="nofollow">SWS-746</a> but it was incorrectly closed. It is OK if the improvement is not accepted but the fact that it was closed because "here has been a UriTemplate class since version 3.0, which allows you to create a URI template quite easily." is incorrect. There is no method in UriTemplate that can do what I am suggesting.</p>
<p dir="auto">Improvement:<br>
There is no code to create an UriTemplate. UriTemplate has methods to expand the following URI but nothing to create it. <a href="http://example.com/hotels/%7Bhotel%7D/bookings/%7Bbooking%7D" rel="nofollow">http://example.com/hotels/{hotel}/bookings/{booking}</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public String createUriTemplate(String endpoint, Map&lt;String, String&gt; queryParams) {
	final String queryParamsStart = &quot;?&quot;;
	final String uriVariableStart = &quot;{&quot;;
	final String uriVariableEnd = &quot;}&quot;;
	final String uriVariableSeparator = &quot;&amp;&quot;;
	final char uriPathSeparator = '/';

	StringBuilder uriTemplate = new StringBuilder(endpoint);

	Set&lt;String&gt; keys = queryParams.keySet();

	if (!(uriTemplate.codePointBefore(uriTemplate.length()) == uriPathSeparator))
	    uriTemplate.append(uriPathSeparator);

	uriTemplate.append(queryParamsStart);

	for (String key : keys)
	    uriTemplate.append(key).append(&quot;=&quot;).append(uriVariableStart)
		    .append(key).append(uriVariableEnd)
		    .append(uriVariableSeparator);

	uriTemplate.deleteCharAt((uriTemplate.length() - 1));

	logger.debug(&quot;Created URI template: &quot; + uriTemplate);

	return uriTemplate.toString();
}"><pre class="notranslate"><code class="notranslate">public String createUriTemplate(String endpoint, Map&lt;String, String&gt; queryParams) {
	final String queryParamsStart = "?";
	final String uriVariableStart = "{";
	final String uriVariableEnd = "}";
	final String uriVariableSeparator = "&amp;";
	final char uriPathSeparator = '/';

	StringBuilder uriTemplate = new StringBuilder(endpoint);

	Set&lt;String&gt; keys = queryParams.keySet();

	if (!(uriTemplate.codePointBefore(uriTemplate.length()) == uriPathSeparator))
	    uriTemplate.append(uriPathSeparator);

	uriTemplate.append(queryParamsStart);

	for (String key : keys)
	    uriTemplate.append(key).append("=").append(uriVariableStart)
		    .append(key).append(uriVariableEnd)
		    .append(uriVariableSeparator);

	uriTemplate.deleteCharAt((uriTemplate.length() - 1));

	logger.debug("Created URI template: " + uriTemplate);

	return uriTemplate.toString();
}
</code></pre></div>
<hr>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/browse/SWS-746" rel="nofollow">SWS-746</a> Provide RestTemplate methods that can create a UriTemplate using a Map (<em><strong>"duplicates"</strong></em>)</li>
</ul>