Package com.redhat.gss.rs

Source Code of com.redhat.gss.rs.Test

package com.redhat.gss.rs;

import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.client.ProxyFactory;

public class Test
{
  public static void main(String[] args) throws Exception
  {
    String input = "{\"type\":\"one\",\"name\":\"Kyle\"}";

    TransferObject obj = new TransferObject();
    obj.setType("one\"");
    obj.setName("Kyle\"");

    //Simple ClientRequest invocation
    ClientRequest request = new ClientRequest("http://localhost:8080/sampleRest");
    request.accept("application/json");
    request.body("application/json", obj);
    ClientResponse<String> response = request.post(String.class);
    String t = response.getEntity();
    System.out.println("testRestClientRequestSendString: " + t);

    //Proxy example
    EscapedCharTest proxy = ProxyFactory.create(
      EscapedCharTest.class, "http://localhost:8080/sampleRest"
    );
    TransferObject ret = proxy.helloPost(obj);
    System.out.println("Proxy response: " + ret);
  }
}
TOP

Related Classes of com.redhat.gss.rs.Test

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.