From eb1c039a6ec597edff94fe501eecac08ce3cbab6 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 12 Mar 2010 19:45:05 +0000 Subject: [PATCH] WebContentInterceptor does not restrict HTTP methods by default anymore (SPR-6919) --- .../web/servlet/mvc/WebContentInterceptor.java | 9 ++++++++- .../web/servlet/support/WebContentGenerator.java | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/WebContentInterceptor.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/WebContentInterceptor.java index 38ac7792944..f78fa50f7bd 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/WebContentInterceptor.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/WebContentInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,6 +54,13 @@ public class WebContentInterceptor extends WebContentGenerator implements Handle private PathMatcher pathMatcher = new AntPathMatcher(); + public WebContentInterceptor() { + // no restriction of HTTP methods by default, + // in particular for use with annotated controllers + super(false); + } + + /** * Set if URL lookup should always use full path within current servlet * context. Else, the path within the current servlet mapping is used diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java index eb9dec91987..cc0bac35afd 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package org.springframework.web.servlet.support; import java.util.Arrays; import java.util.HashSet; import java.util.Set; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -107,7 +106,8 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport { /** * Set the HTTP methods that this content generator should support. - * Default is HEAD, GET and POST. + *

Default is GET, HEAD and POST for simple form controller types; + * unrestricted for general controllers and interceptors. */ public final void setSupportedMethods(String[] methods) { if (methods != null) {