You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2014/04/22 08:47:51 UTC

[03/11] git commit: Defines annotations to control access based on http method Defines main annotation AllowedMethod and helper annotations used in most common situation, eg. GetOnly, PostOnly, etc.

Defines annotations to control access based on http method
Defines main annotation AllowedMethod and helper annotations used in
most common situation, eg. GetOnly, PostOnly, etc.


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

Branch: refs/heads/feature/http-interceptor
Commit: 2ae020ce8c8d94a1e8beb070f38d7d08e587f922
Parents: 507e338
Author: Lukasz Lenart <lu...@apache.org>
Authored: Sat Apr 19 17:49:50 2014 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Sat Apr 19 17:49:50 2014 +0200

----------------------------------------------------------------------
 .../struts2/interceptor/httpmethod/AllowedMethod.java | 14 ++++++++++++++
 .../struts2/interceptor/httpmethod/GetOnly.java       | 14 ++++++++++++++
 .../struts2/interceptor/httpmethod/GetPostOnly.java   | 14 ++++++++++++++
 .../struts2/interceptor/httpmethod/PostOnly.java      | 14 ++++++++++++++
 4 files changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/2ae020ce/core/src/main/java/org/apache/struts2/interceptor/httpmethod/AllowedMethod.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/httpmethod/AllowedMethod.java b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/AllowedMethod.java
new file mode 100644
index 0000000..05d3795
--- /dev/null
+++ b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/AllowedMethod.java
@@ -0,0 +1,14 @@
+package org.apache.struts2.interceptor.httpmethod;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AllowedMethod {
+
+    HttpMethod[] value() default {};
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/2ae020ce/core/src/main/java/org/apache/struts2/interceptor/httpmethod/GetOnly.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/httpmethod/GetOnly.java b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/GetOnly.java
new file mode 100644
index 0000000..2c782bd
--- /dev/null
+++ b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/GetOnly.java
@@ -0,0 +1,14 @@
+package org.apache.struts2.interceptor.httpmethod;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface GetOnly {
+
+    HttpMethod[] value() default { HttpMethod.GET };
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/2ae020ce/core/src/main/java/org/apache/struts2/interceptor/httpmethod/GetPostOnly.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/httpmethod/GetPostOnly.java b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/GetPostOnly.java
new file mode 100644
index 0000000..9f8df02
--- /dev/null
+++ b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/GetPostOnly.java
@@ -0,0 +1,14 @@
+package org.apache.struts2.interceptor.httpmethod;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface GetPostOnly {
+
+    HttpMethod[] value() default { HttpMethod.GET, HttpMethod.POST };
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/2ae020ce/core/src/main/java/org/apache/struts2/interceptor/httpmethod/PostOnly.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/interceptor/httpmethod/PostOnly.java b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/PostOnly.java
new file mode 100644
index 0000000..1163188
--- /dev/null
+++ b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/PostOnly.java
@@ -0,0 +1,14 @@
+package org.apache.struts2.interceptor.httpmethod;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PostOnly {
+
+    HttpMethod[] value() default { HttpMethod.POST };
+
+}