Annotation Type PathPrefix


@Retention(RUNTIME)
@Target(TYPE)
public @interface PathPrefix
Annotation that can be used on a class as a path prefix for all the methods that handle http request. For example

 > @PathPrefix("/b")
 > public class MyService {
 >     @Get("/c")
 >     public HttpResponse foo() { ... }
 > }
 
And then can be registered to ServerBuilder like this

 ServerBuilder sb = Server.builder();
 sb.annotatedService("/a", new MyService());
 

In this case foo() method handles a request that matches path /a/b/c

  • Required Element Summary

    Required Elements
    Modifier and Type Required Element Description
    String value
    A path for the annotated service class.
  • Element Details

    • value

      String value
      A path for the annotated service class.