-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Hi there,
Not sure if I can post this here. Please feel free to close/delete.
Facing these issue w.r.t Vaadin UI and URL mapping.
Problem1:
I am trying to use Vaadin for basic CRUD operations for my Entities. To start with, I would like to expose a UI class to /subpath/xyz url. But the sub-path url mapping is somehow not working. (Please note that when I keep or remove @spring(path="myui") it still maps to localhost:8080/myui/ and not localhost:8080/subpath/myui/
What am I missing?
I have been following Vaadin's documentation but no luck so far.
https://vaadin.com/docs/-/part/framework/application/application-environment.html#application.environment.servlet-mapping
Problem2:
Also, Vaadin is not generating url mappings automatically from the class name. E.g. MyUI classname should be mapped to localhost:8080/my-ui/ if I do not give path attribute in @springui( as per Vaadin's documents).
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.spring.server.SpringVaadinServlet;
import com.vaadin.ui.*;
import javax.servlet.annotation.WebServlet;
@theme("valo")
@title("My UI")
@springui(path="myui")
public class MyUI extends UI {
@OverRide
protected void init(VaadinRequest request) {
// Create the content root layout for the UI
VerticalLayout content = new VerticalLayout();
setContent(content);
// Display the greeting
content.addComponent(new Label("Hello World!"));
// Have a clickable button
content.addComponent(new Button("Click Me!",
click -> Notification.show("Clicked!")));
}
@WebServlet(urlPatterns = {"/admin/*", "/VAADIN/*"}, name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
public static class MyUIServlet extends SpringVaadinServlet {
}
}