1 /* |
1 /* |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 * |
3 * |
4 * Copyright 2018 Mike Becker. All rights reserved. |
4 * Copyright 2018 Mike Becker. All rights reserved. |
5 * |
5 * |
6 * Redistribution and use in source and binary forms, with or without |
6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are met: |
7 * modification, are permitted provided that the following conditions are met: |
8 * |
8 * |
9 * 1. Redistributions of source code must retain the above copyright |
9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. |
10 * notice, this list of conditions and the following disclaimer. |
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 * POSSIBILITY OF SUCH DAMAGE. |
26 * POSSIBILITY OF SUCH DAMAGE. |
27 * |
27 * |
28 */ |
28 */ |
29 package de.uapcore.lightpit; |
29 package de.uapcore.lightpit; |
30 |
30 |
31 import java.lang.annotation.Documented; |
31 import java.lang.annotation.*; |
32 import java.lang.annotation.ElementType; |
|
33 import java.lang.annotation.Retention; |
|
34 import java.lang.annotation.RetentionPolicy; |
|
35 import java.lang.annotation.Target; |
|
36 |
32 |
37 |
33 |
38 /** |
34 /** |
39 * Maps requests to methods. |
35 * Maps requests to methods. |
40 * |
36 * <p> |
41 * This annotation is used to annotate methods within classes which |
37 * This annotation is used to annotate methods within classes which |
42 * override {@link AbstractLightPITServlet}. |
38 * override {@link AbstractLightPITServlet}. |
43 */ |
39 */ |
44 @Documented |
40 @Documented |
45 @Retention(RetentionPolicy.RUNTIME) |
41 @Retention(RetentionPolicy.RUNTIME) |
46 @Target(ElementType.METHOD) |
42 @Target(ElementType.METHOD) |
47 public @interface RequestMapping { |
43 public @interface RequestMapping { |
48 |
44 |
49 /** |
45 /** |
50 * Specifies the HTTP method. |
46 * Specifies the HTTP method. |
51 * |
47 * |
52 * @return the HTTP method handled by the annotated Java method |
48 * @return the HTTP method handled by the annotated Java method |
53 */ |
49 */ |
54 HttpMethod method(); |
50 HttpMethod method(); |
55 |
51 |
56 /** |
52 /** |
57 * Specifies the request path relative to the module path. |
53 * Specifies the request path relative to the module path. |
58 * |
54 * <p> |
59 * If a menu key is specified, this is also the path, which is linked |
55 * If a menu key is specified, this is also the path, which is linked |
60 * by the menu entry. |
56 * by the menu entry. |
61 * |
57 * <p> |
62 * The path must be specified <em>without</em> leading and trailing slash. |
58 * The path must be specified <em>without</em> leading and trailing slash. |
63 * |
59 * |
64 * @return the request path the annotated method should handle |
60 * @return the request path the annotated method should handle |
65 */ |
61 */ |
66 String requestPath() default ""; |
62 String requestPath() default ""; |
67 |
63 |
68 /** |
64 /** |
69 * Returns the properties key for the (sub) menu label. |
65 * Returns the properties key for the (sub) menu label. |
70 * |
66 * <p> |
71 * This should only be used for {@link HttpMethod#GET} requests. |
67 * This should only be used for {@link HttpMethod#GET} requests. |
72 * |
68 * |
73 * @return the properties key |
69 * @return the properties key |
74 */ |
70 */ |
75 String menuKey() default ""; |
71 String menuKey() default ""; |
76 } |
72 } |