Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure skipPattern in web.xml #96

Closed
wyfrel opened this issue Sep 7, 2018 · 14 comments
Closed

Configure skipPattern in web.xml #96

wyfrel opened this issue Sep 7, 2018 · 14 comments

Comments

@wyfrel
Copy link

wyfrel commented Sep 7, 2018

Hi,

I would like to configure skipPattern in web.xml. Is there a way to do this?

Thank you !

@pavolloffay
Copy link
Collaborator

@wyfrel hi, could you please describe your use case? Why do you need to define it in web.xml?

The fiter itself cannot be configured in web.xml as it requires multiple objects to be provided.

@wyfrel
Copy link
Author

wyfrel commented Sep 18, 2018

@pavolloffay : thx for your answer.

I fact the need is to be able to configure the skippattern when starting the ServerTracingDynamicFeature with the default constructor. The version of restEasy that i (must) use doesn't boostrap correctly ServerTracingDynamicFeature when it's defined via the getSingletons() method of javax.ws.rs.core.Application. In debbuging i can see that the configure method of ServerTracingDynamicFeature is never called.

@pavolloffay
Copy link
Collaborator

I fact the need is to be able to configure the skippattern when starting the ServerTracingDynamicFeature with the default constructor.

Do you mean when the feature is auto-discovered by runtime? I am planning to remove @Provider from the feature so users can provide a configured provider e.g. with skip pattern.

ServerTracingDynamicFeature when it's defined via the getSingletons() method of javax.ws.rs.core.Application

Maybe because the runtime auto discovered it and the provider added to singletons is skipped.
If the configure was never called you would not get any traces because it registers filters which create spans.

@wyfrel
Copy link
Author

wyfrel commented Sep 18, 2018

Do you mean when the feature is auto-discovered by runtime?

I configure it via the getClasses() method of javax.ws.rs.core.Application

Maybe because the runtime auto discovered it and the provider added to singletons is skipped.

I've just try to removed the @provider from ServerTracingDynamicFeature and try to define ServerTracingDynamicFeature via getSingleton but configure(ResourceInfo resourceInfo, FeatureContext context) method is never called.

@pavolloffay
Copy link
Collaborator

And do you get any traces?

@wyfrel do you have a reproducer? It seems more like a configuration issue.

@wyfrel
Copy link
Author

wyfrel commented Sep 18, 2018

@pavolloffay : How can i give a reproducer ? What do you want to see ?

@pavolloffay
Copy link
Collaborator

The project you are using. Publish it on github or as an archive here so I can try it locally.

@wyfrel
Copy link
Author

wyfrel commented Sep 22, 2018

@pavolloffay : Sorry for the delay. I add no time to produce a working example (without company code ;-)) before today.

I publish it here : https://github.com/wyfrel/helloworld-opencontrib-jaxrs

In 'be.wyfrel.helloworld.application.HelloWorldApplication' i add in comment the configurations that aren't working

@wyfrel
Copy link
Author

wyfrel commented Sep 28, 2018

@pavolloffay : did you had Time to check my reproducer ?

@pavolloffay
Copy link
Collaborator

@wyfrel thanks for the reproducer I will have a look soon.

@pavolloffay
Copy link
Collaborator

I had a look at the reproducer. I have a couple of comments:

  • you forgot to register SpanFinishingFilter
  • The custom tracing feature can be configured by creating dynamic feature which wrap the one in this repository. Then the feature has to be added to resteasy.providers. Not sure why automatic discovery does not work maybe because how the whole deployment is configured. In standard WF deployment it works well.

The working example is here https://github.com/wyfrel/helloworld-opencontrib-jaxrs/pull/1/files

Interesting is that adding a dynamicfeature to singleton map does not work (in WF). Therefore I think the way to go is to create a wrapper for ServerTracingDynamicFeature like in the linked PR.

@pavolloffay
Copy link
Collaborator

@wyfrel I got working configuration via getSingletos. There is probably something wrong with the configuration. If you comment

  <!--<listener>-->
    <!--<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>-->
  <!--</listener>-->
  <!--<listener>-->
    <!--<listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class>-->
  <!--</listener>--> 

Then all resources specified in singletons are loaded.

@wyfrel
Copy link
Author

wyfrel commented Oct 8, 2018

@pavolloffay : Thx for all these information!! I'll take a look at them !!

@pavolloffay
Copy link
Collaborator

@wyfrel I will close this one in favor of #102.

Let us know if you solved the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants