Send HTTP response to client without having request always - java

My Javaserver application(Servlet) receive a service request (HTTP) from client and then it should respond to the client in fixed interval time.
How can I send HTTP response every minute to client without having a HTTP request?

have a look at https://github.com/Atmosphere/atmosphere
or Comet/WebSockets

Related

I want spring boot application which accepts https request and send this request to other app on http and send this http response back to https req

I tried and able to read the CA certificates succsssfully send in request. But when sending request to other app over http getting error as " This combination of host and port required TLS" . Is there any way I can send the request to http and on receiving response, send this response back to https request.
you need to enable http on the server you are sending request to.

Apache Camel received Status 400 Bad Request from AWS VPC Endpont

I have a Java application which was built with Apache Camel. The application uses Apache Camel to construct an HTTP request to AWS VPC Endpoint.
When the Java application sends out an HTTP request, it receives HTTP Status Code 400 (Bad Request). The VPC Flow Log can be found with the traffic (correct source and destination IP addresses).
On the other hand, if we use curl command to send the same HTTP request, it turns back 200 OK.
What is a possible cause? Is there any configuration in Apache Camel to see what is the exact HTTP content or raw HTTP header/message sent out?
You could check if Content-Type and other mandatory request headers are available at Exchange.in.headers. Just log in.headers within camel-simple tag. I think 400 happening because improper content-type or bad payload.
It might be that you are sending headers that are not allowed by the API since Camel maps message headers automatically to HTTP headers.
Camel's camel-http4 component uses Apache HttpClient 4.x library and you can configure it to log raw http requests.
For instance with log4j you would add to properties:
log4j.logger.org.apache.http=DEBUG
Detailed logging options can be seen from here: https://hc.apache.org/httpcomponents-client-4.5.x/logging.html

Spring Integration Websocket and SSL

I'm writing a fairly simple Spring Integration flow that processes some data and subsequently sends a message to a websocket that exists in my SSL enabled web server to notify clients of new data.
The initial GET request to my websocket succeeds and the application cert is sent to the server correctly. However when the second request is sent to upgrade the connection to websocket, it no longer sends the application cert and I get a 403 Forbidden server response.
Is there any special configuration in the WebSocketContainer or WebSocketClient that I need to set up to make sure my certificate is always passed to the web server? I'm using STOMP over SockJS for the client.

java -http post request from port 80 is not working

I have deployed an paypal ipn service on my local machine on port 80.From this ipn service i am hitting another service which on asp.net(iis),but http post data is getting being truncated on reaching the iis server.And if i do the the same from another port except 80,it is working without any issue.I am not getting ,why my http post request data is not reaching there just because of using port 80.

Processing SOAP request with Content-Type = "application/x-www-form-urlencoded" in Java

I have a SOAP client sending through a request with it's Content-Type defined as application/x-www-form-urlencoded. My jax-ws server responds with a HTTP 415 error complaining that it expects a content-type of text/xml.
Evidently this client cannot be changed so am trying to find out if there is anyway to force my server to accept this content-type?
Tichodrama was right. The client was not a soap client. It was instead sending xml over HTTP POST.
I was dealing with the same issue and finally i had to add a servlet that accepts Content-Type defined as application/x-www-form-urlencoded and internally this servlet invokes all the SOAP logic behind.

Categories