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 7873105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:24:55+00:00 2026-06-03T02:24:55+00:00

I have a restful web service based on cxf and camel. I am using

  • 0

I have a restful web service based on cxf and camel. I am using Camel routing for my workflow it is something like this..

Client –> My Rest Service Class –> Camel Custom Processors –> some method Foo of Bean Bar

The bean FooBar looks like something this ..

public class Bar {

    public MyObject foo(String request, Exchange exchange){
    //do some procesing 

    return instance of MyObject;
}

Now the problem is that whenever i test this i get a respone code of 200 at client side. Now if i want this code to be something else than 200 i need to set it in HttpServletResponse or some other javax.ws.rs.core.Response object but how i do i access this response object.

I tried the following but it didn’t solve my problem.

  1. exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 202);

  2. exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE, 202);

  3. exchange.setProperty(Exchange.HTTP_RESPONSE_CODE, 202);

  4. Response.status(202).build();

  • 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-06-03T02:24:56+00:00Added an answer on June 3, 2026 at 2:24 am

    Here is a workaround, i dont know if this is the only way to do it, but this works for me. Change the return type of your method Foo to the Response(javax.ws.rs.core) and then wrap your object (“instance of myobject”) in this response and also you can specify the mime type if you want to .. following is a sample..

    public class Bar {
        public Response foo(String request, Exchange exchange){
            //make instance of MyObject
            MyObject myObj = new myObj();
            //do your processing and set the object in response code
            Response response = Response.status(Status.ACCEPTED).entity(myObj).type(MediaType.APPLICATION_JSON).build();
            return response;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a RESTful PHP web service using Lithium which contains comments, each
I have a restful web service that generates two types of output based on
We have a RESTful web service with a URI pattern like: /orders/ /orders/1 /orders/1/changelog
I'm trying to consume a RESTful web service using WCF. I have no control
I have a restful web service which can deal with DTOs in json format
I have a ReSTful web service which needs to parse locale-sensitive data from the
I have a web service site that is restful enabled, so other websites/ajax script
I have a web app with a clean RESTful JSON API, based on Rails
I have to create a RESTful webapplication/Web service which performs CRUD operations where I
We currently have a SOAP based web service that our in house applications use

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.