public String getSelectorString() { return requestPathInfo.getSelectorString(); }
protected boolean checkSelector(RequestPathInfo pathInfo, ValueMap properties) { return check(pathInfo.getSelectorString(), PN_ALLOWED_SELECTORS, PN_ALLOWED_SELECTOR_PATTERN, properties); }
@Override public String getSelectorString() { if (isSelectorOverridden) { return StringUtils.join(selectors, "."); } return getOriginal().getSelectorString(); }
@Override public String getSelectorString() { if (isSelectorOverridden) { return StringUtils.join(selectors, "."); } return getOriginal().getSelectorString(); }
protected boolean checkSelector(RequestPathInfo pathInfo, ValueMap properties) { return check(pathInfo.getSelectorString(), PN_ALLOWED_SELECTORS, PN_ALLOWED_SELECTOR_PATTERN, properties); }
private void runActionTypeInit(FormStructureHelper formStructureHelper) { final RequestPathInfo requestPathInfo = request.getRequestPathInfo(); if (response != null && !StringUtils.equals(requestPathInfo.getSelectorString(), SCRIPT_FORM_SERVER_VALIDATION) && StringUtils.isNotEmpty(actionType)) { final Resource formStart = formStructureHelper.getFormResource(request.getResource()); try { FormsHelper.runAction(actionType, INIT_SCRIPT, formStart, request, response); } catch (IOException | ServletException e) { LOGGER.error("Unable to initialise form " + resource.getPath(), e); } } }
private String buildUrl(Configuration config, SlingHttpServletRequest request) { final boolean synthetic = ResourceUtil.isSyntheticResource(request.getResource()); final Resource resource = request.getResource(); final StringBuilder builder = new StringBuilder(); final RequestPathInfo pathInfo = request.getRequestPathInfo(); final String resourcePath = pathInfo.getResourcePath(); builder.append(resourcePath); if (pathInfo.getSelectorString() != null) { builder.append('.').append(sanitize(pathInfo.getSelectorString())); } builder.append('.').append(config.getIncludeSelector()); builder.append('.').append(pathInfo.getExtension()); if (synthetic) { builder.append('/').append(resource.getResourceType()); } else { builder.append(sanitize(pathInfo.getSuffix())); } return builder.toString(); }
StringBuilder url = new StringBuilder(); url.append(info.getResourcePath()); if (info.getSelectorString() != null) { url.append('.').append(info.getSelectorString());
if (rpi.getExtension() != null) { if (rpi.getSelectorString() != null) { target.append('.').append(rpi.getSelectorString());
String type = request.getRequestPathInfo().getSelectorString(); if (type != null) { try {
@Nullable private String getRedirectLocation(SlingHttpServletRequest request, long lastModifiedEpoch) { RequestPathInfo requestPathInfo = request.getRequestPathInfo(); if (request.getResource().isResourceType(IMAGE_RESOURCE_TYPE)) { return Joiner.on('.').join(Text.escapePath(request.getContextPath() + requestPathInfo.getResourcePath()), requestPathInfo.getSelectorString(), requestPathInfo.getExtension() + "/" + lastModifiedEpoch, requestPathInfo.getExtension()); } long lastModifiedSuffix = getRequestLastModifiedSuffix(request.getPathInfo()); String resourcePath = lastModifiedSuffix > 0 ? ResourceUtil.getParent(request.getPathInfo()) : request.getPathInfo(); String extension = FilenameUtils.getExtension(resourcePath); if (StringUtils.isNotEmpty(resourcePath)) { if (StringUtils.isNotEmpty(extension)) { resourcePath = resourcePath.substring(0, resourcePath.length() - extension.length() - 1); } return request.getContextPath() + Text.escapePath(resourcePath) + "/" + lastModifiedEpoch + "." + requestPathInfo.getExtension(); } return null; }
Object result = null; try { String action = request.getRequestPathInfo().getSelectorString(); if (action == null) { throw new ServletException("action not provided in url selector");
/** * The externally provided key may be wrapped to add more key elements in order * to restrict the cached object's scope to a specific component when safe mode is enabled. * * @return A request-state sensitive key in {@link Configuration#safeMode()}, the original key otherwise. */ private Object createSafeModeKey(Object key) { // Create a request-state sensitive key to scope the cached model to a request with specific parameters. final SlingHttpServletRequest request = this.requestHolder.get(); if (request == null) { return key; } final RequestPathInfo requestPathInfo = request.getRequestPathInfo(); return new Key(key, new Key(substringBefore(requestPathInfo.getResourcePath(), "/jcr:content"), requestPathInfo.getSelectorString(), requestPathInfo.getExtension(), requestPathInfo.getSuffix(), request.getQueryString())); }
if ( node != null ) { try { if ( req.getRequestPathInfo().getSelectorString() == null || req.getRequestPathInfo().getSelectorString().equals(DOCVIEW) ) { node.getSession().exportDocumentView(node.getPath(), ch, false, false); } else if ( req.getRequestPathInfo().getSelectorString().equals(SYSVIEW) ) {
private void includeResource(SlingHttpServletRequest request, final Bindings bindings, PrintWriter out, Resource includeRes, RequestDispatcherOptions requestDispatcherOptions) { if (includeRes == null) { throw new SightlyException("Resource cannot be null"); } else { if (request.getResource().getPath().equals(includeRes.getPath())) { String requestSelectorString = request.getRequestPathInfo().getSelectorString(); String requestDispatcherAddSelectors = requestDispatcherOptions.getAddSelectors(); if ( (requestSelectorString == null ? requestDispatcherAddSelectors == null : requestSelectorString.equals(requestDispatcherAddSelectors)) && StringUtils.EMPTY.equals(requestDispatcherOptions.getReplaceSelectors()) && (requestDispatcherOptions.getForceResourceType() == null || requestDispatcherOptions.getForceResourceType().equals(request.getResource().getResourceType())) ) { LOGGER.warn("Will not include resource {} since this will lead to a {} exception.", includeRes.getPath(), "org.apache.sling.api.request.RecursionTooDeepException"); return; } } SlingHttpServletResponse customResponse = new PrintWriterResponseWrapper(out, BindingsUtils.getResponse(bindings)); RequestDispatcher dispatcher = request.getRequestDispatcher(includeRes, requestDispatcherOptions); try { if (dispatcher != null) { dispatcher.include(request, customResponse); } else { throw new SightlyException("Failed to include resource " + includeRes.getPath()); } } catch (Exception e) { throw new SightlyException("Failed to include resource " + includeRes.getPath(), e); } } }
try { writer.array(); String type = request.getRequestPathInfo().getSelectorString(); if (type != null) { try {