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

Proposal: add getCompleteRequestURI() and getCompleteRequestURL() #462

Open
devxzero opened this issue Apr 9, 2022 · 0 comments
Open

Proposal: add getCompleteRequestURI() and getCompleteRequestURL() #462

devxzero opened this issue Apr 9, 2022 · 0 comments
Labels
Enhancement New feature or request

Comments

@devxzero
Copy link

devxzero commented Apr 9, 2022

Information that is commonly needed from HttpServletRequest is the URL or URI in its complete form. But currently, there is no such feature in Servlet, which raises a lot of questions for new developers, as is demonstrated in this highly voted Stackoverflow question.

The request-target in the HTTP RFC is the complete URI. URIs are specified in the origin-form.
The problem with Servlet is that the Servlet API doesn't provide this vital part of the HTTP request, but strips it down, and then provides parts of it separately. So users have to find methods to reconstruct it again back to it's original form, which can introduce bugs.
Users expect that the existing methods getRequestURI() and getRequestURL() provide what they are looking for, but then find that their application isn't behaving as expected, and have to resort to the JavaDocs to find out that these methods aren't providing complete information.

These problems would be solved if new methods with names like getCompleteRequestURI() or getFullRequestURI(), and getCompleteRequestURL() or getFullRequestURL(), would be added to HttpServletRequest.

@markt-asf markt-asf added the Enhancement New feature or request label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants