{title:'HTTP Parts', updated:'9.0.0'}

In previous examples we showed the ability to pass in annotated parameters on {@link oajr.annotation.RestOp}-annotated methods to parse standard HTTP parts:

##### Example:

| @RestGet("/example1/{a1}/*") | public String doGetExample1( | @Path("a1") String a1, | @Query("p1") int p1, | @HasQuery("p2") boolean hasP3, | @Path("/*") String remainder, | @Header("Accept-Language") String lang | ) { | // Do something with all of those | }

Annotations are provided for both request and response HTTP parts.

The annotations used for defining the schema for request HTTP parts are:

- HTTP request parts:
  - {@link oaj.http.annotation.Request}
  - {@link oaj.http.annotation.Content}
  - {@link oaj.http.annotation.Header}
  - {@link oaj.http.annotation.FormData}
  - {@link oaj.http.annotation.Query}
  - {@link oaj.http.annotation.Path}
  - {@link oaj.http.annotation.HasFormData}
  - {@link oaj.http.annotation.HasQuery}
- HTTP response parts:
  - {@link oaj.http.annotation.Response}
  - {@link oaj.http.annotation.Content}
  - {@link oaj.http.annotation.Header}
  - {@link oaj.http.annotation.StatusCode}

These annotation can be used on method parameters or on the parameter types themselves, or a combination of both.

- When defined on types, annotations are aggregated from parent to child with child values taking precedence. When defined on both, annotations are aggregated with values on parameters taking precedence.