Skip to content

Added Webclient, refactored Webserver to share streamed body sending and receiving logic.#2771

Draft
jurgenvinju wants to merge 45 commits into
mainfrom
feat/webclient
Draft

Added Webclient, refactored Webserver to share streamed body sending and receiving logic.#2771
jurgenvinju wants to merge 45 commits into
mainfrom
feat/webclient

Conversation

@jurgenvinju
Copy link
Copy Markdown
Member

@jurgenvinju jurgenvinju commented May 12, 2026

  • adds Webclient.rsc which offers Response fetch(Request)
  • mirrors Webserver.rsc exactly, reusing the same Request and Response data-type
  • full implementation of HTTP1.1 client
  • restructuring of Webserver implementation to accomodate the client API: split Body type into send and receive kind:
    • send is used for server response and client put and get
    • receive is used for server put and get and client response
  • factored WebBody.java to reuse receiving and sending HTTP bodies in both the client and the server
  • Server POST/PUT fully implemented now.
  • Added JSON, HTML, XML (de)serialization for sending and receiving from streamed input (avoids local string copying)
  • add tests for the client
  • add tests for the server

@jurgenvinju jurgenvinju self-assigned this May 12, 2026
@jurgenvinju jurgenvinju requested a review from DavyLandman May 12, 2026 10:28
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 0% with 284 lines in your changes missing coverage. Please review.
✅ Project coverage is 46%. Comparing base (6212f69) to head (748dcc7).
⚠️ Report is 91 commits behind head on main.

Files with missing lines Patch % Lines
src/org/rascalmpl/library/util/Webclient.java 0% 283 Missing ⚠️
.../rascalmpl/exceptions/RuntimeExceptionFactory.java 0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##              main   #2771    +/-   ##
========================================
- Coverage       46%     46%    -1%     
+ Complexity    6718    6714     -4     
========================================
  Files          794     795     +1     
  Lines        65937   66220   +283     
  Branches      9889    9918    +29     
========================================
+ Hits         30760   30761     +1     
- Misses       32797   33079   +282     
  Partials      2380    2380            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@DavyLandman DavyLandman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a nice idea but not ready yet, I've written down my concerns.

I think this needs tests.

Comment thread src/org/rascalmpl/library/util/Webclient.java Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.java Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.java Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.java Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.java Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.rsc Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.rsc Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.java Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.java Outdated
Comment thread src/org/rascalmpl/library/util/Webclient.java Outdated
@jurgenvinju
Copy link
Copy Markdown
Member Author

jurgenvinju commented May 13, 2026

Great review @DavyLandman I'll try and improve this PR and let's have a look together later again.

I've tested this client so far with a couple of web APIs and some very large test downloads. It seems very natural apart from the host/path/query separation. I think some shorthands where a full URL can be used which is split up internally would be nice. Also there is no support for fragments yet.

@sonarqubecloud
Copy link
Copy Markdown

@jurgenvinju jurgenvinju changed the title recovered webclient branch; needs a little clean up Added Webclient, refactored Webserver to share streamed body sending and receiving logic. May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants