How to write a UTF-8 file in Java
In Java, the OutputStreamWriter accepts a charset to encode the character streams into byte streams. We can pass a StandardCharsets.UTF_8 into the OutputStreamWriter constructor to write data to a UTF-8…
Favourite tutorials for developers
In Java, the OutputStreamWriter accepts a charset to encode the character streams into byte streams. We can pass a StandardCharsets.UTF_8 into the OutputStreamWriter constructor to write data to a UTF-8…
In Java, you can use InetAddress.getLocalHost() to get the Ip Address of the current Server running the Java app.
In Java, you can use HttpServletRequest.getRemoteAddr() to get the client’s IP address that’s accessing your Java web application. For web application which is behind a proxy server, load balancer or…
This example shows you how to get the HTTP request headers in Java. To get the HTTP request headers, you need this class HttpServletRequest : 1. HttpServletRequest Examples 1.1 Loop…
This example shows you how to get the Http response header values in Java. 1. 1. URLConnection - Standard JDK example. 2. Apache HttpClient example.
This Java 11 JEP 332 adds support for TLS 1.3 protocol. This article will demo for An SSLSocket client with TLS1.3 protocol and TLS_AES_128_GCM_SHA256 stream cipher, to send a request…
In this tutorial, we will show you how to use Java library – “Apache Commons Net” to get WHOIS data of a domain.
The HttpURLConnection‘s follow redirect is just an indicator, in fact it won’t help you to do the “real” http redirection, you still need to handle it manually.
In this example, we will show you how to login a website via standard Java HttpsURLConnection. This technique should be working in most of the login form. Tools & Java…
Here’s a simple Java HTTPS client to demonstrate the use of HttpsURLConnection class to send a HTTP GET request yo get the https URL content and certificate detail.