You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2013/04/08 19:23:25 UTC

git commit: WICKET-5138

Updated Branches:
  refs/heads/master 4b7367ef2 -> f98cc63e1


WICKET-5138


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/f98cc63e
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/f98cc63e
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/f98cc63e

Branch: refs/heads/master
Commit: f98cc63e108e23bf281e1350846b0f8da7d7f8bb
Parents: 4b7367e
Author: Igor Vaynberg <ig...@gmail.com>
Authored: Mon Apr 8 10:23:16 2013 -0700
Committer: Igor Vaynberg <ig...@gmail.com>
Committed: Mon Apr 8 10:23:23 2013 -0700

----------------------------------------------------------------------
 .../apache/wicket/protocol/http/WicketFilter.java  |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/f98cc63e/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
index 291bb30..eb73ee7 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
@@ -174,6 +174,19 @@ public class WicketFilter implements Filter
 				return false;
 			}
 
+			if ("OPTIONS".equals(httpServletRequest.getMethod()))
+			{
+				// handle the OPTIONS request outside of normal request processing.
+				// wicket pages normally only support GET and POST methods, but resources and
+				// special pages acting like REST clients can also support other methods, so
+				// we include them all.
+				httpServletResponse.setStatus(HttpServletResponse.SC_OK);
+				httpServletResponse.setHeader("Allow",
+					"GET,POST,OPTIONS,PUT,HEAD,PATCH,DELETE,TRACE");
+				httpServletResponse.setHeader("Content-Length", "0");
+				return true;
+			}
+
 			String redirectURL = checkIfRedirectRequired(httpServletRequest);
 			if (redirectURL == null)
 			{