Bind a resource programatically
See original GitHub issueTrying to bind a programatically created resource results in this error
WARN [2021-01-13 03:13:22,564] org.glassfish.jersey.internal.inject.Providers: A provider org.glassfish.jersey.server.model.Resource registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime. Due to constraint configuration problems the provider org.glassfish.jersey.server.model.Resource will be ignored.
val resource = Resource.builder(uriPath.removeSuffix("/")).apply {
addMethod(HttpMethod.GET)
.consumes(MediaType.WILDCARD)
.produces(MediaType.TEXT_HTML)
.handledBy { return@handledBy configuredIndex }
}
.build()
environment.jersey().register(resource)
Is it possible to register a resource programatically?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to bind button Content to Dynamic Resource ...
I am trying to bind programmatically the Content property of my WPF Button to a Dynamic Resource (Business Object) I have previously defined ......
Read more >Programmatically bind to a StaticResource - MSDN - Microsoft
ColorPreview is a rectangle BrushName is a string that is the key to a StaticResource. Valid Approach but not Programmatic
Read more >Resource Binding | DotVVM Documentation
The resource binding is used to access resources and constants, or to evaluate any expression on the server. Consider the following markup:
Read more >Invisible reCAPTCHA - Google Developers
Programmatically bind the challenge to a button or invoke the challenge. Programmatically invoke the challenge. Configuration. JavaScript resource (api.js) ...
Read more >Resources - The complete WPF tutorial
A DynamicResource on the other hand, is resolved once it's actually needed, and then again if the resource changes. Think of it as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I should have stated this more clearly. Dropwizard provides access to the underlying Jersey container and my provided code snippet registeres a programmatically created resource. I just meant, that we wouldn’t use this issue as a placeholder for an outstanding doc update.
So if your question is answered, please feel free to close this.
According to the Jersey documentation, this can be done with the
registerResources(...)
method.A minimal example in Dropwizard would then look like this: