Package org.restlet

Examples of org.restlet.Client


        assertEquals("received GET request with id=99991 and x=6",
                response.getEntity().getText());
    }
   
    public void testUnhandledConsumer() throws IOException {
        Client client = new Client(Protocol.HTTP);
        Response response = client.handle(new Request(Method.POST,
                "http://localhost:9080/orders/99991/6"));
        // expect error status as no Restlet consumer to handle POST method
        assertEquals(Status.CLIENT_ERROR_NOT_FOUND, response.getStatus());
        assertNotNull(response.getEntity().getText());
    }
View Full Code Here


    private static final Log LOG = LogFactory.getLog(RestletProducer.class);
    private Client client;

    public RestletProducer(RestletEndpoint endpoint) throws Exception {
        super(endpoint);
        client = new Client(endpoint.getProtocol());
    }
View Full Code Here

    // start admin
    _adminThread = new AdminThread(ZK_ADDR, ADMIN_PORT);
    _adminThread.start();

    // create a client
    _gClient = new Client(Protocol.HTTP);

    // wait for the web service to start
    Thread.sleep(100);
  }
View Full Code Here

  public ZkPropertyTransferClient(int maxConcurrentTasks) {
    _maxConcurrentTasks = maxConcurrentTasks;
    _executorService = Executors.newFixedThreadPool(_maxConcurrentTasks);
    _clients = new Client[_maxConcurrentTasks];
    for (int i = 0; i < _clients.length; i++) {
      _clients[i] = new Client(Protocol.HTTP);
    }
    _timer = new Timer(true);
    _timer.schedule(new SendZNRecordTimerTask(), SEND_PERIOD, SEND_PERIOD);
    _dataBufferRef.getAndSet(new ConcurrentHashMap<String, ZNRecordUpdate>());
  }
View Full Code Here

    private boolean throwException;

    public RestletProducer(RestletEndpoint endpoint) throws Exception {
        super(endpoint);
        this.throwException = endpoint.isThrowExceptionOnFailure();
        client = new Client(endpoint.getProtocol());
        client.setContext(new Context());
    }
View Full Code Here

    assertThat(logListener.entries.get(logListener.entries.size() - 1).getMessage(), is("Hello"));
  }

  private ClientResource createResource(String path)
  {
    Client client = new Client(Protocol.HTTP);
    ClientResource clientResource = new ClientResource(baseURI + path);
    clientResource.setNext(client);
    return clientResource;
  }
View Full Code Here

    assertThat(result, containsString(">junit<"));
  }

  private ClientResource createResource(String path)
  {
    Client client = new Client(Protocol.HTTP);
    ClientResource clientResource = new ClientResource(baseURI + path);
    clientResource.setNext(client);
    return clientResource;
  }
View Full Code Here

    private boolean throwException;

    public RestletProducer(RestletEndpoint endpoint) throws Exception {
        super(endpoint);
        this.throwException = endpoint.isThrowExceptionOnFailure();
        client = new Client(endpoint.getProtocol());
        client.setContext(new Context());
    }
View Full Code Here

        assertEquals("{'JSON'}", response);
    }

    @Test
    public void testConsumer() throws IOException {
        Client client = new Client(Protocol.HTTP);
        Response response = client.handle(new Request(Method.GET,
                "http://localhost:9080/orders/99991/6"));
        assertEquals("received GET request with id=99991 and x=6",
                response.getEntity().getText());
    }
View Full Code Here

                response.getEntity().getText());
    }

    @Test
    public void testUnhandledConsumer() throws IOException {
        Client client = new Client(Protocol.HTTP);
        Response response = client.handle(new Request(Method.POST,
                "http://localhost:9080/orders/99991/6"));
        // expect error status as no Restlet consumer to handle POST method
        assertEquals(Status.CLIENT_ERROR_NOT_FOUND, response.getStatus());
        assertNotNull(response.getEntity().getText());
    }
View Full Code Here

TOP

Related Classes of org.restlet.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.