Hi,

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.*;

@Provider
 public class MyRequestFilter implements ContainerRequestFilter {
    @Override
    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/?

Thanks

asked 10.09.2018 at 02:24

Genzer%20Hawker's gravatar image

Genzer Hawker
481212535
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

link

answered 10.09.2018 at 02:52

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
7.9k11549
accept rate: 68%

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 at 23:28) vagabond vagabond's gravatar image

I second this issue.

(07.06 at 23:30) Genzer Hawker Genzer%20Hawker's gravatar image

I assume that it would work up till 7.0.11 where an older tomcat version was in charge... May I ask for which project you guys as working currently? It may helps to raise the priority on this issue.

(11.06 at 04:58) Reguel Werme... ♦♦ Reguel%20Wermelinger'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 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.

(14 hours ago) SupportIvyTeam ♦♦ SupportIvyTeam'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

By RSS:

Answers

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

Tags:

×25
×1
×1

Asked: 10.09.2018 at 02:24

Seen: 523 times

Last updated: 14 hours ago