News for hackers. Stuff that matters.
Re:Major standard library changes in Go 1.20 by derkades on Tuesday January 17, 2023 @04:08AM (#34410538)
Though some modern features are lacking, like a JSON parser or web server.
Re:Major standard library changes in Go 1.20 by kaba0 on Tuesday January 17, 2023 @04:31AM (#34410653)
It does have a web server: https://openjdk.org/jeps/408
Re:Major standard library changes in Go 1.20 by philosopher1234 on Tuesday January 17, 2023 @05:32AM (#34410978)
Does anyone actually use it? I’ve never even heard of this thing and I’m a professional Java dev
Re:Major standard library changes in Go 1.20 by simiones on Tuesday January 17, 2023 @05:48AM (#34411073)
Given that it was only added in Java 18 and it is a simple static file server (no way to run custom code when serving a URL), I don't think it's in any way widely used at the moment.
Re:Major standard library changes in Go 1.20 by philosopher1234 on Tuesday January 17, 2023 @06:00AM (#34411140)
From your description it sounds like it is a completely different beast from net/http
Re:Major standard library changes in Go 1.20 by simiones on Tuesday January 17, 2023 @07:35AM (#34411718)
Yes, per the JEP that was linked, it is only intended as a toy server for quick example code, essentially:

> Provide a command-line tool to start a minimal web server that serves static files only. No CGI or servlet-like functionality is available. This tool will be useful for prototyping, ad-hoc coding, and testing purposes, particularly in educational contexts.

> It is not a goal to provide a feature-rich or commercial-grade server. Far better alternatives exist in the form of server frameworks (e.g., Jetty, Netty, and Grizzly) and production servers (e.g., Apache Tomcat, Apache httpd, and NGINX).

Re:Major standard library changes in Go 1.20 by dmux on Tuesday January 17, 2023 @11:22PM (#34423406)
The specific web server in the JEP is relatively new, but there has been an http server implementaion since 1.6:

https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver...

Re:Major standard library changes in Go 1.20 by simiones on Wednesday January 18, 2023 @10:39AM (#34427998)
Cool, I had no idea about this.

I see it's still available after the modularization effort, and it is:

https://docs.oracle.com/en/java/javase/18/docs/api/jdk.https...

Re:Major standard library changes in Go 1.20 by doctor_eval on Tuesday January 17, 2023 @06:03AM (#34411165)
> It is not a goal to provide a feature-rich or commercial-grade server.

That server is not remotely comparable to the one in Go.

Re:Major standard library changes in Go 1.20 by pjmlp on Tuesday January 17, 2023 @07:41AM (#34411757)
It is tailored for the same purpose as Go's one, hello world.
Re:Major standard library changes in Go 1.20 by simiones on Tuesday January 17, 2023 @07:48AM (#34411807)
Go's net/http is essentially the only used Go HTTP(S) server. It is often wrapped with other libs to add things like request routing, but it is always used as the actual HTTP implementation. Not sure why you're saying its purpose is "hello world".

The Java one is not usable in anything beyond hello world, and is explicitly not intended to be.

Re:Major standard library changes in Go 1.20 by pjmlp on Tuesday January 17, 2023 @08:22AM (#34412056)
The fact that is lacks any kind of administration console, and security integration with enterprise connectors shows it is at hello world level.
Re:Major standard library changes in Go 1.20 by simiones on Tuesday January 17, 2023 @11:37AM (#34414669)
As someone maintaining a pretty large networking industry proprietary app based entirely on net/http in terms of any kind of HTTP communication, I feel like I can easily tell you are wildly exaggerating. Admin consoles and enterprise connectors are entirely irrelevant to many uses of an HTTP server. Hell, even Kubernetes' API server is built using net/http.
Re:Major standard library changes in Go 1.20 by pjmlp on Tuesday January 17, 2023 @04:16PM (#34419294)
Yet many of those depend on having something like Apache, NGIX, HA Proxy, IIS,... taking care of the actual load.
Re:Major standard library changes in Go 1.20 by doctor_eval on Tuesday January 17, 2023 @04:59PM (#34419973)
There is frequently a reverse proxy in front of all web services. It’s got nothing to do with the quality of the implementation behind the curtains. And “the actual load” is by definition managed by the endpoint not the router.

I mean it would be trivial to implement that reverse proxy in Go. And I do mean trivial; Go also includes a reverse proxy utility, so you can implement something basic in about 5 LOC.

At this point it’s hard to believe you’re being genuine.

Re:Major standard library changes in Go 1.20 by pjmlp on Wednesday January 18, 2023 @02:40AM (#34424340)
So trivial that it isn't usually the case.

A weekend project and going at scale isn't the same thing.

Re:Major standard library changes in Go 1.20 by doctor_eval on Wednesday January 18, 2023 @05:25AM (#34425193)
sigh
Re:Major standard library changes in Go 1.20 by simiones on Wednesday January 18, 2023 @10:31AM (#34427871)
Kubernetes API server is not dependent on Apache, NGINX, HA Proxy, IIS, ... taking care of the actual load, since it's not getting any significant amount of traffic. In general API servers have much bigger scaling problems with actually executing the API calls rather than handling requests at scale. Having an NGINX or something similar to serve some static content and also reverse proxy to a Go server is sometimes nice if you're also serving a large UI app, but in that case NGINX is very much doing trivial work, and Go net/http is handling the real work.
Re:Major standard library changes in Go 1.20 by kaba0 on Tuesday January 17, 2023 @07:53AM (#34411847)
That’s indeed true, but it wasn’t a constraint so I thought it may be of interest to post it :D should have added a note regarding that though, but I can no longer edit.
Re:Major standard library changes in Go 1.20 by tazjin on Tuesday January 17, 2023 @04:21AM (#34410601)
It does contain several Javascript (!) interpreters, so you could probably glue those together as a JSON parser :)
Re:Major standard library changes in Go 1.20 by dmux on Tuesday January 17, 2023 @11:20PM (#34423392)
Java has had a basic http server built in since 1.6

https://docs.oracle.com/javase/8/docs/jre/api/net/httpserver...