private static boolean hasPathPrefix(VaadinRequest request, String prefix) { String pathInfo = request.getPathInfo(); if (pathInfo == null) { return false; } if (!prefix.startsWith("/")) { prefix = '/' + prefix; } if (pathInfo.startsWith(prefix)) { return true; } return false; }
private static boolean isPathInfo(VaadinRequest request, String string) { String pathInfo = request.getPathInfo(); if (pathInfo == null) { return false; } if (!string.startsWith("/")) { string = '/' + string; } if (pathInfo.equals(string)) { return true; } return false; }
@Override public Class<? extends UI> getUIClass(UIClassSelectionEvent event) { String requestPathInfo = event.getRequest().getPathInfo(); if (path.equals(requestPathInfo)) { return uiClass; } else { return null; } } }
private static boolean error(VaadinRequest request, VaadinResponse response, String logMessage) throws IOException { getLogger().log(Level.WARNING, logMessage); response.sendError(HttpServletResponse.SC_NOT_FOUND, request.getPathInfo() + " can not be found"); // Request handled (though not in a nice way) return true; }
private static boolean error(VaadinRequest request, VaadinResponse response, String logMessage) throws IOException { getLogger().log(Level.WARNING, logMessage); response.sendError(HttpServletResponse.SC_NOT_FOUND, request.getPathInfo() + " can not be found"); // Request handled (though not in a nice way) return true; } }
@Override protected String getServiceUrl(BootstrapContext context) { String pathInfo = context.getRequest().getPathInfo(); if (pathInfo == null) { return null; } else { /* * Make a relative URL to the servlet by adding one ../ for each * path segment in pathInfo (i.e. the part of the requested path * that comes after the servlet mapping) */ return VaadinServletService.getCancelingRelativePath(pathInfo); } }
private UI getUIInstance(UIProviderEvent event) { VaadinRequest request = event.getRequest(); String pathInfo = request.getPathInfo(); String name = null; if (pathInfo != null && !pathInfo.isEmpty()) { Matcher matcher = WINDOW_NAME_PATTERN.matcher(pathInfo); if (matcher.matches()) { // Skip the initial slash name = matcher.group(1); } } LegacyApplication application = getApplication(); if (application == null) { return null; } LegacyWindow window = application.getWindow(name); if (window != null) { return window; } return application.getMainWindow(); }
String pathInfo = request.getPathInfo();
@Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { String pathInfo = request.getPathInfo(); if (pathInfo == null) { return false;
String pathInfo = request.getPathInfo();
@Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { String requestPath = request.getPathInfo(); if (requestPath == null || !requestPath.startsWith(CONNECTOR_RESOURCE_PREFIX)) {
} else if (request.getPathInfo() != null) { String pathInfo = request.getPathInfo(); if (uiRootPath.endsWith(pathInfo)) { uiRootPath = uiRootPath.substring(0,
@Override public String getRequestPath() { return request.getPathInfo(); }
@Override public String getPathInfo() { return instance.getPathInfo(); }
@Override public String getRequestPath() { return request.getPathInfo(); }
/** * Returns the dialog id extracted from the requested path.<p> * * @param request the request * * @return the id */ private String getDialogId(VaadinRequest request) { String path = request.getPathInfo(); // remove the leading slash return path != null ? path.substring(1) : null; } }
@Override public Class<? extends UI> getUIClass(UIClassSelectionEvent uiClassSelectionEvent) { final String path = extractUIPathFromPathInfo(uiClassSelectionEvent.getRequest().getPathInfo()); if (pathToUIMap.containsKey(path)) return pathToUIMap.get(path); for (Map.Entry<String, Class<? extends UI>> entry : wildcardPathToUIMap.entrySet()) { if (path.startsWith(entry.getKey())) return entry.getValue(); } return null; }
/** * Gets the service URL as a URL relative to the request URI. * * @param context * the bootstrap context * @return the relative service URL */ protected static String getServiceUrl(BootstrapContext context) { String pathInfo = context.getRequest().getPathInfo(); if (pathInfo == null) { return "."; } else { /* * Make a relative URL to the servlet by adding one ../ for each * path segment in pathInfo (i.e. the part of the requested path * that comes after the servlet mapping) */ return ServletHelper.getCancelingRelativePath(pathInfo); } }
@Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { String requestPath = request.getPathInfo(); // redirect to base URL if we have unparsable path tail if (!Objects.equals("/", requestPath)) { response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); response.setHeader("Location", request.getContextPath()); return true; } return super.handleRequest(session, request, response); } }
private void addHeader(VaadinRequest request) { if (m_headerProvider != null) { try { setHeaderHtml(m_headerProvider.getHeaderHtml(((VaadinServletRequest) request).getHttpServletRequest())); } catch (final Exception e) { LOG.error("failed to get header HTML for request " + request.getPathInfo(), e); } } if (m_headerHtml != null) { InputStream is = null; try { is = new ByteArrayInputStream(m_headerHtml.getBytes()); final CustomLayout headerLayout = new CustomLayout(is); headerLayout.setWidth("100%"); headerLayout.addStyleName("onmsheader"); m_rootLayout.addComponent(headerLayout); } catch (final IOException e) { closeQuietly(is); LOG.debug("failed to get header layout data", e); } } }