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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:06:41+00:00 2026-06-12T08:06:41+00:00

I am using Apach CXF as REST provider. I want to gather data when

  • 0

I am using Apach CXF as REST provider.

I want to gather data when I enter the webservice, gather data before I enter the resposne and add some calculation to the response. For this question and for simplicity, lets assume I want to get the starting time on entering, the finishing time before the response is sent and add the total time to the response.

Now, how do I do that? I created In and Out interceptors that works fine alone, but how do I use the data from the In interceptor in the Out interceptor?

Thanks
Idob

UPDATE:

I tried to set the data as contextual parameter with

message.setContextualProperty(key,value);

but I am getteing NULL on

message.getContextualProperty(key);

I also tried the same but just with

message.put(key,value) and message.get(key)

didn’t work.

Idea’s anyone?

Thank you,
Idob

  • 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-12T08:06:43+00:00Added an answer on June 12, 2026 at 8:06 am

    You can store values on the Exchange. CXF creates an Exchange object for each request to act as a container for the in and out messages for the request/response pair and makes it accessible as message.getExchange() from both.

    In interceptor:

    public void handleMessage(Message inMessage) throws Fault {
      inMessage.getExchange().put("com.example.myKey", myCustomObject);
    }
    

    Out interceptor

    public void handleMessage(Message outMessage) throws Fault {
      MyCustomObject obj = (MyCustomObject)outMessage.getExchange().get("com.example.myKey");
    }
    

    (or vice-versa for client-side interceptors, where the out would store values and the in would retrieve them). Choose a key that you know won’t be used by other interceptors – a package-qualified name is a good choice. Note that, like Message, Exchange is a StringMap and has generic put/get methods taking a Class as the key that give you compile-time type safety and save you having to cast:

    theExchange.put(MyCustomObject.class, new MyCustomObject());
    MyCustomObject myObj = theExchange.get(MyCustomObject.class);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have built some REST (jax-rs) web services using Apache CXF. They return a
I am in process of implementing a REST API server using Apache CXF JAX-RS
I'm using Apache Commons FTP to upload a file. Before uploading I want to
I am using Apache CXF for developing Web services . I have a Webservice
I'm using Apache CXF's wsdl2java utility to create some JAXB objects and some web
I would like to have a REST web service using Apache CXF and send
I have developed a webservice using Apache CXF ,which will be in production very
I am using latest Apache CXF to create a webservice. I have configured ws-security
I want to upload a file using multipart form data and have problems with
I'm using CXF for web services. Because of some client restrictions, I need all

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.