Open Liberty 是否支持 HTTP/2,还是需要在 server.xml 上进行设置?我环顾四周,但找不到与此相关的任何内容
我现在有一个推送 servlet -
public class PushServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
PushBuilder pushBuilder = req.newPushBuilder();
pushBuilder.path("push.css").push();
try (PrintWriter respWriter = resp.getWriter();) {
respWriter.write("<html>" +
"<img src='images/kodedu-logo.png'>" +
"</html>");
}
}
}
并且在 newPushBuilder 上收到 NullPointerException
我运行了主要/次要版本,它确认我正在运行符合我的 pom 的 Servlet 4.0 -
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
我的 server.xml 配置为 -
<!-- To access this server from a remote client add a host attribute to
the following element, e.g. host="*" -->
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint" >
<httpOptions http2="enabled" />
</httpEndpoint>
我也在运行Java9