RouteConfiguration.forSessionScope().getUrl() does not return scheme and domain name
See original GitHub issueDescription of the bug
The method RouteConfiguration.forSessionScope().getUrl()
only returns the route and not a valid URL.
Expected behavior
Since the method RouteConfiguration.forSessionScope().getUrl()
is named getUrl()
, I expected it to return at least the scheme + host
https://datatracker.ietf.org/doc/html/rfc1738#section-3.3
Minimal reproducible example
@PageTitle("Static")
@Route(value = "static", layout = MainLayout.class)
@RouteAlias(value = "", layout = MainLayout.class)
@PermitAll
public class StaticView extends HorizontalLayout {
private TextField name;
private Button sayHello;
public StaticView() {
name = new TextField("Your name");
sayHello = new Button("Say hello");
sayHello.addClickListener(e -> {
Notification.show("Hello " + name.getValue());
});
setMargin(true);
setVerticalComponentAlignment(Alignment.END, name, sayHello);
add(name, sayHello);
String route = RouteConfiguration
.forSessionScope()
.getUrl(StaticView.class);
System.out.println(route); //prints "static"
}
}
Versions
- Vaadin / Flow version: 23
- Java version: 18
- OS version: Windows 10
- Browser version (if applicable): Firefox
- Application Server (if applicable): built-in from starter project
- IDE (if applicable): IntelliJ
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
URL generation | Routing and Navigation | Flow
... the request is a simple call for RouteConfiguration.forSessionScope().getUrl(Class target). Example: Returned URL is resolved to path.
Read more >Get domain name from given url - java
URL class) but I encountered problems with the URI class. Notably, URI.getHost() gives a null value if the url does not include the...
Read more >Setting up custom domain names for REST APIs
Learn how to set up a custom domain name for a REST API in API Gateway. ... In this case, the custom domain...
Read more >GitLab Pages domain names, URLs, and base URLs
On this document, learn how to name your project for GitLab Pages according to your intended website's URL. GitLab Pages default domain names....
Read more >Google Domains – Register Your Domain Name – Google ...
Find your place online with a domain from Google, powered by Google reliability, security and performance.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just a small nitpick, it returns the route (the one we define using
@Route
), not the route parameter.Not that it really matters in this case, but it could be noted that relative URLs are still valid URLs.