no mapping found for /info Spring 4 websockets - spring

In spring controllers if I use #MessageMapping it is working, but if I changed to #Requestmapping(value=="",method=RequestMethod.POST) and try to use SimpMessagingTemplate to send the messages to client then it is unable to connect, it is showing error in
connecting to websockets /info request mapping not found

I recognize /info from SockJS. Are you using it on the backend?
In my configuration, I have a STOMP endpoint at /stomp and use SockJS on the client side to do the WebSocket connection. SockJS makes a request to /stomp/info first to figure out what kind of connection to make.

Related

Spring boot websocket with stomp connectivity using postman- How to consume springboot websocket stomp api endpoint in postman

I am using SpringBoot-websocket with stomp protocol. I am able to send and receive response through javascript where i establish stompclient connection and see the streaming in browser. could any body tell how the same i can do in postman. the websocket url is getting connected. but the stomp url (app/test) is not connecting in postman.
I tried added Sec-WebSocket-Protocol as v10.stomp in postman header. but still not working. I want to connect stomp endpoints via postman. if anybody know the steps please comment.

How to create a websocket server using spring boot?

I am trying to create a websocket server using spring boot and I find it very tricky. I have followed multiple tutorials but I keep failing.
For instance, I followed this tutorial https://spring.io/guides/gs/messaging-stomp-websocket/
I did everything exactly like it was described there. However, when I start the server and access the generated UI and try to connect to the server, I get
WebSocket connection to 'ws://localhost:8080/user' failed: Error during WebSocket handshake: Unexpected response code: 404
It's very unclear to me why it would try to connect to /user if I haven't even defined such endpoint.
When I try connecting through Postman to the address "ws://localhost:8080/gs-guide-websocket", I get the 400 code. No logs in the spring console.
Any hints/advices on how to make a simple websocket server using spring boot? Literally, every tutorial that I follow on the internet, doesn't work.

Not able to Intercept websocket client request using #Webfilter in quarkus

I am migrating an application from thorntail to Quarkus , so I faced an issue of intercepting the websocket client request but same works fine in thorntail.
I am trying to intercept the websocket client request with #WebFilter but seems like it is not picking up the websocket client request , but it works fine with rest client .
Any Suggestion around this would be helpful.

How to configure netty http client connection idle timeout for Spring WebFlux

We uses Spring Cloud Gateway for Authentication/Authorization and it's OAuth2 Authentication filter uses Netty http client to post request to Identify Provider. It appears that the load balancer often disconnects the connections (Channels) in the Netty connection pool. We are seeking the ways either disable that connection pool or set idle timeout to a limit time so that connection in the pool get disposed instead of load balancer to disconnect it.
What is the way in Spring Cloud Gateway or Spring WebFlux to do that since we are not create HTTP client in our application and it is Spring OAuth2 Authentication filter doing so?
We tried configure Spring Cloud Gateway HTTP Client parameters but it does not affect Netty HTTP Client which is used by Spring OAuth2 Authentication filter.

custom HTTP status code with spring and restful webservice

I am new to the spring and restful framework. My server hosts 3 restful web services. I have used spring support for the restful web services to implement the server. The client sends JSON request to the server and gets JSON response. Client is based on spring support for the restful. The server returns 200/OK for successful processing, which is default.
What I want is the server to send custom HTTP status code 550 to the client in case there is an issue while processing the request. It should not throw any exception to the client. It should only send 550/an_error_object(as json) back to the client.
How is it possible with the spring support of restful ? I am doing the following on the server side.
HttpServletResponse.setStatus(550)
but, the client side is failing to recognize the status code 550; it throws an exception since org.springframework.http.HttpStatus doesn't have any enum constant '550' defined.
Any suggestions will be great!
Thanks in advance.
Rohit
1) Don't use unregistered status codes. See the registered status codes.
2) That being said, that's a bug in the Spring framework. It should deal properly with extension status codes.
It'll probably going to be fixed in version 4.3 of Spring.
https://jira.spring.io/browse/SPR-14205

Resources