Proposal: add getCompleteRequestURI() and getCompleteRequestURL()
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 325
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Description
Information that is commonly needed from [`HttpServletRequest`](https://docs.oracle.com/javaee/6/api/index.html?javax/servlet/http/HttpServletRequest.html) 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](https://stackoverflow.com/questions/2222238/httpservletrequest-to-complete-url).
The [`request-target`](https://datatracker.ietf.org/doc/html/rfc7230#section-5.3) 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 ](https://stackoverflow.com/questions/2222238/httpservletrequest-to-complete-url) to reconstruct it again back to it's original form, which can introduce bugs.
Users expect that the existing methods [`getRequestURI()`](https://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getRequestURI()) and [`getRequestURL()`](https://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#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`.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the HttpServletRequest API documentation and the existing getRequestURI() and getRequestURL() contracts, then read the referenced RFC request-target section. Determine the exact semantics and naming for complete URI and URL methods, including how they differ from the existing methods. Done means the API proposal has resolved these details and the resulting Servlet API change is specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100