Joe.wang
Joe.wang

Reputation: 11791

Stop one of Http method Online

I have a couple of http methods in my application which is hosted in JBoss. And Now I am trying to find some kind of hot-way to disable one of them,like click a button in a certain of page or calling a certain of http method. What i means of 'disable it' is making any web client which intends to send get/post request to it will go to failure . Maybe we can say the web client will got a http 404 response. Can anybody give me some solutions? Thanks.

Upvotes: 1

Views: 114

Answers (1)

nicholas.hauschild
nicholas.hauschild

Reputation: 42834

I think JMX would be appropriate for this situation.

You can pretty easily create an MBean (Managed Bean, a component of JMX) with Managed Attributes corresponding to boolean's for each of the endpoints you want to be disable-able. Registering it is the hard part, but there are libraries out there that make working with JMX easier. Spring has good support for setting up and working with MBeans.

As far as a JMX client goes, I usually use VisualVM, which ships with the JDK. From it, you can invoke methods on your MBeans at runtime, or even change their properties.

Upvotes: 1

Related Questions