commit | author | age
|
e58690
|
1 |
/* |
U |
2 |
neon - Embeddable HTTP Server based on jdk.httpserver |
|
3 |
Copyright (C) 2024 Ulrich Hilger |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 of the |
|
8 |
License, or (at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
package de.uhilger.neon; |
|
19 |
|
|
20 |
import java.lang.annotation.ElementType; |
|
21 |
import java.lang.annotation.Retention; |
|
22 |
import java.lang.annotation.RetentionPolicy; |
|
23 |
import java.lang.annotation.Target; |
|
24 |
|
|
25 |
/** |
|
26 |
* Die Annotation Action kennzeichnet eine Methode, die |
|
27 |
* ausgefuehrt wird, wenn die in der Annotation |
|
28 |
* angegebene Route via HTTP angefragt wird. |
|
29 |
* |
|
30 |
* Beispiel |
|
31 |
* |
|
32 |
* @Action(route="/hallo", type=Type.GET) |
|
33 |
* public String sayHello(String nameToGreet) { |
|
34 |
* return "Hallo, " + nameToGreet; |
|
35 |
* } |
|
36 |
* |
|
37 |
* @author Ulrich Hilger |
|
38 |
*/ |
|
39 |
@Target( { ElementType.METHOD } ) |
|
40 |
@Retention( RetentionPolicy.RUNTIME ) |
|
41 |
public @interface Action { |
|
42 |
enum Type{GET, PUT, POST, DELETE} |
|
43 |
/** type of method */ |
|
44 |
Type type() default Type.GET; |
|
45 |
String[] handler(); |
|
46 |
String route(); |
|
47 |
} |