[ 
https://issues.apache.org/jira/browse/HTTPCORE-627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17086410#comment-17086410
 ] 

Oleg Kalnichevski commented on HTTPCORE-627:
--------------------------------------------

[~torstenr] This is what RFC 2396 section  3 "URI Syntactic Components" states:

{noformat}
   The URI syntax is dependent upon the scheme.  In general, absolute
   URI are written as follows:

      <scheme>:<scheme-specific-part>

   An absolute URI contains the name of the scheme being used (<scheme>)
   followed by a colon (":") and then a string (the <scheme-specific-
   part>) whose interpretation depends on the scheme.

   The URI syntax does not require that the scheme-specific-part have
   any general structure or set of semantics which is common among all
   URI.  However, a subset of URI do share a common syntax for
   representing hierarchical relationships within the namespace.  This
   "generic URI" syntax consists of a sequence of four main components:

      <scheme>://<authority><path>?<query>
{noformat}

{{mailto:my@email.server}} conforms to the most general scheme specific format 
that does not define a query component or parameters of any sort. 

In my opinion the current behavior of URIBuilder is compliant with RFC 2396. I 
seriously doubt  RFC 3986 states something different.

So, big question is whether we, as a project, should support scheme specific 
URI formats unrelated to HTTP.

Oleg

> URIBuilder::Adding query parameters result in removing the scheme specific 
> part of an URI
> -----------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-627
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-627
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 5.0
>         Environment: Java EE; Vaadin; Glassfish 5
>            Reporter: Torsten Rendelmann
>            Priority: Minor
>             Fix For: Future
>
>
> We use the URIBuilder in our Vaadin projects to build URIs that are used at 
> client site (Browser).
> For that we built a URI using URIBuilder with the special scheme "mailto:";, 
> the e-Mail address of the receiver and some URL query parameters to suggest 
> the mail subject and body content.
> The final URL should look like that:
> {code:java}
> mailto:user@mail.server?subject=mail%20subject&body=mail%20body
> {code}
> We were not able to create that using the URIBuilder. Here is our approach as 
> a unit test:
> {code:java}
>  @Test
>  public void checkURIBuilderMailtoURLs() throws Exception {
>     final URIBuilder uribuilder = new 
> URIBuilder("mailto:my@email.server";).setParameter("subject", "mail subject");
>     final String result = uribuilder.build().toString();
>     Assert.assertTrue("mail address as scheme specific part expected", 
> result.contains("my@email.server"));
>     Assert.assertTrue("correct parameter encoding expected for that scheme", 
> result.contains("mail%20subject"));
>  }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to