I have a Jetty server and I have disabled HTTP connections through rest services , so client connections must only come through https, but when a client tries to connect through http it throws a SocketException and treats that as the rest response. What I want to do is give a response when this happens and actually throw a custom descriptive error
Share
You may want to use a
Filterlike thisOr a custom error page (less preferred)
in your deployment descriptor.
But I suggest to issue HTTP redirects when the client tries to connect without SSL. There are two easy ways to issue HTTP redirects: the
RewriteHandlermodule and aFilter.This is how one configures the module with a
RedirectRegexRuleAlternatively, you can do it with a
Filter