Annotation Interface Path
Identifies a POJO to be used as a path entry on an HTTP request.
Can be used in the following locations:
- Arguments and argument-types of server-side
@RestOp -annotated methods. - Arguments and argument-types of client-side
@RemoteResource -annotated interfaces. - Methods and return types of server-side and client-side
@Request -annotated interfaces.
Arguments and argument-types of server-side @RestOp-annotated methods
Annotation that can be applied to a parameter of a
Example:
The special name
See Also:
Arguments and argument-types of client-side @RemoteResource-annotated interfaces
Annotation applied to Java method arguments of interface proxies to denote that they are path variables on the request.
See Also:
Methods and return types of server-side and client-side @Request-annotated interfaces
See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionDefault value for this parameter.String[]Optional description for the exposed API.URL path variable name.schema field of the Swagger Parameter Object.Short, concise summary of the exposed API.A synonym forname().
-
Element Details
-
def
Default value for this parameter.- Returns:
- The annotation value.
- Default:
- "_NONE_"
-
description
Optional description for the exposed API.- Returns:
- The annotation value.
- Since:
- 9.2.0
- Default:
- {}
-
summary
Short, concise summary of the exposed API.Intended as a brief, single-line description suitable for AI/LLM consumption, compact documentation, or any context where brevity matters. See
Schema.summary()for the canonical definition.- Returns:
- The annotation value.
- Since:
- 10.0.0
- Default:
- ""
-
name
URL path variable name.The path remainder after the path match can be referenced using the name
"/*" .
The non-URL-decoded path remainder after the path match can be referenced using the name"/**" .The value should be either a valid path parameter name, or
"*" to represent multiple name/value pairsA blank value (the default) has the following behavior:
-
If the data type is
NameValuePairs ,Map , or a bean, then it's the equivalent to"*" which will cause the value to be treated as name/value pairs.Examples:
// When used on a REST method @RestPost public void addPet(@Path JsonMapallPathParameters ) {...}// When used on a remote method parameter @RemoteResource (path="/myproxy" )public interface MyProxy {// Equivalent to @Path("*") @RemoteGet ("/mymethod/{foo}/{bar}" ) String myProxyMethod1(@Path Map<String,Object>allPathParameters ); }// When used on a request bean method public interface MyRequest {// Equivalent to @Path("*") @Path Map<String,Object> getPathVars(); } -
If used on a request bean method, uses the bean property name.
Example:
public interface MyRequest {// Equivalent to @Path("foo") @Path String getFoo(); }
The name field MUST correspond to the associated path segment from the path field in the Paths Object. See Path Templating for further information.
Notes:
- The format is plain-text.
- Returns:
- The annotation value.
- Default:
- ""
-
If the data type is
-
schema
schema field of the Swagger Parameter Object.The schema defining the type used for parameter.
The
@Schemaannotation can also be used standalone on the parameter or type. Values specified on this field override values specified on the type, and values specified on child types override values specified on parent types.Used for:
- Server-side schema-based parsing and parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing and serializing validation.
- Returns:
- The annotation value.
- Default:
- @org.apache.juneau.commons.Schema
-
value
A synonym forname().Allows you to use shortened notation if you're only specifying the name.
The following are completely equivalent ways of defining a path entry:
@RestGet ("/pet/{petId}" )public Pet getPet(@Path (name="petId" )long petId ) { ... }@RestGet ("/pet/{petId}" )public Pet getPet(@Path ("petId" )long petId ) { ... }- Returns:
- The annotation value.
- Default:
- ""
-