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 2023/01/22 10:25:15 UTC

[struts] 13/15: Defines another annotation shortcuts

This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch http-interceptor
in repository https://gitbox.apache.org/repos/asf/struts.git

commit f48a4c60ed71518297af41a9e01ec9911685c549
Author: Lukasz Lenart <lu...@gmail.com>
AuthorDate: Sun Sep 21 21:57:31 2014 +0200

    Defines another annotation shortcuts
---
 .../struts2/interceptor/httpmethod/HttpDelete.java   | 20 ++++++++++++++++++++
 .../struts2/interceptor/httpmethod/HttpPut.java      | 20 ++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpDelete.java b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpDelete.java
new file mode 100644
index 000000000..19ac1ea49
--- /dev/null
+++ b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpDelete.java
@@ -0,0 +1,20 @@
+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;
+
+/**
+ * Use this annotation to allow call action or action's method via DELETE request only
+ *
+ * @see org.apache.struts2.interceptor.httpmethod.HttpMethodInterceptor
+ * @since 2.3.18
+ */
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HttpDelete {
+
+    HttpMethod[] value() default { HttpMethod.DELETE };
+
+}
diff --git a/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpPut.java b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpPut.java
new file mode 100644
index 000000000..735b9e128
--- /dev/null
+++ b/core/src/main/java/org/apache/struts2/interceptor/httpmethod/HttpPut.java
@@ -0,0 +1,20 @@
+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;
+
+/**
+ * Use this annotation to allow call action or action's method via PUT request only
+ *
+ * @see org.apache.struts2.interceptor.httpmethod.HttpMethodInterceptor
+ * @since 2.3.18
+ */
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HttpPut {
+
+    HttpMethod[] value() default { HttpMethod.PUT };
+
+}