Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.Client


    super(TimelineClientImpl.class.getName());
    ClientConfig cc = new DefaultClientConfig();
    cc.getClasses().add(YarnJacksonJaxbJsonProvider.class);
    if (UserGroupInformation.isSecurityEnabled()) {
      urlFactory = new TimelineAuthenticatedURLConnectionFactory();
      client = new Client(new URLConnectionClientHandler(urlFactory), cc);
    } else {
      client = Client.create(cc);
    }
  }
View Full Code Here


  // Do some sanity testing of the web-services after fail-over.
  private void checkActiveRMWebServices() throws JSONException {

    // Validate web-service
    Client webServiceClient = Client.create(new DefaultClientConfig());
    InetSocketAddress rmWebappAddr =
        NetUtils.getConnectAddress(rm.getWebapp().getListenerAddress());
    String webappURL =
        "http://" + rmWebappAddr.getHostName() + ":" + rmWebappAddr.getPort();
    WebResource webResource = webServiceClient.resource(webappURL);
    String path = app.getApplicationId().toString();

    ClientResponse response =
        webResource.path("ws").path("v1").path("cluster").path("apps")
          .path(path).accept(MediaType.APPLICATION_JSON)
View Full Code Here

     * @param additionalResourceUrl url portion past the base to use
     * @return the resource builder to execute
     */
    private WebResource.Builder prepareClient(String additionalResourceUrl)
    {
      final Client client = Client.create();
        if (configuration.isAuthorisation()) {
            client.addFilter(new HTTPBasicAuthFilter(
                           configuration.getAdminUser(),
                           configuration.getAdminPassword()));
        }
        client.addFilter(new CsrfProtectionFilter());
        return client.resource(this.adminBaseUrl + additionalResourceUrl).accept(MediaType.APPLICATION_XML_TYPE);
    }
View Full Code Here

    private Client client;
    protected WebResource webResource;

    @Before
    public void setUp() throws Exception {
        client = new Client();
        webResource = client.resource(RestfulTest.URI);
    }
View Full Code Here

import es.mahulo.battleship.model.Shot;

public class GameServerRESTTest  {
 
  public void getGameList() throws JSONException {
    Client c = Client.create();
    WebResource r = c.resource("http://192.168.1.33:8080/BattleShip/rest/gameserver/games/1");
      
    String result = r.accept(MediaType.APPLICATION_JSON_TYPE).get(String.class);
   
    JSONObject gamesJSON = new JSONObject(result);
    JSONArray games = gamesJSON.getJSONArray("game");
View Full Code Here

   
  }

  public void createGame() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/server/creategame/1");
      
    String result = r.accept(MediaType.APPLICATION_JSON_TYPE).get(String.class);
    System.out.println(result);
  }
View Full Code Here

    System.out.println(result);
  }
 
  public void joinGame() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/server/join/1903/2");
      
    String result = r.accept(MediaType.APPLICATION_JSON_TYPE).get(String.class);
    System.out.println(result);
  }
View Full Code Here

    System.out.println(result);
  }
 
  public void addShipTest() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/addship/1802");
   
    Ship ship = new Ship();
    ArrayList<Cell> cells = new ArrayList<Cell>();
    ship.setCells(cells);
   
View Full Code Here

    r.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, arrayShip);
  }
 
  public void shotTest() {
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/shot/1802");
   
    Shot shot = new Shot();
    shot.setX(1);
    shot.setY(1);
   
View Full Code Here

   
   
    ArrayShip arrayShip = new ArrayShip();
    arrayShip.setShips(ships);
   
    Client c = Client.create();
    WebResource r = c.resource("http://localhost:8080/BattleShip/rest/game/addship/2201");

    r.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, arrayShip);

  }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.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.