@Override public Map<String, List<String>> getRequestParameters() { return getQueryParametersMap(request.getParameterMap()); }
@Override public Optional<List<String>> getMultiValueRequestParameter(String name) { ObjectUtils.argumentNotNull(name, "Parameter name must be not null"); return getQueryParameterMultiValue(request.getParameterMap(), name); }
@Override public Optional<String> getRequestParameter(String name) { ObjectUtils.argumentNotNull(name, "Parameter name must be not null"); return getQueryParameterValue(request.getParameterMap(), name); }
/** * Finds the class on on which page configuration annotation should be * defined. * * @param ui * the UI for which to do the lookup, not <code>null</code> * @param request * the request for which to do the lookup, not <code>null</code> * @return the class for which page configuration annotations should be * defined, or an empty optional if no such class is available */ public static Optional<Class<?>> resolvePageConfigurationHolder(UI ui, VaadinRequest request) { assert ui != null; assert request != null; if (ui.getRouter() == null) { return Optional.empty(); } return ui.getRouter().resolveNavigationTarget(request.getPathInfo(), request.getParameterMap()).map(navigationState -> { Class<? extends RouterLayout> parentLayout = getTopParentLayout( ui.getRouter(), navigationState); if (parentLayout != null) { return parentLayout; } return navigationState.getNavigationTarget(); }); }
private static InitialPageSettings createInitialPageSettingsObject( BootstrapHandler.BootstrapContext context) { UI ui = context.getUI(); VaadinRequest request = context.getRequest(); WebBrowser browser = context.getSession().getBrowser(); String pathInfo = request.getPathInfo(); if (pathInfo == null) { pathInfo = ""; } else { assert pathInfo.startsWith("/"); pathInfo = pathInfo.substring(1); } Router router = ui.getRouter(); NavigationEvent navigationEvent = new NavigationEvent(router, new Location(pathInfo, QueryParameters.full(request.getParameterMap())), ui, NavigationTrigger.PAGE_LOAD); List<HasElement> components = ui.getChildren() .map(component -> (HasElement) component) .collect(Collectors.toList()); AfterNavigationEvent afterNavigationEvent = new AfterNavigationEvent( new LocationChangeEvent(navigationEvent.getSource(), navigationEvent.getUI(), navigationEvent.getTrigger(), navigationEvent.getLocation(), components)); return new InitialPageSettings(request, ui, afterNavigationEvent, browser); }
/** * Enables navigation for a new UI instance. This initializes the UI content * based on the location used for loading the UI and sets up the UI to be * updated when the user navigates to some other location. * * @param ui * the UI that navigation should be set up for * @param initRequest * the Vaadin request that bootstraps the provided UI */ public void initializeUI(UI ui, VaadinRequest initRequest) { Location location = getLocationForRequest(initRequest.getPathInfo(), initRequest.getParameterMap()); ui.getPage().getHistory().setHistoryStateChangeHandler( e -> navigate(ui, e.getLocation(), e.getTrigger())); int statusCode = navigate(ui, location, NavigationTrigger.PAGE_LOAD); VaadinResponse response = VaadinService.getCurrentResponse(); if (response != null) { response.setStatus(statusCode); } }