To make sure we can quickly validate and fix the bug, please provide as much as possible of the following information:
If you create a Spring Boot Application with Vaadin 10 (flow) with a Spring MVC Rest Controller listening with GET on "/*", vaadin wont work. Changing vaadin.urlMapping lead to another error/bug.
@RequestMapping(produces = "text/html")
public class IssueReproduceVaadin {
@RequestMapping(value = {""}, method = RequestMethod.GET)
public String demo() {
return "vaadin broke....";
}
}
@Push
@Route("admin")
public class BaseLayout extends VerticalLayout {
public BaseLayout() {
Button button = new Button("Broke the App :)");
button.addClickListener(buttonClickEvent -> {
System.out.println("do something");
});
add(button);
}
}
Hint: I tried to change the vaadin.urlMapping to another value, but after this, the UI cannot find the files in frontend/bower_components/... ...
The Application works just fine
The application (ui) is responding with "Server Connection lost" and the log is spammed with "Request method 'POST' not supported"
Regards
SeaLife
To reproduce this issue, you can download a simple spring demo application here:
https://mega.nz/#!PWQ3EapJ!HKR5ShC_8vP7RMLpwHjr13JEBddE0w5BRtIyvAi2WhE
Having the same problem and trying sugestions from other tickets / threads, no combination of the following works:
It's possible to change the application's root mapping, but it seems to not map the frontend components at all then.
Mhh... Im a bit disappointed with this Ticket. This makes Vaadin 10 (flow) useless for me since i need to publish a HTML file on the root of the application and have the vaadin app as an Admin interface for the HTML (simple JS app). As long as we cant change the base root for Vaadin we cant use Vaadin 10 and have to stick to 8.. :(
We used Vaadin 10 in other applications were i dont have to host something else on the root but its a shame that this issue is now opened for nearly 30 days without even a word said. There is a "bug" label (btw added 20 days after the issue was created)...
Regards
SeaLife
@SeaLife Vaadin's an open source project, you can try to solve the issue or propose a solution which may benefit others. If you have a Pro Subscription with support hours included, I'm sure you can ask support via that channel and have a quick response.
There are many issues pending responses from the team in this period, I guess most of the guys took a deserved 4 weeks break after releasing 10 馃檪
Yeah, sure - i could just fix a complex problem on my own. Sure i know its open source, but there is no attention, no comment from everyone except for the one guy who got the same problem. Even the label "bug" took 20 days.... Just a comment like 'Ye, we will look into the issue' would help me. And even if it takes days/months/years to solve the issue, there was attention on the issue and that would help me.
Anyway - thank you for your response.
Regards
SeaLife
Hey,
just discovered, if vaadin.urlMapping is set, everthing in frontend is not mapped.
For example, using the urlMapping /ui/ you can open the UI on ...:8080/ui/ but you cant access the frontend resources... Not even with ...:8080/ui/frontend/... its simply not there.
Regards
SeaLife
Thank you Giovanni for absolutely correct answer.
That's the answer which I should have written but didn't find the proper words.
Spring Flow is just one one a lot of Flow related projects : Flow, a number of individual components, various integrations including Spring , CDI , etc. Each this project has quite many issues.
So we just have no resources to check everything especially summer time when at least a half of team is on vacation.
We are working on prioritized tickets at the moment.
This one is not more important than any other ticket.
If you want to get fixes something ASAP then you may use your support subscription and mark bug as BFP. In this case it will be prioritized and we start to work on it ASAP.
Now about this ticket.
This is not a bug at all.
Vaadin servlet listens by default root URL "/". There is always a servlet under the hood even if you don't see it and use @Route . In your specific case you use @Route("admin") and expect that "/" path is not occupied by anything.
It doesn't work in this way.
As I said there is always a servlet which is mapped to the URL. By default it's "/".
You have overriden this URL by you REST service method.
So of course it doesn't work because you have overriden Vaadin servlet mapping.
In similar way you may have @Route("") and expect that it works with your REST service.
@Route is not a standalone mapping as it's in REST . It works only under Vaadin servlet.
So this is not a bug at all.
If you want to get Vaadin working then there are two options:
And for the latter there is vaadin.urlMapping property.
And yes, in this case everything in frontend is not mapped automatically for you.
This is known issue (we don't even consider this is as a bug).
This is how things work. You need to do additional config to be able to get frontend working with your Vaadin appication in case you change the default mapping.
I personally think that this is really a bad limitation and there is a ticket about it to make it possible work out of the box: https://github.com/vaadin/flow/issues/3600
But what you should do is: create a servlet which extends VaadinServlet with "/frontend" mapping.
This additional servlet will handle webjar URLs and solve your issue.
I'm closing this ticket since the original issue is not a bug at all. And the issue with vaadin.urlMapping is covered by another ticket.
One more thing: please use correct repository for the issues. This ticket is about Spring and should have been made in vaadin/spring repo.
Most helpful comment
Thank you Giovanni for absolutely correct answer.
That's the answer which I should have written but didn't find the proper words.
Spring Flow is just one one a lot of Flow related projects : Flow, a number of individual components, various integrations including Spring , CDI , etc. Each this project has quite many issues.
So we just have no resources to check everything especially summer time when at least a half of team is on vacation.
We are working on prioritized tickets at the moment.
This one is not more important than any other ticket.
If you want to get fixes something ASAP then you may use your support subscription and mark bug as BFP. In this case it will be prioritized and we start to work on it ASAP.
Now about this ticket.
This is not a bug at all.
Vaadin servlet listens by default root URL "/". There is always a servlet under the hood even if you don't see it and use
@Route. In your specific case you use@Route("admin")and expect that"/"path is not occupied by anything.It doesn't work in this way.
As I said there is always a servlet which is mapped to the URL. By default it's "/".
You have overriden this URL by you REST service method.
So of course it doesn't work because you have overriden Vaadin servlet mapping.
In similar way you may have
@Route("")and expect that it works with your REST service.@Routeis not a standalone mapping as it's in REST . It works only under Vaadin servlet.So this is not a bug at all.
If you want to get Vaadin working then there are two options:
And for the latter there is
vaadin.urlMappingproperty.And yes, in this case everything in frontend is not mapped automatically for you.
This is known issue (we don't even consider this is as a bug).
This is how things work. You need to do additional config to be able to get
frontendworking with your Vaadin appication in case you change the default mapping.I personally think that this is really a bad limitation and there is a ticket about it to make it possible work out of the box: https://github.com/vaadin/flow/issues/3600
But what you should do is: create a servlet which extends
VaadinServletwith"/frontend"mapping.This additional servlet will handle webjar URLs and solve your issue.
I'm closing this ticket since the original issue is not a bug at all. And the issue with
vaadin.urlMappingis covered by another ticket.One more thing: please use correct repository for the issues. This ticket is about Spring and should have been made in vaadin/spring repo.