I'm generating html page programatically.
I have an href with this src
"https:/www.w.com/editor/?lon=-72.382769&lat=41.324657"
however when i generate the html like this:
private Span getEditorSpan(CompleteRoutingResponseShort response) {
Span span4 = new Span();
for (int i = 0; i < response.alternatives.size(); i++) {
String editorUrl = editorUrlGenerator
.generateUrl(response.alternatives.get(i).response.results);
A a3 = new A();
a3.appendText("alt " + i);
a3.setTitle(response.alternatives.get(i).alternative_regression_id);
a3.setHref(editorUrl);
span4.appendChild(ImmutableList.of(a3, new Span().appendText("   ")));
}
return span4;
}
the result is an href that directs to:
"http://localhost:63342/https:/www.w.com/editor/?lon=-72.382769&lat=41.324657"
this is the resulted html:
<span><a title="358_0" href="https:/www.w.com/editor/?lon=-71.18612999999999&lat=42.21286&zoom=4&segments=63385498,76487105,22543109,22503638,22527613,76599462,76599461,76599460">alt 0</a><span> </span></span>
how can I make the url direct outside my localhost domain?
this is my url builder:
UriBuilder builder = UriBuilder
.fromPath(Constants.EDITOR_BASE_URL)
.scheme("https");
builder.queryParam("lon", firstPath.x)
.queryParam("lat", firstPath.y)
.queryParam("zoom", 4)
.queryParam("segments", segmentsInUrl);
return builder.build().toString();
The protocol set in your URL is https:/
and not 'https://'. This causes the application to think it is a relative URL. Fix this problem and it shouldn't prepend the domain name http://localhost:63342
afterwards.