Inferred HTTP Methods and Paths
When the name
and/or path
values are not specified, their values are inferred from the Java method name.
The HTTP method can be inferred from the Java method by starting the method name with any of the following:
get
put
post
delete
options
head
trace
patch
If path
is not defined, it's inferred from the Java method name (minus the prefix above).
Examples
// Method="GET", path="/foo"
@RestOp
public String getFoo() {...}
// Method="DELETE", path="/foo"
@RestOp
public String deleteFoo() {...}
// Method="GET", path="/foo"
// "GET" is default
@RestOp
public String foo() {...}
// Method="GET", path="/"
@RestOp(path="/")
public String foo() {...}
// Method="GET", path="/"
@RestOp
public String get() {...}
// Method="POST", path="/"
@RestOp
public String post() {...}
note
If name
and path
are both specified, the Java method name can be anything.