Keep Spaces Intact In Http Springboot URL - spring-boot

I am trying to fetch some string consisting spaces in it from Solr from Spring Boot but the spring boot is replacing space with + in the internal HTTP request as in the example below /Tag-+1/ instead of /Tag- 1/.
ex:
q=tags:/Tag-+1/
While if I execute same query q=tags:/Tag- 1/ in solr admin UI(Web Client) it is working. the datatype used is "string". I want to know if spaces can be kept intact in the Spring Boot HTTP request or is there any other solution.

Related

Allowing a Slash Character In Spring WebFlux Get Requests

I have a spring WebFlux project and it turns out that I need to allow for a Slash in query parameters for a couple API calls.
In Spring MVC you would use the HttpServletRequest to handle that use case like in this example:
#PathVariable in SpringBoot with slashes in URL
How would you do that with WebFlux? I can't find any good articles about that online.

Is it possible to create a proxy controller that ignores some part of the URI

I have a spring service with multiple controllers with following request mapping running on port 9000
/api/fruits
/api/vegetables
/api/plants
Given all these requests are being served at localhost:9000,is it possible via some Spring entity, that a request to localhost:9000/{Account_id}/api/fruits is routed to localhost:9000/api/fruits. I know the question is a little vague but I'm trying to see if I can add a proxy controller with mapping /{account_id}/ which ignores the rest of the uri and have some code there to forward it to the appropriate controller. Not sure if Spring interceptor or filter of some sort would be helpful here for me to modify the request and change the URI

CAMUNDA API REST Authentication

I am trying to connect from my javascript front to the REST API of my camunda orchestration which is deployed as part of a spring boot application.
the called url is :
GET http://localhost:8081/oms-orchestrator-ms/api/engine/engine/default/history/process-instance
i get an 401 error for non authenticated queries which is normal
First question : is it the right way to query the Engine Rest API for process definition/ instances and history?
In order to make it work , i add the JSESSIONID cookie as header to my requests,
how can i use the basic auth to query the orchestrator api instead of using the cookie?
Thanks for your Help
the /api path is part of the cockpits REST backend which is secured by the same rules as the cockpit webapp.
You can additionally deploy the rest api (camunda-bpm-spring-boot-starter-rest if you are using spring boot). This will add an almost identical REST api for the engine under the path /rest. This one is open by default and can be secured manually if required (and advised for prod environments).

How to drop HTTP request on non-existing URL with Spring Boot?

I deployed a webserver on AWS Beanstalk. The log file shows there are quite some HTTP requests to URLs that do not exist on my webserver. Those requests cause Spring Boot to forward the requests to /error, for which I have a controller to process.
Those URLs are
/hedwig.cgi
/system.ini
/upgrade_handle.php
/board.cgi
/shell
/azenv.php
Does it mean someone is trying to attack my website? How can I configure Spring Boot or Beanstalk to match those URLs and drop the request so that they do not reach to my controller handling /error?

Emails in restful spring Get request url

I am having a problem with passing emails in http url using spring. My url looks as follows
http://localhost:8080/users/{email}
I am using spring mvc to handle this GET request.
Using my browser url bar or using Postman when I do the following
http://localhost:8080/users/sampleEmail#gmail.com
I only see sampleEmail#gmail in the spring controller code. For some reason the ".com" part is stripped out. Would anyone know if I am doing something wrong? Thanks
It is because Spring truncates whatever is coming after DOT(.) assuming it to be an extension.
Refer this:
Spring MVC #PathVariable with dot (.) is getting truncated
Is there a requirement that you need to use only GET? If not then switch to POST and send JSON Object with required parameters such as {email: "abc#xyz.com"}

Resources