过滤器在 Glassfish 3.1.1 中不起作用

发布于 2024-12-20 08:22:40 字数 796 浏览 2 评论 0原文

我有一个 Filter 实现,以前在单个实例 Glassfish 3.1.1 中工作过。

它已使用 @WebFilter 进行注释,如下所示:

@WebFilter(urlPatterns = { "/*" })
public class SomeFilter implements Filter {

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
        ServletException {
HttpServletRequest req = (HttpServletRequest) request;
...
}

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    // do nothing
}

@Override
public void destroy() {
    // do nothing
}

应在每个请求中调用它。

现在我有一个 Glassfish 设置,它有两个单独的 FRONT 和 SERVICE 实例。我将包含过滤器的 WAR 部署到 FRONT,但过滤器似乎不起作用。我尝试了日志记录和调试,但似乎过滤器或至少 doFilter 方法从未被调用。我还尝试将一些日志记录放入 init 方法中,但它也根本没有显示在日志中。

任何人都知道什么可能会导致这种行为。有没有办法以某种方式记录 Glassfish 过滤链?

I have a Filter implementation that has worked previously in a single instance Glassfish 3.1.1.

It has been annotated with @WebFilter and is as follows:

@WebFilter(urlPatterns = { "/*" })
public class SomeFilter implements Filter {

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
        ServletException {
HttpServletRequest req = (HttpServletRequest) request;
...
}

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    // do nothing
}

@Override
public void destroy() {
    // do nothing
}

It should be invoked with every request.

Now I have a Glassfish setup that has two separate instances for FRONT and SERVICE. I deploy the WAR containing the filter to FRONT and the Filter does not seem to work. I tried logging and debugging, but it seems the filter, or at least the doFilter-method is never invoked. I also tried to put some logging to init method but it also isn't showing up on the logs at all.

Anyone know what might cause such behaviour. Is there a way to log the Glassfish filterchain somehow?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雾里花 2024-12-27 08:22:40

您是否检查 Glassfish server.log 中是否存在有关过滤器初始化的错误?我遇到过类似的问题,并预感到过滤器初始化是导致问题的原因。

Did you check the Glassfish server.log for errors regarding initialization of the filter? I've encountered similar problems and got a hunch that filter initialization is the cause of your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文