Skip to content

Commit e7c3243

Browse files
committed
Create 2024-03-15-java-https-check.md
1 parent 4012a26 commit e7c3243

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

_posts/2024-03-15-java-https-check.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
tags:
3+
- http
4+
- java
5+
- security
6+
- tls
7+
title: Check HTTP(S) Connectivity in Java
8+
---
9+
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.
10+
11+
### Java class
12+
13+
See [TestHttp](https://github.com/dougbreaux/Java-Web-Tools/blob/master/src/main/java/TestHttp.java).
14+
15+
Run it like:
16+
```console
17+
java -Djavax.net.ssl.trustStore=/config/trust.jks -Djavax.net.ssl.keyStorePassword=$TRUST_PASSWORD TestHttp https://example.com
18+
```
19+
20+
### JSP
21+
22+
JSP you can deploy or create in your Java server environment:
23+
24+
See [HttpTest.jsp](https://github.com/dougbreaux/Java-Web-Tools/blob/master/WebContent/HttpTest.jsp)

0 commit comments

Comments
 (0)