I want to implement my own ContainerRequestFilter and ContainerResponseFilter for my JAX-RS resources in my Axon.ivy projects. Typically, I would create an implementation of the filter:

import java.util.logging.*;

 public class MyRequestFilter implements ContainerRequestFilter {
    public void filter(ContainerRequestContext requestContext)
            throws IOException {
        Logger.getLogger("Test").log(Level.WARNING, "LOOK MA! IT WORKS");

I assume that Jersey will register my filter and it will works. However, I got

javax.servlet.ServletException: java.lang.IllegalStateException: Request scope has been already shut down.
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
Caused by: java.lang.IllegalStateException: Request scope has been already shut down.
        at jersey.repackaged.com.google.common.base.Preconditions.checkState(Preconditions.java:173)
        at org.glassfish.jersey.process.internal.RequestScope.retrieveCurrent(RequestScope.java:239)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:314)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
        ... 46 more

..when I call my resources.

Is it possible (at all) to use ContainerRequestFilter/ResponseFilter (and Feature, DynamicFeature) in an Axon.ivy project? And without introducing JAR files into webapps/ivy/WEB-INF/lib/?


asked 10.09.2018 at 02:24

Genzer%20Hawker's gravatar image

Genzer Hawker
accept rate: 66%

Hi Reguel Wermelinger, is there any plan such that the XIVY-2633 can be ported into Axon.ivy 7.0.x?

(10.09.2018 at 02:57) Genzer Hawker Genzer%20Hawker's gravatar image

as patch it already available for 7.0.x. It is attached to the mentioned issue. yet there are no plans to merge it back as official feature. but if a popular solution asks for it, I think we could easily merge it to 7. The only reason that we did not do it yet was to get some feedback on it from real word projects.

(10.09.2018 at 03:04) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

by the way: welcome back @genzer hawker :-)

(10.09.2018 at 03:05) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image

Hi Reguel Wermelinger, thanks! :D By the way: is the patch available elsewhere? I cannot access to the official XIVY-2633.

(10.09.2018 at 03:56) Genzer Hawker Genzer%20Hawker's gravatar image
(11.09.2018 at 02:12) Genzer Hawker Genzer%20Hawker's gravatar image
showing 5 of 6 show 1 more comments

it should basically be possible to provide a request filter from a project. But it works only on one of the pre-liminary 7.2 releases or with a patch that ports it back to the 7.0 train: https://jira.axonivy.com/jira/browse/XIVY-2633

The pre-liminary patch for 7.0 is also accessible here: https://answers.axonivy.com/upfiles/webserver.rest.extension.patch_1.0.0.201805241153.jar


answered 10.09.2018 at 02:52

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
accept rate: 69%

edited 11.09.2018 at 03:38

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 10.09.2018 at 02:24

Seen: 393 times

Last updated: 11.09.2018 at 03:38