Class HttpRosetteAPI

All Implemented Interfaces:
AutoCloseable

public class HttpRosetteAPI extends AbstractRosetteAPI
Access to the RosetteAPI via HTTP.
  • Field Details

  • Method Details

    • getFailureRetries

      public int getFailureRetries()
      Return failure retries.
      Returns:
      failure retries
    • info

      public com.basistech.rosette.apimodel.InfoResponse info() throws IOException, HttpRosetteAPIException
      Gets information about the Rosette API, returns name, version, build number and build time.
      Returns:
      InfoResponse
      Throws:
      HttpRosetteAPIException - Rosette specific exception
      IOException - General IO exception
    • ping

      public com.basistech.rosette.apimodel.PingResponse ping() throws IOException, HttpRosetteAPIException
      Pings the Rosette API for a response indicating that the service is available.
      Returns:
      PingResponse
      Throws:
      HttpRosetteAPIException - Rosette specific exception
      IOException - General IO exception
    • getSupportedLanguages

      public com.basistech.rosette.apimodel.SupportedLanguagesResponse getSupportedLanguages(String endpoint) throws HttpRosetteAPIException
      Gets the set of language and script codes supported by the specified Rosette API endpoint.
      Specified by:
      getSupportedLanguages in class AbstractRosetteAPI
      Parameters:
      endpoint - Rosette API endpoint.
      Returns:
      SupportedLanguagesResponse
      Throws:
      HttpRosetteAPIException - for an error returned from the Rosette API.
    • getSupportedLanguagePairs

      public com.basistech.rosette.apimodel.SupportedLanguagePairsResponse getSupportedLanguagePairs(String endpoint) throws HttpRosetteAPIException
      Gets the set of language, script codes and transliteration scheme pairs supported by the specified Rosette API endpoint.
      Specified by:
      getSupportedLanguagePairs in class AbstractRosetteAPI
      Parameters:
      endpoint - Rosette API endpoint.
      Returns:
      SupportedLanguagePairsResponse
      Throws:
      HttpRosetteAPIException - for an error returned from the Rosette API.
    • perform

      public <RequestType extends com.basistech.rosette.apimodel.Request, ResponseType extends com.basistech.rosette.apimodel.Response> ResponseType perform(String endpoint, RequestType request, Class<ResponseType> responseClass) throws HttpRosetteAPIException
      Description copied from class: AbstractRosetteAPI
      Perform a request to an endpoint of the Rosette API.
      Specified by:
      perform in class AbstractRosetteAPI
      Type Parameters:
      RequestType - the type of the request object.
      ResponseType - the type of the response object.
      Parameters:
      endpoint - which endpoint.
      request - the data for the request.
      responseClass - the Java Class object for the response object.
      Returns:
      the response.
      Throws:
      HttpRosetteAPIException - for an error returned from the Rosette API.
      com.basistech.rosette.RosetteRuntimeException - for other errors, such as communications problems with HTTP.
    • perform

      public <RequestType extends com.basistech.rosette.apimodel.Request> com.basistech.rosette.dm.AnnotatedText perform(String endpoint, RequestType request) throws HttpRosetteAPIException
      Description copied from class: AbstractRosetteAPI
      Perform a request to an endpoint of the Rosette API.
      Specified by:
      perform in class AbstractRosetteAPI
      Type Parameters:
      RequestType - the type of the request object.
      Parameters:
      endpoint - which endpoint.
      request - the data for the request.
      Returns:
      the response, AnnotatedText.
      Throws:
      HttpRosetteAPIException - for an error returned from the Rosette API.
      com.basistech.rosette.RosetteRuntimeException - for other errors, such as communications problems with HTTP.
    • performAsync

      public <RequestType extends com.basistech.rosette.apimodel.Request, ResponseType extends com.basistech.rosette.apimodel.Response> Future<ResponseType> performAsync(String endpoint, RequestType request, Class<ResponseType> responseClass) throws HttpRosetteAPIException
      This method always throws UnsupportedOperationException.
      Specified by:
      performAsync in class AbstractRosetteAPI
      Type Parameters:
      RequestType - The class of the request object for this endpoint.
      ResponseType - the class of the response object for this endpoint.
      Parameters:
      endpoint - which endpoint.
      request - the data for the request.
      responseClass - the Java Class object for the response object.
      Returns:
      a Future for the response.
      Throws:
      HttpRosetteAPIException
    • createRosetteRequest

      public RosetteRequest createRosetteRequest(String endpoint, com.basistech.rosette.apimodel.Request request, Class<? extends com.basistech.rosette.apimodel.Response> responseClass)
      Creates a RosetteRequest which can be sent concurrently through this HttpRosetteAPI
      Parameters:
      endpoint - the endpoint to which the request is sent to
      request - the request object
      responseClass - Response's class
      Returns:
      RosetteRequest which when started sends the predefined request through this http client
    • close

      public void close() throws IOException
      Throws:
      IOException