Skip to main content

Posts

Showing posts from May, 2020

Adding/ Editing Health checks to deployments in OpenShift

What are health checks in OpenShift Health checks are required to ensure that application is resilient so application can be restarted without manual action. Such health checks can be configured using probes in openshift. Kubernetes provides two type of probes, readiness probe and liveness probe. Liveness probe Liveness probe checks that application is running and handles those situations when there is any issue with application. Readiness probe Readiness probe check whether application is ready to handle the traffic. Another benefit of having these health checks is that you can restart or deploy application with zero downtime when you are having minimum 2 pods running for your application. In this case it will not bring all the pods down. Supported health check types You can configure the health check of below type for both of the above probes. HTTP Health Check It will call a web URL and if it returns the HTTP status code between 200 and 399 then it will consider as

Allowing Cross domain POST request with JSON or XML content type in Java

Cross domain POST Request Cross domain POST requests supports only below content types and other content type are not allowed by default. application/x-www-form-urlencoded multipart/form-data text/plain So, if we try to make an ajax request to such POST URLs with XML or JSON content type, it will not be able to make request and give CORS error. Allowing Cross domain POST request with JSON or XML Content-Type We have our service implemented in Java and we will use Servlet Filter & request wrapper to build our solution. Please see my below POST to see how to implement CORS using java servlets which works well with GET methods or allowed content types with POST method. https://www.thetechnojournals.com/2020/03/cors-implementation-using-java-filter.html In this POST I will explain only additional things required for our problem with POST request, so I request you to go through the above link first. Request wrapper to change/ override the content-type to JSON or XML