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

URI with / without ending slash can cause 404. #155

Open
kerkhofsd opened this issue Oct 9, 2017 · 1 comment
Open

URI with / without ending slash can cause 404. #155

kerkhofsd opened this issue Oct 9, 2017 · 1 comment

Comments

@kerkhofsd
Copy link
Contributor

Actual behavior:
When annotating a webscript class with:
@WebScript(baseUri = /v1/test)
And annotating the actual webscript method with:
@Uri(value = "", method = HttpMethod.GET)
A request to
{{scheme}}://{{host}}:{{port}}/alfresco/service/v1/test wil result in a 404,
And a request to
{{scheme}}://{{host}}:{{port}}/alfresco/service/v1/test/ wil actually call our method.

Actual behavior:
When annotating a webscript class with:
@WebScript(baseUri = /v1/test)
And annotating the actual method with:
@Uri(value = "/{aVariable}/test", method = HttpMethod.GET)
A request to
{{scheme}}://{{host}}:{{port}}/alfresco/service/v1/test/aVariable/test/ wil result in a 404,
And a request to
{{scheme}}://{{host}}:{{port}}/alfresco/service/v1/test/aVariable/test wil actually call our method.

Expected behavior:
What we expect is that in both cases, both for requests with and without ending backslash, our method will be called.

@kerkhofsd
Copy link
Contributor Author

Workaround
It is possible to provide a String array as value of the @Uri annotation:
@Uri(value = {"/{aVariable}/test", "/{aVariable}/test/"}, method = HttpMethod.GET)
A request to
{{scheme}}://{{host}}:{{port}}/alfresco/service/v1/test/aVariable/test/ wil actually call our method.
And a request to
{{scheme}}://{{host}}:{{port}}/alfresco/service/v1/test/aVariable/test wil actually call our method.

@vierbergenlars vierbergenlars changed the title URI with / without ending backslash can cause 404. URI with / without ending slash can cause 404. Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant