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%

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: 70%

edited 11.09.2018 at 03:38

Hi @reguel wermelinger, the patch no longer works on 7.0.12 LTS because of changes toWebApplicationConfigurator#addSerlvet(Class, String, Map). Once the patch is applied, the Axon ivy Engine fail to start. Could you provide a new patch for 7.0.12? Or better, to port back the XIVY-2633 to 7.0 LTS.

(07.06.2019 at 23:28) vagabond vagabond's gravatar image

Hi @reguel wermelinger, our project makes heavily use of JAX-RS Feature to implement token authentication and authorization (and other thing). Not being able to use them is one of the issue we cannot upgrade to 7.0.12 LTS.

(11.06.2019 at 05:01) vagabond vagabond's gravatar image

We could verify that the extensions patch stopped working after version 7.0.9. We created issue XIVY-3238 where we will address this.

(17.06.2019 at 02:37) SupportIvyTeam ♦♦ SupportIvyTeam's gravatar image

7.0.13 is released and REST extensions now are officially supported as in the Leading Edge versions.

(13.08.2019 at 02:45) Reguel Werme... ♦♦ Reguel%20Wermelinger's gravatar image
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: 1,291 times

Last updated: 13.08.2019 at 02:45