A
A
Alecxandrys2017-12-11 13:11:23
Spring
Alecxandrys, 2017-12-11 13:11:23

How to set tomcat settings in java config?

Good afternoon, It is
necessary to organize the correct acceptance of GET request parameters, where Cyrillic can be.
A Spring service that implements RestController.
Method with given signature

@GetMapping(value = "/getDivisionByUniversity",consumes = "application/json;charset=UTF-8")
  public String getDivisionByUniversity(@RequestParam(defaultValue = "%") String university)

application.properties contains the following lines
#Charset of HTTP requests and responses. Added to the "Content-Type" header if not set explicitly.
spring.http.encoding.charset=UTF-8
# Enable http encoding support.
spring.http.encoding.enabled=true
# Force the encoding to the configured charset on HTTP requests and responses.
spring.http.encoding.force=true
server.tomcat.uri-encoding=UTF-8

Google indicates, for example, the following:
Points 1 and 2
Through which you get to the following:
Instruction
Question:
1) Did I correctly set the settings of tomcat itself in application.properties or did I miss something when transferring the configuration?
2) How to pick up the encoding filter if the entire configuration is in java style? There is a filter class, but where to hook it?
3) What else is possibly missed by me when setting up Cyrillic support on tomcat?
Cause of everything
spoiler
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.20.jar:8.5.20] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [ na:1.8.0_102] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.20.jar:8.5.20] at java.lang.Thread.run(Thread. java:745) [na:1.8.0_102]
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:472) ~[tomcat-embed-core-8.5.20.jar:8.5.20]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:683) ~[tomcat-embed-core-8.5.20.jar:8.5.20]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.20.jar:8.5.20]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.20.jar:8.5.20]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457) [tomcat-embed-core-8.5.20.jar:8.5.20]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question