Annotation Interface Socket


@Qualifier @Retention(RUNTIME) @Target({FIELD,PARAMETER}) public @interface Socket
CDI qualifier to inject a JAX-RS client or URI for a named socket.

The supported types are:

This annotation can be used on constructor parameters, or class fields. Test method parameter injection may be supported depending on the test framework integration.

Also note that the default socket name is "@default".

E.g. constructor injection:

 class MyTest {
     private final WebTarget target;

     @Inject
     MyTest(@Socket("@default") URI uri) {
         target = ClientBuilder.newClient().target(uri);
     }
 }
 

E.g. field injection:

 class MyTest {

     @Inject // optional
     @Socket("@default")
     private WebTarget target;
 }
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Name of the socket.
  • Element Details

    • value

      String value
      Name of the socket.
      Returns:
      socket name