How to set HTTP header in RESTEasy client framework?

前端 未结 4 697
栀梦
栀梦 2021-01-31 11:19

RESTEasy (a JAX-RS implementation) has a nice client framework, eg:

RegisterBuiltin.register(ResteasyProviderFactory.getInstance());

SimpleClient client = Proxy         


        
4条回答
  •  佛祖请我去吃肉
    2021-01-31 11:55

    Even easier:

        ResteasyClient client = new ResteasyClientBuilder().build();
        ResteasyWebTarget target = client.target("https://test.com");
        Response response = target.request().header("Authorization", "Basic test123")
                .acceptEncoding("gzip, deflate")
                .post(Entity.entity(some_xml, "application/x-www-form-urlencoded"));
    

提交回复
热议问题