Package org.restlet.data

Examples of org.restlet.data.Request


    populateHostNames();
    populateServiceTypes();
  }
  public void populateHostNames() {
    try {
      Request request = new Request(Method.GET,"http://info.teragrid.org/web-apps/XML/ctss-resources-v1/");
      Client client = new Client(Protocol.HTTP);
      Response response = client.handle(request);
      DomRepresentation representation = response.getEntityAsDom();
      Document document = representation.getDocument();
      NodeList nodeList = document.getElementsByTagName("Resource");
View Full Code Here


   * retrieves information from REST webservices and populates the gridFtpEndpoints
   */
  public void populateGridFtpEndPoints(String hostName) {
    if(!hostName.isEmpty()){
    try{
      Request request = new Request(Method.GET,"http://info.teragrid.org/web-apps/xml/kit-services-v1/type/gridftp/");
      Client client = new Client(Protocol.HTTP);
      Response response = client.handle(request);
      DomRepresentation representation = response.getEntityAsDom();
      Document document = representation.getDocument();
      NodeList nodeList = document.getElementsByTagName("Service");
View Full Code Here

   * retrieves the list of service types available in the REST webservice.
   * Need to remove the hard-coded checks on the service types as only 3 types has to be displayed now.
   */
  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");
View Full Code Here

    if(event.getNewValue() instanceof List<?>){
      List<String> types = (List<String>) event.getNewValue();
      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");
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

    /**
     * @see org.connotea.Connector#get(java.lang.String)
     */
    public Response get(String uri) {
        Request request = new Request(Method.GET, uri);
        request.setChallengeResponse(getChallengeResponse());
        org.restlet.data.Response r = client.handle(request);
        int status = r.getStatus().getCode();
        Document document = null;
        try {
            r.getEntityAsDom().getDocument();
View Full Code Here

        try {
            form.encode();
        } catch (Exception e) {
            throw new ConnoteaRuntimeException("could not encode form: " + form);
        }
        Request request = new Request(Method.POST, uri);
        request.setEntity(form.getWebRepresentation());
        request.setChallengeResponse(getChallengeResponse());
        org.restlet.data.Response r = client.handle(request);
        int status = r.getStatus().getCode();
        Document document = null;
        try {
            document = r.getEntityAsDom().getDocument();
View Full Code Here

        }
    }

    private static Representation getRepresentation(String resource) {
        return new Client(Protocol.FILE).handle(
                new Request(Method.GET, resource)).getEntity();
    }
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

TOP

Related Classes of org.restlet.data.Request

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.