Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6347759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:17:03+00:00 2026-05-24T21:17:03+00:00

RESTEasy (a JAX-RS implementation) has a nice client framework , eg: RegisterBuiltin.register(ResteasyProviderFactory.getInstance()); SimpleClient client

  • 0

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

RegisterBuiltin.register(ResteasyProviderFactory.getInstance());

SimpleClient client = ProxyFactory.create(SimpleClient.class, "http://localhost:8081");
client.putBasic("hello world");

How do you set HTTP headers?

Clarification:

The solution proposed by jkeeler is a good approach, but I want to set HTTP headers on ProxyFactory level and I don’t want to pass headers to the client object. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:17:04+00:00Added an answer on May 24, 2026 at 9:17 pm

    I have found a solution:

    import org.apache.commons.httpclient.HttpClient;
    import org.jboss.resteasy.client.ClientRequest;
    import org.jboss.resteasy.client.ClientResponse;
    import org.jboss.resteasy.client.ProxyFactory;
    import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
    import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
    import org.jboss.resteasy.spi.ResteasyProviderFactory;
    
    RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
    HttpClient httpClient = new HttpClient();
    ApacheHttpClientExecutor executor = new ApacheHttpClientExecutor(httpClient) {
        @Override
        public ClientResponse execute(ClientRequest request) throws Exception {
            request.header("X-My-Header", "value");
            return super.execute(request);
        }           
    };
    
    SimpleClient client = ProxyFactory.create(SimpleClient.class, "http://localhost:8081", executor);
    client.putBasic("hello world");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using RESTEasy 2.2.1.GA as my JAX-RS implementation to create a client to connect
Yesterday I tried to use the client side of the RestEasy framework. The interface
I have a Java client that calls a RESTEasy (JAX-RS) Java server. It is
I cannot get JAXB to unmarshal a timestamp in a Resteasy JAX-RS server application.
I am using the RestEasy library to do JAX-RS web services. I am not
(specifically RESTeasy) It would be nice (for a single file) to have a method
I am working on a webapp that uses both the Spring Framework and RESTEasy.
Consider the following simple RESTEasy (JAX-RS) service: @Path(/example-service) public interface ExampleService { @Path(/ping) @GET
I am using restEasy(Restful implementation for jboss) ejb3.0, Jboss5.1.1 AS I did restful service
I am developing a JAX-RS webservice using RestEasy 2.2.2 to be deployed to Tomcat

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.