No match for accept header

Asked on March 10, 2015
Hi Experts,

I am new to JAX-RS web service. I have created my service class as

    public Response saveForm(@Form EmpForm form) {}

My client code is accessing using it as

        Entity<Form> entity = Entity.form(form);
        Response response = target.request(MediaType.APPLICATION_FORM_URLENCODED).post(entity);
        String value = response.readEntity(String.class);

I am getting error as below. Need help. No match for accept header
at org.jboss.resteasy.core.registry.SegmentNode.match(
at org.jboss.resteasy.core.registry.SegmentNode.match(
at org.jboss.resteasy.core.registry.RootNode.match(

Replied on March 10, 2015
You should use media type as APPLICATION_JSON in your client code.
Response response = target.request(MediaType.APPLICATION_JSON).post(entity);

Find the link.

Write Answer

©2024 | Privacy Policy | Contact Us