将 glassfish + JAX-RS 上的 REST 服务请求重定向到 https URL 的最佳方式?

Best way redirect REST service request on glassfish + JAX-RS to https URL?

我已经在 glassfish4 + JAX-RS 上实现了 REST 服务。现在我想使用 https 连接进行身份验证。

http 的 URI 是 http://myhost/myapp/services/rest/myservice and for https is https://myhost_2/myapp/services/rest/myservice. I want prevent the usage of http://myhost/myapp/services/rest/myservice

我认为一种方法是通过 http://myhost in the REST JAX-RS class to https://myhost_2 重定向请求。这是一个好方法吗?我该如何实施?

您可以使用指向 https 相当于响应的位置 header。