Return all request to IS with a default response

We sometime need lock legacy system for upgrade so we need block all request go inside.
Is there anyway to config a default response for all request to IS when we need

Thank you

1 Like

“Quiesce Mode” was built for this purpose - see page 977 here (link).

KM

I don’t mean maintainace of IS, IS still work but it return a default response with custom message for caller with all request.

Alright, you can create an HTTP Interceptor with pre and post-processing actions; more here (link) and here (link).

KM

1 Like

Thank you, but it need restart server and config to work, Is there anyway to turn on intercepter quick and easy like depend on value of a Global variable?

We need in normal status, Interceptor do nothing, when maintainance Interceptor catch and process all request

thank you

I have not tested the Interceptor, but it appears that restart is a one-time setup activity, when you deploy the JAR the first time. You should be able to turn the Interceptor on and off, without a restart after the first time -

KM

1 Like

As I read, the inteceptor not prevent request go to other system, it catch the request and process before sent back to client , is there anyway catch request and return immediately response.

Second: I cannot see how to turn on/off interceptor without restart , can you share more info

thank you

You’re right, looks like it’s read-only with additional actions, but not a reroute.
I’ll check if there are other custom/external options, but I need more time.

@John_Carter4, any thoughts?

KM

Hi,

since you’re not going to handle the requests, do you really need to accept them? Maybe you just need to disable the http port (keep one active for admin).

Best
Bruno

1 Like

Yes, we not handle request but we want send back a message to caller to notify them my system is maintainance ,
and sometime we not disable all request , maybe filter by service name to return default response, other service still work as normal

The interceptor is allowed to throw an Exception to stop the request going further. Specifically it allows you to throw a HttpInterceptorException, which allows you to set both the http response code and message.
e.g.

throw new HttpInterceptorException(“Sorry, this server is temporarily unavailable”, 503);

I would recommend providing a public service to allow your interceptor to then decide to go into maintenance mode so that you don’t have to register/unregister it each time you want to use it, nor have to restart the server.

If you package your interceptor in a small package (recommended), you can place the jar in the packages code/jars/static folder. You could even develop a user friendly home page (dsp) to allow the administrator to activate/deactivate the interceptor and even customise the message.

John.

2 Likes

Can you explain more how to “activate/deactivate the interceptor” , is IS provide function to do that?
As I know , after we register interceptor then all request will catch by interceptor

Thank you

You would explicitly add it to you java code i.e. use a global parameter that the interceptor would check to see if it should intercept or not.
John.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.