Package org.restlet.data

Examples of org.restlet.data.Response


   */
  public void populateServiceTypes() {
    try {
      Request request = new Request(Method.GET,"http://info.teragrid.org/restdemo/xml/tg/services");
      Client client = new Client(Protocol.HTTP);
      Response response = client.handle(request);
      DomRepresentation representation = response.getEntityAsDom();
      Document document = representation.getDocument();
      NodeList nodeList = document.getElementsByTagName("Service");
      for(int i=0;i<nodeList.getLength();i++){
        String type = nodeList.item(i).getAttributes().getNamedItem("Type").getNodeValue();
        // need to remove this in the future if all the service types have to be displayed
View Full Code Here


      Iterator<String> iterator = types.iterator();
      while(iterator.hasNext()){
        try{
          Request request = new Request(Method.GET,"http://info.teragrid.org/restdemo/xml/tg/services/"+iterator.next());
          Client client = new Client(Protocol.HTTP);
          Response response = client.handle(request);
          DomRepresentation representation = response.getEntityAsDom();
          Document document = representation.getDocument();
          NodeList nodeList = document.getElementsByTagName("Service");
          String currentHostName = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("hostInfo:hostName");
          for(int i=0;i<nodeList.getLength();i++){
            String resource = nodeList.item(i).getAttributes().getNamedItem("ResourceID").getNodeValue();
View Full Code Here

    }

    @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

    }

    @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

    }

    @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

    }

    @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

    }

    @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

    }

    @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

        if (LOG.isDebugEnabled()) {
            LOG.debug("Client sends a request (method: " + request.getMethod()
                    + ", uri: " + resourceUri + ")");
        }
       
        Response response = client.handle(request);
        binding.populateExchangeFromRestletResponse(exchange, response);
    }
View Full Code Here

        form.add("serversString", servers);
        Representation representation = form.getWebRepresentation();
        URL url = localServerEndPoint.toURL();
        String requestURL = url.toString();
        Request request = new Request(Method.POST, requestURL, representation);
        Response response = client.handle(request);
        if (!response.getStatus().isSuccess()) {
            throw new RuntimeException(response.getStatus().toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.restlet.data.Response

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.