Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.WebResource.accept()


                String link = "http://mdwhotel.appspot.com/api/v1/reservation/?res_id=";
                link += reservationId + "&start=" + aDate + "&end=" + rDate + "&email=" + HR.getEmail();

                Client client = Client.create();
                WebResource webResource = client.resource(link);
                webResource.accept("application/xml");
                /*invoke the call*/
                String resp = webResource.put(String.class);

                /* if the application sends me back an XML who contains this message
                 * means that they don't have available rooms between thhose dates
View Full Code Here


            link += reservationId + "&email=" + HR.getEmail();


            Client client = Client.create();
            WebResource webResource = client.resource(link);
            webResource.accept("application/xml");
            /*invoke method */
            String resp = webResource.delete(String.class);

            /*delete the reservation from the DB*/
            dao.ofy().delete(HotelReservation.class, reservationId);
View Full Code Here

            link += checkin + "&end=" + checkout + "&room_id=" + room_id
                    + "&username=" + auxName.replaceAll(" ", "") + "&email=" + email;

            Client client = Client.create();
            WebResource webResource = client.resource(link);
            webResource.accept("application/xml");
            String resp = webResource.post(String.class);

            /*parsing the String to XML format and extract important fields*/
            StringToXML(resp);

View Full Code Here

        WebResource getResource = client.resource( TestUtil.SERVER_BASE
                                                   + BackupService.ROOT_PATH
                                                   + BackupService.JOBS_PATH );

        ClientResponse getResponse = getResource.accept(
                MediaType.APPLICATION_JSON ).get( ClientResponse.class );

        assertEquals( 200, getResponse.getStatus() );

    }
View Full Code Here

        WebResource getResource = client.resource( TestUtil.SERVER_BASE
                                                   + ExportService.ROOT_PATH
                                                   + ExportService.TRIGGER_PATH );

        ClientResponse getResponse = getResource.accept(
                MediaType.APPLICATION_JSON ).post( ClientResponse.class );

        assertEquals( 200, getResponse.getStatus() );

    }
View Full Code Here

        WebResource getResource = client.resource( TestUtil.SERVER_BASE
                                                   + BackupService.ROOT_PATH
                                                   + BackupService.JOBS_PATH
                                                   + "/0" );

        ClientResponse getResponse = getResource.accept(
                MediaType.APPLICATION_JSON ).delete( ClientResponse.class );

        assertEquals( 200, getResponse.getStatus() );

    }
View Full Code Here

    Client client = Client.create();

    WebResource webResource = client.resource(uri);

    Builder builder = webResource.accept(MediaType.APPLICATION_JSON);
    ClientResponse response = null;
    if (Method.GET.equals(method)) {
      response = builder.get(ClientResponse.class);
    } else if (Method.POST.equals(method)) {
      response = builder.post(ClientResponse.class);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.