Skip to content
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

Test failures after migration to Jersey 3.1.1 #5295

Closed
sergey-morenets opened this issue Mar 24, 2023 · 2 comments · Fixed by #5297
Closed

Test failures after migration to Jersey 3.1.1 #5295

sergey-morenets opened this issue Mar 24, 2023 · 2 comments · Fixed by #5297
Milestone

Comments

@sergey-morenets
Copy link

sergey-morenets commented Mar 24, 2023

Hi

We've just migrated from Jersey 3.0.3 to 3.1.1 and noticed that most of our Jersey-related integration tests started failing with 404 error.
Our investigation figured out that cause of this issue is this commit - a83c7cd

Previously Jersey Grizzly 2 container didn't use path value from @ApplicationPath so we provided "orders" relative path in the tests using WebTarget object.
But in Jersey 3.1.x application path is actually used:

final String appPath = handler.getApplicationHandler().getConfiguration().getApplicationPath();
final String uriPath = appPath == null ? uri.getPath() : uri.getPath() + "/" + appPath;

So we have to update tests and include application path: "api/orders".

This seems to be breaking change but it's never mentioned in the Jersey documentation ("Migration Guide" section) - https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest31x/migration.html

@jansupol
Copy link
Contributor

It's more a fixed bug, Jersey 2.x and 3.0.x did not support @ApplicationPath by other then Servlet container, but they should have. Jersey 3.1 do implement it, but it was not backported to older versions, not to break anything.

Right, we should mention it in doc.

@jansupol jansupol linked a pull request Mar 25, 2023 that will close this issue
@senivam senivam added this to the 3.1.2 milestone Mar 29, 2023
@senivam senivam closed this as completed Mar 29, 2023
@tusharg1t
Copy link

tusharg1t commented May 16, 2024

Hi,
A small doubt is that, in this commit - a83c7cd
The appPath is directly appended to uri path. I get it that you want to append the app path like "/api/v1/" to the uri path like"user/list"
but
What if app path is "/*" in that case the final uri turns out to be "/*/user/list" instead of "/user/list"

In Jakrta ws.rs-api @ApplicationPath("/*") is used to annotate the application path.

I think there should be a validation for this also! or is there a version which addressed this issue?

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 a pull request may close this issue.

4 participants