Java 8 LocalDate QueryParam
See original GitHub issueIt seems that parsing of Java 8 LocalDate
as QueryParam is not liked. I get the following error on startup when trying with a simple controller.
@GET
public Integer testRatas(@QueryParam("foo") final LocalDate foo) {
return 1;
}
Caused by: org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialisation.
[[FATAL] No injection source found for a parameter of type public java.lang.Integer resources.ForexRatesResource.testRatas(java.time.LocalDate) at index 0.; source='ResourceMethod{httpMethod=GET, consumedTypes=[], producedTypes=
[application/json], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=class
resources.ForexRatesResource, handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@517a2b0]}, definitionMethod=public
java.lang.Integer resources.ForexRatesResource.testRatas(java.time.LocalDate), parameters=
[Parameter [type=class java.time.LocalDate, source=foo, defaultValue=null]], responseType=cla
ss java.lang.Integer}, nameBindings=[]}']
at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:555)
at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:347)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:640)
... 46 more
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Working with Date Parameters in Spring - Baeldung
In this short tutorial, we'll learn how to accept Date, LocalDate, and LocalDateTime parameters in Spring REST requests, both at the request and ......
Read more >JAX-RS and java.time.LocalDate as input parameter
Problem using JAX-RS and java. time. LocalDate (java8). How can I create some kind of an interceptor that maps json-dates to java.
Read more >Converting JAX-RS parameters with ParamConverters
If you want JAX-RS to automatically convert parameters such as query params, path params, or others, you need to create a ParamConverter ....
Read more >Spring Boot and the LocalDate request parameter - Medium
In my case that something is — a REST API with a LocalDate Request Parameter. ... Failed to convert value of type 'java.lang....
Read more >Parsing of LocalDate query parameters in Spring Boot
RequestParam java.time.LocalDate] for value '2017-07-12'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value ...
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
@OverlyExcessive Try using
LocalDateParam
:It seems like you can provide a Parameter Converter implementation to allow direct support of LocalDate as described here:
Converting JAX-RS parameters