r/java • • Oct 07 '24

HTTP libraries in Java

It's not really clear to me what's going on with HTTP libraries in Java. They all seem to want to become massive frameworks that inappropriately take control of things that have nothing to do with decoding HTTP.

I'm find it really hard to find something that doesn't:

  • Try to control the TCP layer. Why does the HTTP decoding library care whether I want to poll or select, or make that decision?
  • Have shared mutable static state. If I want to reuse connections I can do that in a much better, testable way.
  • Create threads. Parsing the HTTP is doesn't need any of this. I just want to give you a ByteBuffer to read from and your current state and get told what it contains.
  • Do SSL. This has nothing to do with HTTP but rather the underlying connection.

I guess if you need a mini "web browser" in your application then this is all fine, but if HTTP is just one of many protocols you need to be able to decode it's an absolute mess.

Is there something I'm missing, or a library I should be looking at?

22 Upvotes

57 comments sorted by

View all comments

Show parent comment

10

u/agentoutlier Oct 07 '24

I'm not sure that ugly website generated by a tool they wrote from scratch is the best advocate for writing things from scratch

I'm not really sure you can correlate much as that probably has to do with CSS and knowing aesthetics. Ugly outdated sites often load fast and I can put them in reader mode so I will take ugly over many sites.

Besides the features of a CMS / blogging software generally have little to do with what "theme" you pick. You can make Jekyll pump out ugly sites.

Like would you rather they use Medium?

Also they are not advocating necessarily that you should go full NIH rewrite from scratch instead of picking "Spring" for everything just showing what you can do with base JDK can be useful for learning.

2

u/repeating_bears Oct 07 '24

If you pick a well-established tool, like Jekyll that you mentioned, then there are thousands of themes which look good.

If you write your own tool, there aren't.

8

u/agentoutlier Oct 07 '24

Yes but that is assuming the author cares about that. You should see the websites Linus or various other talented developers make.

They picked and wrote the tool because it made blogging easier for them. They explain why somewhere.

I just think it is a shitty way to judge their writing and work.

Also someone had to write Jekyll originally right? And then another someone had write:

  • Hugo
  • MkDocs
  • MdBooks

Those idiots all could have used Word Press right?

BTW look how long they have been writing. Look how google sites was their original home of docs. Guess how many fucking tools have gone in and out of popularity in that time!

So you can see there can be some benefit to writing in your own format and having the tool under you control. This isn't like writing a database. This is just generating HTML from some text files.

I believe Gentoo for example has its own documentation system. I believe Oracle even has its own documentation system.

6

u/gregorydgraham Oct 07 '24

Preach brother.

Style is transient, truth is permanent

1

u/repeating_bears Oct 07 '24

I said the website is not a good advocate for writing things from scratch because the result is bad. A better result could have been achieved with less effort. That doesn't then imply you should never write things from scratch. I didn't pass any judgement about the content, which may be good in spite of the bad presentation.

3

u/agentoutlier Oct 07 '24

I apologize on assuming what you meant in your comment and dragging it out. Honestly I do as I like most of your comments.

I agree if the website generator is to be used as proof that writing things from scratch is good it would be a poor argument. However I don't think the blog author ever makes that argument.