Package org.restlet.resource

Examples of org.restlet.resource.ClientResource


    Reference validationURL = new Reference(casServerURL + "proxyValidate");
    validationURL.addQueryParameter("service", getServiceURL(request));
    validationURL.addQueryParameter("ticket", serviceTicket);
    validationURL.addQueryParameter("pgtUrl", getServiceURL(request));

    ClientResource serviceValidate = new ClientResource(validationURL);
    try {
      Representation validationResult = serviceValidate.get();
      ServiceResponse serviceResponse = ServiceResponseParser.parse(validationResult.getStream());

      if (serviceResponse instanceof AuthSuccess) {
        AuthSuccess authSuccess = (AuthSuccess)serviceResponse;
        request.getClientInfo().setUser(new User(authSuccess.getUser()));
View Full Code Here


      }
    });
   
    server.start();
   
    new ClientResource("http://localhost:8182").get().write(System.out);
   
    server.stop();
  }
View Full Code Here


    @Test
    public void testNoPaging() throws IOException, ResourceException, JSONException
    {
        ClientResource resource = new ClientResource(TestComponent.getBaseUrl() + "/numbers");
        assertError(resource);
    }
View Full Code Here


    @Test
    public void testInvalidPaging() throws IOException, ResourceException, JSONException
    {
        ClientResource resource = new ClientResource(TestComponent.getBaseUrl() + "/numbers");
        resource.getRequest().getAttributes()
                .put(HeaderConstants.ATTRIBUTE_HEADERS, new Form(PagingHeaderResource.ITEM_RANGE_HEADER + "=foo"));
        assertError(resource);
    }
View Full Code Here


    @Test
    public void testPaging() throws IOException, ResourceException, JSONException
    {
        ClientResource resource = new ClientResource(TestComponent.getBaseUrl() + "/numbers");
        resource.getRequest()
                .getAttributes()
                .put(HeaderConstants.ATTRIBUTE_HEADERS,
                        new Form(PagingHeaderResource.ITEM_RANGE_HEADER + "=items=5-23"));
        assertJson(resource);
    }
View Full Code Here


    @Test
    public void testNoPaging() throws IOException, ResourceException, JSONException
    {
        ClientResource resource = new ClientResource(TestComponent.getBaseUrl() + "/numbers");
        assertError(resource);
    }
View Full Code Here


    @Test
    public void testInvalidPaging() throws IOException, ResourceException, JSONException
    {
        ClientResource resource = new ClientResource(TestComponent.getBaseUrl() + "/numbers?foo");
        assertError(resource);
    }
View Full Code Here


    @Test
    public void testPaging() throws IOException, ResourceException, JSONException
    {
        ClientResource resource = new ClientResource(TestComponent.getBaseUrl() + "/numbers?offset=5&pageSize=19");
        assertJson(resource);
    }
View Full Code Here


    @Test
    public void testInvalidPaging() throws IOException, ResourceException, JSONException
    {
        ClientResource resource = new ClientResource(TestComponent.getBaseUrl() + "/numbers/foo/bar");
        assertError(resource);
    }
View Full Code Here


    @Test
    public void testPaging() throws IOException, ResourceException, JSONException
    {
        ClientResource resource = new ClientResource(TestComponent.getBaseUrl() + "/numbers/5/19");
        assertJson(resource);
    }
View Full Code Here

TOP

Related Classes of org.restlet.resource.ClientResource

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.