Web server in pure Java

  Рет қаралды 8,907

Daniel Persson

Daniel Persson

Күн бұрын

Пікірлер: 20
@aaronperl
@aaronperl 4 жыл бұрын
I needed to implement a simple web server 8 or 9 years ago, and I remember it being hard to find information on how to do it. I finally did find something, but as I vaguely recall it was somehow a bit more complicated than this. I wish your video was around back then. More recently I used Jersey and Spring Boot to create web servers/applications and they're so complex when you just need something basic: Jersey is pain in the butt to configure, plus you need a separate webserver like Tomcat, and Spring is a huge, complex framework. They have their uses, sure, but I'll be coming back to this video when I just need something simple.
@DanielPersson
@DanielPersson 4 жыл бұрын
Hi aaron. I had the same experience, trying to get 3-4 different servers to work. And I wanted one dependency at the most because I don't need to add the whole world to show one web page. I vaguely remember implementing a small web server handling a swagger interface and realized that I already had a solution but never talked about it explicitly. Thank you for watching my video. Best regards Daneil
@MrPDTaylor
@MrPDTaylor 4 жыл бұрын
Thanks so much! I've been looking for a straightforward example and haven't found one until now.
@peer2pirate
@peer2pirate 4 жыл бұрын
Super useful man! I was looking for a breakdown of the HttpServer class and couldn't find one anywhere! Thanks so much!
@pms_code
@pms_code 3 жыл бұрын
I Love the way you are writing the code ❤️. I want to prepare to write the code like this ❤️❤️❤️
@elirant3
@elirant3 4 жыл бұрын
thank you dude! Exactly what i searched for!!
@iidanielbirl8894
@iidanielbirl8894 4 жыл бұрын
Awesome video! Going to finally build a framework-less http server! Thanks for the video!
@saimun847
@saimun847 4 жыл бұрын
Awesome , Thank You
@resu2381
@resu2381 3 жыл бұрын
Hi, can I use it to update my website without refreshing it? Or I have to use WebSockets?
@DanielPersson
@DanielPersson 3 жыл бұрын
Hi Resu If the web browser support streaming then you could technically stream updates to it. The web is a pull first technology so using websockets or other lightweight protocols are more suitable for the task. Thank you for watching my video. I hope this helps. Best regards Daniel
@resu2381
@resu2381 3 жыл бұрын
@@DanielPersson Thank you for the answer. I will try to use WebSockets.
@adamsalem-s
@adamsalem-s 2 жыл бұрын
Hey awesome video man this helped me a lot but when I use a Buffered Reader to read my html file and load it into the body every thing works except it doesn't load pictures and I know my html/css works please help
@DanielPersson
@DanielPersson 2 жыл бұрын
Hi ItsVoid Thank you for watching my videos. This video was a little proof of concept and will not have all the functionality of a complete webserver. For example, in the case of images and CSS, these could be placed in separated files usually, and then they will not be appended or available if you only push a stream of data. There are two ways of handling this. Either you embed everything into the same stream. Then, take the images, base64 encode them and push the CSS in a style tag in your HTML instead of a separate file. Another approach is to write more handlers that could fetch static files from the disk when you visit a specific context, so these files are returned when the browser requests them. I hope this helps. Best regards Daniel
@adamsalem-s
@adamsalem-s 2 жыл бұрын
@@DanielPersson thank you also I think I found a css fix I think you have to add all of your css into the html file also I used a bufferedreader to read an html file to then send as the response
@AcheliusDecimus
@AcheliusDecimus 4 жыл бұрын
SUPER EASY WOW!! Thanks a 100%!!
@gameratortylerstein5636
@gameratortylerstein5636 4 жыл бұрын
does everybody with the last name Persson like to code? Markus Persson who coded minecraft also likes to code
@DanielPersson
@DanielPersson 4 жыл бұрын
Hi Tyler Thank you for watching my videos. There are a lot of people in Sweden that loves to code, I think I might be a bit more obsessed as I started at 8 years old. When it comes to the surname it's the 8th most common in Sweden and there is about 100k of us. And I know multiple people that have the same name as me because Daniel is common to. www.scb.se/en/finding-statistics/statistics-by-subject-area/population/general-statistics/name-statistics/pong/tables-and-graphs/all-registered-persons-in-sweden---last-names-top-100-list/last-names-top-100/ Best regards Daniel
@Crassus_Auratus
@Crassus_Auratus 8 ай бұрын
very NOT useful like most tutorials... I directly starts didn't know why "package org ea" didn't work, and because I didn't know, I don't know what to learn or where to find. 🤷‍♂ Is this some to install? Where is the java file located? In src folder? Why do you hide this side bar? After 2 Minutes, I know this is not helpful I close and bye. Can someone say how are the steps before? Man this waste so much time for beginners. Time of years really... If I google package org ea nothing helpful appears, so how to learn, where to find, what the heck is this?? Since 10 yrs I try to learn programming and this is what happens!? For me such tutorial are completely useless. But I didn't know what I have to learn instead. Holy crap.
@DanielPersson
@DanielPersson 8 ай бұрын
Hi Wolf. This video is not for everyone. To understand the code you need to have written some basic java programs before and know about packages and how a program is structured. I think you should probably look into the pure basics of the java programming language. So here is some resources. First coursera has some really good courses that is lead by teachers that can give you the basics. coursera.pxf.io/QOv369 I also have some really old videos series going through some basics but I might not explain packages there, don't remember: kzbin.info/aero/PLP2v7zU48xOI3txZTS5u2lqD_OVVS5ykA I understand that this video can be a bit hard to get, it's like taking swim lessons and the first time you are the pool someone throws you in. Not fair. If you need more support i would suggest some local college or night course where you can have a one to one relationship with a teacher to give you more detail instructions when you get stuck. I hope this helps. Thank you for watching my videos. Best regards Daniel
@MrPDTaylor
@MrPDTaylor 4 жыл бұрын
First
Создание HTTP-сервера на Java
8:10
Egor Repnikov
Рет қаралды 15 М.
Java Socket Programming Client Server Messenger
16:28
WittCode
Рет қаралды 110 М.
GIANT Gummy Worm #shorts
0:42
Mr DegrEE
Рет қаралды 152 МЛН
How to use autotools (automake, autoconf, aclocal, autoheader)
15:21
Daniel Persson
Рет қаралды 17 М.
OpenAI's o1 just hacked the system
26:31
AI Search
Рет қаралды 42 М.
ETL ponta a ponta #003   Carga Raw
52:19
Michel Santana
Рет қаралды 15
Tools EVERY Software Engineer Should Know
11:37
Tech With Tim
Рет қаралды 23 М.
Comparing 3 java build tools (Ant vs Maven vs Gradle)
27:09
Daniel Persson
Рет қаралды 20 М.
Новый год 2025 на ТНТ "ComedyVision!" @ComedyClubRussia
1:16:57
Git & GitHub Crash Course For Beginners
32:42
Traversy Media
Рет қаралды 3,2 МЛН