Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jolokia-client-java :: add headers on request or on client #478

Closed
nasainca opened this issue Sep 7, 2021 · 2 comments
Closed

jolokia-client-java :: add headers on request or on client #478

nasainca opened this issue Sep 7, 2021 · 2 comments
Milestone

Comments

@nasainca
Copy link

nasainca commented Sep 7, 2021

I use the jolokia java client (1.7.0) to access the attributes and functions of the MBean routes from the web server. I'm getting the error "Origin null is not allowed to call this agent'' in server when trying to access the routes MBean properties.

When I add the Origin header to the request from postman I can read the properties of the routes without problem, but I don't know how to do the same with the jolokia java client.

Is there a way to set the origin header using the java jolokia client? If doing this is possible, would you mind explaining to me how I can add origin header to client or to request? Or could you tell me some documentation about this?

Regards,

@rhuss
Copy link
Member

rhuss commented Sep 7, 2021

There is currently no way to set up a header that is send along with every Jolokia request by default. However you can leverage https://github.com/rhuss/jolokia/blob/cc8104062231e246254ad8063217c06cfc28641a/client/java/src/main/java/org/jolokia/client/J4pClient.java#L76 to provide your instance of HttpClient that can do this. It's a bit more work, but should be feasible (haven't tested it).

If you are fancy to work on a pull request, I'm happy to help integrate such a defaultHttpHeaders method to the J4ClientBuilder.

@grgrzybek
Copy link
Contributor

Fixed in 18a8e84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants