This is my custom PageNotFound
route:
@ParentLayout(MainLayout.class)
@AnonymousAllowed
public class PageNotFound extends RouteNotFoundError {
@Override
public int setErrorParameter(BeforeEnterEvent event, ErrorParameter<NotFoundException> parameter) {
VerticalLayout verticalLayout = new VerticalLayout();
// some logic
getElement().insertChild(0, verticalLayout.getElement());
return HttpServletResponse.SC_NOT_FOUND;
}
}
Despite the fact I return HttpServletResponse.SC_NOT_FOUND
the page still returns 200ok instead of 404. What am I doing wrong and how to fix it?