Class MyTestClient

  • All Implemented Interfaces:
    org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle

    public class MyTestClient
    extends AuthedHTTPClient
    test client, primarly used for testing
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.AbstractLifeCycle.StopException
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container

        org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

        org.eclipse.jetty.util.component.Dumpable.DumpableContainer
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

        org.eclipse.jetty.util.component.LifeCycle.Listener
    • Field Summary

      • Fields inherited from class org.eclipse.jetty.client.HttpClient

        USER_AGENT
      • Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        FAILED, STARTED, STARTING, STOPPED, STOPPING
      • Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

        KEY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void authorizeRequest​(org.eclipse.jetty.client.api.Request request)
      implement this method to add your login information to the request
      void clearToken()  
      org.eclipse.jetty.client.api.ContentResponse getResponse​(String url, org.eclipse.jetty.http.HttpMethod method, Object body, int maxRetries, Integer expectedStatus)
      get the response for a given result, if 401 is returned the jwt will be renewed, and it will be tried again
      String getToken()  
      boolean isConnected()  
      String login()  
      boolean refreshToken()
      get a new JWT token (try to login)
      boolean refreshTokenIfNeeded()  
      • Methods inherited from class org.eclipse.jetty.client.HttpClient

        copyRequest, createOrigin, doStart, doStop, dump, findProtocolHandler, FORM, FORM, GET, GET, getAcceptEncodingField, getAddressResolutionTimeout, getAuthenticationStore, getBindAddress, getByteBufferPool, getConnectTimeout, getContentDecoderFactories, getCookieStore, getDefaultRequestContentType, getDestinations, getExecutor, getHttpCompliance, getIdleTimeout, getMaxConnectionsPerDestination, getMaxRedirects, getMaxRequestsQueuedPerDestination, getName, getProtocolHandlers, getProxyConfiguration, getRequestBufferSize, getRequestListeners, getResponseBufferSize, getScheduler, getSocketAddressResolver, getSslContextFactory, getTransport, getUserAgentField, isConnectBlocking, isDefaultPort, isFollowRedirects, isRemoveIdleDestinations, isSchemeSecure, isStrictEventOrdering, isTCPNoDelay, isUseInputDirectByteBuffers, isUseOutputDirectByteBuffers, newConnection, newHttpRequest, newRequest, newRequest, newRequest, newSslClientConnectionFactory, normalizeHost, normalizePort, POST, POST, removeDestination, resolveDestination, resolveDestination, send, setAddressResolutionTimeout, setAuthenticationStore, setBindAddress, setByteBufferPool, setConnectBlocking, setConnectTimeout, setCookieStore, setDefaultRequestContentType, setExecutor, setFollowRedirects, setHttpCompliance, setIdleTimeout, setMaxConnectionsPerDestination, setMaxRedirects, setMaxRequestsQueuedPerDestination, setName, setRemoveIdleDestinations, setRequestBufferSize, setResponseBufferSize, setScheduler, setSocketAddressResolver, setStrictEventOrdering, setTCPNoDelay, setUseInputDirectByteBuffers, setUseOutputDirectByteBuffers, setUserAgentField
      • Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle

        addBean, addBean, addEventListener, addManaged, contains, destroy, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans
      • Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

        getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toString
      • Methods inherited from interface org.eclipse.jetty.util.component.Container

        getCachedBeans, getEventListeners
      • Methods inherited from interface org.eclipse.jetty.util.component.Dumpable

        dumpSelf
      • Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

        isDumpable
    • Constructor Detail

      • MyTestClient

        public MyTestClient​(@Nonnull
                            String baseurl,
                            @Nonnull
                            String user,
                            @Nonnull
                            String pass)
                     throws Exception
        create a new Client
        Parameters:
        baseurl - the base url
        user - the password
        pass - the password
        Throws:
        Exception - some catastrophic failure