I am using a 3rd party grid, which generates the following GET API when a character is input :
http://localhost:4200/api/v1/driver/getDriverListForDropDown?firstName=[{%22field%22:%22DriverCode%22,%22operator%22:%22startsWith%22,%22value%22:%2212345%22,%22caseSensitive%22:false}]
Request param generated :
firstName:[{"field":"DriverCode","operator":"startsWith","value":"*","caseSensitive":false}]
I am trying to create a rest API on spring boot, but not able to hit the API.
I tried the following :
@GetMapping(path = "/getDriverListForDropDown")
public ResponseEntity<RestApiResponse<List<DriverDataForDropDown>>> getDriverListForDropDown(
@ApiIgnore Context context, @RequestParam(value="firstName") List<DriverDropdownFilterRequest> firstName)
DriverDropdownFilterRequest :
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class)
@JsonIgnoreProperties(ignoreUnknown = true)
@Builder(toBuilder = true)
public class DriverDropdownFilterRequest
{
String field;
String operator;
String value;
}
but I always get 400 error and on backend the following error :
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:468) ~[tomcat-embed-core-9.0.29.jar:9.0.29] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260) ~[tomcat-embed-core-9.0.29.jar:9.0.29] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.29.jar:9.0.29] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) [tomcat-embed-core-9.0.29.jar:9.0.29] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1591) [tomcat-embed-core-9.0.29.jar:9.0.29] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.29.jar:9.0.29] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.29.jar:9.0.29]
I tried several options, but nothing is working. Please help.