Posts

Showing posts from May, 2023

Docker push denied requested access to the resource is denied unauthorized authentication required

Image
Open command prompt and execute below command docker login If you have Docker Desktop installed then it will automatically get credentials otherwise you can follow steps:  click here   Ensure you have tagged the local images with the Docker account namespace - To get Docker account namespace:  click here You can change the tag using below command docker tag name-of-image docker_a/c_namespace/name-of-image Example- C:\Windows\System32>docker tag eazybytes/loans ctcsinformation/loans Finally you can push the docker images to docker hub

Right way to close HttpsURLConnetion using try with resources in java 8

HttpsURLConnection does not implement the AutoCloseable interface in Java 8 or later versions. Since HttpsURLConnection does not implement AutoCloseable, you cannot use it directly in a try-with-resources block. However, you can create a wrapper class that implements AutoCloseable and encapsulates the HttpsURLConnection object, and then use the wrapper class in a try-with-resources block. Here's an example of how to create a wrapper class for HttpsURLConnection that implements AutoCloseable: public class HttpsURLConnectionWrapper implements AutoCloseable { private final HttpsURLConnection connection; public HttpsURLConnectionWrapper(URL url) throws IOException { connection = (HttpsURLConnection) url.openConnection(); } public HttpsURLConnection getConnection() { return connection; } @Override public void close() throws IOException { connection.disconnect(); } } In this example, the HttpsURLConnectionWrapper c...