javax.ws.rs.client

Interface Invocation


  • public interface Invocation
    A client request invocation. An invocation is a request that has been prepared and is ready for execution. Invocations provide a generic (command) interface that enables a separation of concerns between the creator and the submitter. In particular, the submitter does not need to know how the invocation was prepared, but only how it should be executed (synchronously or asynchronously) and when.
    Author:
    Marek Potociar
    See Also:
    Invocation.Builder
    • Method Detail

      • invoke

        Response invoke()
        Synchronously invoke the request and receive a response back.
        Returns:
        response object as a result of the request invocation.
        Throws:
        ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).
        ProcessingException - in case the request processing or subsequent I/O operation fails.
      • invoke

        <T> T invoke(Class<T> responseType)
        Synchronously invoke the request and receive a response of the specified type back.
        Type Parameters:
        T - response type
        Parameters:
        responseType - Java type the response should be converted into.
        Returns:
        response object of the specified type as a result of the request invocation.
        Throws:
        ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).
        ProcessingException - in case the request processing or subsequent I/O operation fails.
        WebApplicationException - in case the response status code of the response returned by the server is not successful.
      • invoke

        <T> T invoke(GenericType<T> responseType)
        Synchronously invoke the request and receive a response of the specified generic type back.
        Type Parameters:
        T - generic response type
        Parameters:
        responseType - type literal representing a generic Java type the response should be converted into.
        Returns:
        response object of the specified generic type as a result of the request invocation.
        Throws:
        ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or during conversion of the response entity data to an instance of a particular Java type).
        ProcessingException - in case the request processing or subsequent I/O operation fails.
        WebApplicationException - in case the response status code of the response returned by the server is not successful.
      • submit

        Future<Response> submit()
        Submit the request for an asynchronous invocation and receive a future response back.

        Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps a ProcessingException thrown in case of an invocation processing failure. In case a processing of a properly received response fails, the wrapped processing exception will be of ResponseProcessingException type and will contain the Response instance whose processing has failed.

        Returns:
        future response object as a result of the request invocation.
      • submit

        <T> Future<T> submit(Class<T> responseType)
        Submit the request for an asynchronous invocation and receive a future response of the specified type back.

        Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps either a ProcessingException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the specified response type is not Response. In case a processing of a properly received response fails, the wrapped processing exception will be of ResponseProcessingException type and will contain the Response instance whose processing has failed.

        Type Parameters:
        T - response type
        Parameters:
        responseType - Java type the response should be converted into.
        Returns:
        future response object of the specified type as a result of the request invocation.
      • submit

        <T> Future<T> submit(GenericType<T> responseType)
        Submit the request for an asynchronous invocation and receive a future response of the specified generic type back.

        Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps either a ProcessingException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the specified response type is not Response. In case a processing of a properly received response fails, the wrapped processing exception will be of ResponseProcessingException type and will contain the Response instance whose processing has failed.

        Type Parameters:
        T - generic response type
        Parameters:
        responseType - type literal representing a generic Java type the response should be converted into.
        Returns:
        future response object of the specified generic type as a result of the request invocation.
      • submit

        <T> Future<T> submit(InvocationCallback<T> callback)
        Submit the request for an asynchronous invocation and register an InvocationCallback to process the future result of the invocation.

        Note that calling the Future.get() method on the returned Future instance may throw an ExecutionException that wraps either a ProcessingException thrown in case of an invocation processing failure or a WebApplicationException or one of its subclasses thrown in case the received response status code is not successful and the generic type of the supplied response callback is not Response. In case a processing of a properly received response fails, the wrapped processing exception will be of ResponseProcessingException type and will contain the Response instance whose processing has failed.

        Type Parameters:
        T - response type
        Parameters:
        callback - invocation callback for asynchronous processing of the request invocation result.
        Returns:
        future response object of the specified type as a result of the request invocation.

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/08/2025 17:18:08 Cette version de la page est en cache (à la date du 21/08/2025 17:18:08) afin d'accélérer le traitement.
Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.

Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/ws/rs/client/Invocation.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, Invocation (Java(TM) EE 7 Specification APIs)

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.