-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support of Jetty 12 #2593
Add support of Jetty 12 #2593
Conversation
@tomakehurst would love to hear your opinion before committing more time, the are 2 issues that I run into with implementing the support of both Jetty 11 and Jetty 12:
The way I was thinking to make it work is that (it could be implemented more or less cleanly):
With multi-release JAR we should be able to replace Jetty 11 with Jetty 12 and compile the integration properly. The other option (without the multi-release jar) would be to have some kind of "stubs" at compile time to fill up the API discrepancies (haven't tried that yet but looks a bit ugly). Would appreciate the hints what direction you would prefer to steer towards, thank you. |
I broadly agree with your proposed approach, but I think a multi-release JAR might not be such a great idea as it's the Jetty version rather than Java that we're switching on and we want to support the case of Java 17 + Jetty 11 (someone out there will definitely be doing this!). What I suggest is that we try to find a way to put all of stuff where the Jetty API varies under an abstraction in |
Thanks a lot @tomakehurst
My apologies for confusion - the Jetty 12 won't be replacing Jetty 11, Jetty 11 would be default version to try independently of the JDK, the Jetty 12 would only be available on JDK-17+ (as an option)
I will surely try that first, thank you. |
d0e792d
to
b42f781
Compare
I suggest we keep all sources under |
Thanks @tomakehurst , I will try that as well, but I have not figured out yet the way to compile both Jetty 11 and Jetty 12 within same source tree (PS: in all the cases, we have |
Yeah, I guess that could be tricky. I wonder if we could put the compatibility tests in a sub-project that has Jetty 12 as its dependency, and keep Jetty 11 in the main project. |
Exactly, I think we could do that by I haven't yet get to this point. If we find the way to phase off multi-release JAR, that would be easier, otherwise we would need to run Jetty 12 test suite against JAR (if nothing changed recently, none of build tools support running tests for multi-release artifacts if they are not packaged as JARs). |
The Gradle team only seems to support multi-release very reluctantly. And I really think we shouldn't be switching it on the Java version. |
I was exploring the hosting the However what I am exploring now, if we could merge the classes from both source sets (main + jetty12) once the compilation of both succeeds. In this case we don't need the multi-release JAR but single one. How does it sound to you? |
Actually maybe having |
da28c16
to
d68606e
Compare
private static final MethodHandle SERVER_CONSTRUCTOR = getServerConstructor(); | ||
|
||
@SuppressWarnings("unchecked") | ||
private static MethodHandle getServerConstructor() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid using reflection by querying Jetty.VERSION
and then delegating to e.g. Jetty11HttpServerFactory
or Jetty12HttpServerFactory
appropriately?
This would be great from a performance perspective as using reflection this way has a big impact on cold startup time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid using reflection by querying Jetty.VERSION and then delegating to e.g. Jetty11HttpServerFactory or Jetty12HttpServerFactory appropriately?
Absolutely, I haven't thought about that by I remember you suggesting it previously, I will work on that part, thank you
06f6a23
to
75874bd
Compare
Looking at your latest changes I'm starting to wonder if this is going to be a bit too painful to develop and maintain going forward. Perhaps it might be worth considering a separate JAR after all. I've had a couple of ideas that might make it easier to live with:
We're planning to release WireMock on Thursday, although I'm guessing getting this in is a stretch at the moment. BTW I appreciate you humouring me and trying to make this work the way I previously suggested! |
Thanks for looking @tomakehurst, really appreciate it
This would work (following the steps 1 and 2) but we have 2 choices here:
We are down to ~20 failing tests but large chunk of them is blocked by 2 issues (I also listed them on top but repeat it here for convinience):
The 1st one is really difficult to get back - Jetty 12 literally phased out the status propagation from everywhere (if you need code hints, happy to share). For 2nd one we would need a replacement but I have not looked into it yet, if you have time to take it, would be awesome. |
It looks like we can use Agree status setting is tricky. I've been Googling a little bit to try to find out where and why they've done this, but without much luck so far so please share any links you've got to explanations of this. |
👍 (saw it, thank you)
I believe the context for it is Servlet 6 spec changes where |
I suggest for now we prevent the reason setting tests from running when the Jetty version is 12. We can document the fact it doesn't work with Jetty 12, and either drop support for it in WireMock 4.0 completely or see if we can persuade the Jetty team to restore this capability. |
Thanks a lot @tomakehurst , I am on vacation this week, should be back on March 7th (if you need me to take a look but please don't wait for me, I could review post merge), my apologies for inconvenience. I will join Slack shortly |
I think it might be in a releasable state. It'd be good to get a 2nd pair of eyes on it, but I can get one of my team to take a look. The main thing is I wanted to make sure you get properly credited by GitHub for all the work you've put in, which I'm not sure it'll do if I merge my branch. |
I am back from vacation (apologies for delay), I like your approach @tomakehurst (I was a bit afraid to introduce subproject), it introduces much cleaner distribution and development models. Please feel free to go ahead, I have no issue with merging your branch, thanks a lot for working with me on that! |
How about you pull my branch into this PR, then I'll squash and merge? That way you'll get properly credited by the OSS gods. |
Sure! No objections either, on it, thanks a lot @tomakehurst ! |
59b8425
to
a62a686
Compare
Signed-off-by: Andriy Redko <drreta@gmail.com>
🟢 , we should be all set (the documentation update would be a separate pull request), I had to remove JDK-11 from GA actions since we cannot build Jetty 12 subproject anymore with it |
I think we should create separate GA workflows for the main project and Jetty12. Ensuring 11 support is too important to drop it completely from the matrix. |
Got it, will do that shortly, thanks @tomakehurst ! |
…etty12 inclusion (based on JDK version) Signed-off-by: Andriy Redko <drreta@gmail.com>
@@ -14,7 +14,7 @@ jobs: | |||
- name: Set up Java | |||
uses: actions/setup-java@v3 | |||
with: | |||
java-version: '11' | |||
java-version: '17' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Releasing with JDK-17 so to have wiremock-jetty12 included
@@ -1 +1,4 @@ | |||
rootProject.name = 'wiremock' | |||
if (JavaVersion.current() >= JavaVersion.VERSION_17) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomakehurst making wiremock-jetty12
subproject conditional (based on JDK version)
This is looking good. Is it ready to merge as far as you're concerned? I'll probably tweak the release workflow a bit after merging so don't worry about getting that perfect. |
No concerns, thanks a lot @tomakehurst ! (resolved the conflicts) |
Signed-off-by: Andriy Redko <drreta@gmail.com>
@tomakehurst wondering if you have something in mind for this pull request that holds it off, thank you. |
It's ready I think. Going to try to merge and release it today, along with a few other things. |
Add support of Jetty 12
References
Road block (so far):
replaced with MultiPartFormData.Parser but it does not have any special treatment to Base64 (as Jetty 11 had)org.eclipse.jetty.server.MultiPartInputStreamParser
is gone for goodJetty 12 limitations to document:
/
)TODOs (from @tomakehurst):
Perhaps it might be worth considering a separate JAR after all. I've had a couple of ideas that might make it easier to live with:
Submitter checklist
#help-contributing
or a project-specific channel like#wiremock-java