[EPIC] v0.2.0: Streaming Support & High-Performance I/O #11 - #70
Merged
Conversation
- Added checking body size per route and fall default to global size - Edited Levtus and Router `addRoute()` to return the Node - Added bodySize to Node - Changed bodySize from int to long - Add method `matchRoute()` to return the Node
feat: Added per Node body size limit
- Refactored and separated exceptions into HTTP and Developer - Created Exceptions for developer errors: BodyAlreadyConsumedException, DeveloperException (parent), and LevtusIOException (wrapper for UncheckedIOException) - Created LevtusInputStream that extends InputStream and acts as guards - Updated Request.java to accomodate method for body(), bodyAsString(), and bodyStream() with a safe bodyStream and unsafe one - Created shortcut in LevtusContext for quick access - Created StreamConsumer for safely accessing raw InputStream
feat: Implemented LevtusInputStream
- Changed HttpParser to add Response as a param to parseRequest - Added Request as a param to validateBodySize to check bodySize before 100-Continue was accepted - Remove automatically adding content type and server if absent and moved it to send(byte[] bodyBytes) - Added helper method send() for 100-Continue method that sends nothing but request line and headers - Added method overloading that will not send content length by default - Added code 100 to the getStatusText Method
feat: Added 100-Continue implementation
- Changed BufferedInputStream into OutputSream in HttpConnectionHandler - Added writeBody(Path path) that writes into the OutputStream of socket - created sendFIle(Path path) that calls writeBody(Path) internally to add headers, status and flush and set isSent = true; - Added helper method sendBinary(Path path) to set the type of file send to octet stream - Added helper method sendBinary(String) and sendFile(String) to grab file from relative path (staticFilesPath) - Reformed render to use sendFile internally - Changed all the implicit error code sending to throwing DeveloperExceptions - Added tests for all changes
feat: Added zero-copy file sending for Levtus
- Added getter and setters (chunkSize() and withChunkSize()) for default size per chunk - Changed maxBodySize from int to long to align with HTTP's spec - Added method to check the sending method of client/sender - Make sure calling body() family method only throws Levtus' internall exceptions - Added chunked reading capability in LevtusInputStream and made sure Request is compatible - Made it so LevtusIOException extends DeveloperException - Added needed test Note: Skipped trailer support for transfer encoding, as it is rarely used and doesn't align with Levtus' microservice needs
feat: Added capability to stream via Chunked Transfer encoding.
- Added HttpProtocol parser inside HttpParser to determine the protocol version (1.0/1.1) - Added capability for Levtus to accept connection close without waiting for timeout - Fixed bugs where methods call themselves in LevtusContext
Feat/chunked transfer
Feat/connection lifecycle
- Added Date to the header if user hasn't defined the date header yet - Added private method inside Response for getMimeType, getCurrentDate - Added helper method to send/stream file as a download - Added nescecary tests
feat: Added download helper method and Date placeing if absent
- Changed HashMap to ConcurrentHashMap for thread safety - Mark all wildcard variable as volatile
refactor: Made Node thread safe
- Added initialSocketTimeout variable for waiting the incoming HTTP Request's metadata - Added processingSocketTimeout for waiting the incoming HTTP Request's data/body - Added setters and getters for both
refactor: Allow for user defined socket timeout
- Add development branch, which is the final step before pushing to main, to CodeQL Advanced - Add labeler.yml
Epic/v0.2.0 streaming
- Changed version in pom.xml to version 0.2.0 - RUn Google Java Plugin on every file
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned Files
|
- Changed downloadFile methods to return void, as it cannot be chained because the Response has been flushed - Fixed the JavaDoc for Levtus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successfully added Keep-Alive and streaming support to Levtus