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

Torsten Rendelmann commented on HTTPCORE-627:
---------------------------------------------

Think [~michael-o] is right: I was lead to "URI" behavior according to the name 
used by the class.

As you currently take over the scheme specific part from an original URI and 
consider that within .build() it should be documented (javadoc enough?) in the 
API, which methods "reset" that field. If there would be at least some kind of 
setter/getter for the scheme specific part and the knowledge about the 
"resetting" methods one would be able to initialize that at last before 
.build() to get an acceptable/expected result. That would be fine for me :) and 
open the class for many other use cases, e.g. assembling an URL/URI is 
discussed often at stackoverflow. 

> 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:[email protected]?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:[email protected]";).setParameter("subject", "mail subject");
>     final String result = uribuilder.build().toString();
>     Assert.assertTrue("mail address as scheme specific part expected", 
> result.contains("[email protected]"));
>     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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to