tanszek:oktatas:iss_t:http_server
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tanszek:oktatas:iss_t:http_server [2023/03/12 17:51] – knehez | tanszek:oktatas:iss_t:http_server [2026/03/09 09:57] (current) – knehez | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== Saját | + | ==== 'My own HTTP' server sample |
| Let's create an empty Java project, Then create files called // | Let's create an empty Java project, Then create files called // | ||
| - | |||
| - | **Task**: create a generic error handling function to return errors to the client side. | ||
| Content of // | Content of // | ||
| - | <code html> | + | <sxh html> |
| < | < | ||
| < | < | ||
| Line 13: | Line 11: | ||
| </ | </ | ||
| </ | </ | ||
| - | </code> | + | </sxh> |
| Content of // | Content of // | ||
| - | <code html> | + | <sxh html> |
| < | < | ||
| < | < | ||
| Line 23: | Line 21: | ||
| </ | </ | ||
| </ | </ | ||
| - | </code> | + | </sxh> |
| Content of // | Content of // | ||
| - | <code java> | + | <sxh java> |
| import java.io.BufferedOutputStream; | import java.io.BufferedOutputStream; | ||
| import java.io.BufferedReader; | import java.io.BufferedReader; | ||
| Line 110: | Line 108: | ||
| out.println(" | out.println(" | ||
| out.println(" | out.println(" | ||
| - | out.println(); | + | out.println(); |
| out.flush(); | out.flush(); | ||
| Line 174: | Line 172: | ||
| out.println(" | out.println(" | ||
| out.println(" | out.println(" | ||
| - | out.println(); | + | out.println(); |
| out.flush(); | out.flush(); | ||
| Line 182: | Line 180: | ||
| } | } | ||
| - | </code> | + | </sxh> |
| + | **Task 1.**: create a generic error handling function to return errors to the client side. | ||
| - | **Task**: refactor the code and eliminate duplicate parts. Let's create a separate function to return | + | **Task |
| - | <code java> | + | <sxh java> |
| out.println(" | out.println(" | ||
| out.println(" | out.println(" | ||
| Line 192: | Line 191: | ||
| out.println(" | out.println(" | ||
| out.println(" | out.println(" | ||
| - | out.println(); | + | out.println(); |
| out.flush(); | out.flush(); | ||
| - | </code> | + | </sxh> |
| - | **Task**: modify the source code so that it can also return images. To do this, first add <img src=" | + | **Task |
tanszek/oktatas/iss_t/http_server.1678643470.txt.gz · Last modified: 2023/03/12 17:51 by knehez
