Is package com.sun.net.httpserver standard?

This is now clearly a public API1. As of Java 11, there is a module (jdk.httpserver) that exports the com.sun.net.httpserver and com.sun.net.httpserver.spi packages and 17 public classes.

The javadocs are published (https://docs.oracle.com/en/java/javase/11/docs/api/jdk.httpserver/com/sun/net/httpserver/package-summary.html) and there are no visible caveats in the package summary to say that these APIs are intended for internal use only.

While the jdk.httpserver is standardized, it is not guaranteed2 to be present in all (Java 11+) Java SE implementations. As the Overview page says:

This document is divided into two sections:

Java SE: The Java Platform, Standard Edition (Java SE) APIs define the core Java platform for general-purpose computing. These APIs are in modules whose names start with java.

JDK: The Java Development Kit (JDK) APIs are specific to the JDK and will not necessarily be available in all implementations of the Java SE Platform. These APIs are in modules whose names start with jdk.

The module we are are talking about falls into the second category.


1 - The old (inconsistent) package name conventions about com.sun.* and so on are mooted by Java 9+ modules and their associated explicit visibility control mechanisms.
2 - Oracle and most other publishers of Java 11+ only provide JDK distributions, so this caveat is largely moot.

Tags:

Java