-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create 2024-03-15-java-https-check.md
- Loading branch information
1 parent
4012a26
commit e7c3243
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
tags: | ||
- http | ||
- java | ||
- security | ||
- tls | ||
title: Check HTTP(S) Connectivity in Java | ||
--- | ||
Trivial Java code to try an HTTP connection to a URL. In particular, this can be useful to see whether your Java environment and its SSL/TLS configuration will successfully connect to an https URL. | ||
|
||
### Java class | ||
|
||
See [TestHttp](https://github.com/dougbreaux/Java-Web-Tools/blob/master/src/main/java/TestHttp.java). | ||
|
||
Run it like: | ||
```console | ||
java -Djavax.net.ssl.trustStore=/config/trust.jks -Djavax.net.ssl.keyStorePassword=$TRUST_PASSWORD TestHttp https://example.com | ||
``` | ||
|
||
### JSP | ||
|
||
JSP you can deploy or create in your Java server environment: | ||
|
||
See [HttpTest.jsp](https://github.com/dougbreaux/Java-Web-Tools/blob/master/WebContent/HttpTest.jsp) |