throw new ResourceNotFoundException("Resource path was not supplied."); resourcePath = item.getPath(); } else { throw new ResourceNotFoundException("Resource is not a JCR Node");
response.sendError(HttpServletResponse.SC_NOT_FOUND); } catch (ResourceNotFoundException rnfe) { response.sendError(HttpServletResponse.SC_NOT_FOUND, rnfe.getMessage()); } catch (Throwable throwable) { log.debug("Exception while handling GET "
throw new ResourceNotFoundException("Resource path was not supplied."); resourcePath = item.getPath(); } else { throw new ResourceNotFoundException("Resource is not a JCR Node");
} catch (ResourceNotFoundException rnfe) { htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND, rnfe.getMessage()); } catch (final Exception exception) { log.warn("Exception while handling POST "
resourcePath = item.getPath(); } else { throw new ResourceNotFoundException("Resource is not a JCR Node");
rnfe.getMessage()); } catch (Throwable throwable) { log.debug("Exception while handling POST "
private CheckedConsumer<ResourceResolver> updateMetadata(FileOrRendition file) { return (rr) -> { if (dryRunMode) { return; } long lineNumber = fileData.getRowNum(file.getProperties()); Actions.setCurrentItem(String.format("Metadata %s (line %s)", file.getItemName(), lineNumber)); commitAndRefresh(rr); Resource metaResource = rr.getResource(file.getNodePath(preserveFileName) + "/jcr:content/metadata"); if (metaResource == null) { throw new ResourceNotFoundException("Unable to find asset resource " + file.getNodePath(preserveFileName)); } updateMetadataFromRow(file, metaResource.adaptTo(ModifiableValueMap.class)); }; }
throw new ResourceNotFoundException("No data to render.");
throw new ResourceNotFoundException( request.getResource().getPath(), "No resource found");
} catch (final URIException use) { throw new ResourceNotFoundException(absPath);
private void importRenditions(FileOrRendition file, ActionManager manager) { file.getRenditions().forEach((rendition, renditionFile) -> { manager.deferredWithResolver(Actions.retry(retries, retryPause, rr -> { try { long lineNumber = fileData.getRowNum(renditionFile.getProperties()); manager.setCurrentItem(String.format("Rendition %s (line %s)", renditionFile.getItemName(), lineNumber)); String renditionName = rendition; String type = mimetypeService.getMimeType(renditionFile.getName()); String extension = renditionFile.getName().substring(renditionFile.getName().lastIndexOf('.') + 1).toLowerCase(); if (renditionName.lastIndexOf('.') <= 0) { renditionName += "." + extension; } if (!dryRunMode) { commitAndRefresh(rr); Resource assetResource = rr.getResource(file.getNodePath(preserveFileName)); if (assetResource == null) { throw new ResourceNotFoundException("Unable to find asset resource " + file.getNodePath(preserveFileName)); } Asset asset = assetResource.adaptTo(Asset.class); asset.addRendition(renditionName, renditionFile.getSource().getStream(), type); } incrementCount(importedRenditions, 1L); incrementBytes(importedData, renditionFile.getSource().getLength()); trackDetailedActivity(file.getNodePath(preserveFileName), "Import Rendition", "Add rendition " + renditionName, renditionFile.getSource().getLength()); } finally { renditionFile.getSource().close(); } })); }); }
throw new ResourceNotFoundException("No data to render.");
throw new ResourceNotFoundException("No data to render.");
public void render(SlingHttpServletRequest req, SlingHttpServletResponse resp) throws IOException { final Resource r = req.getResource(); if (ResourceUtil.isNonExistingResource(r)) { throw new ResourceNotFoundException("No data to render."); } /* * TODO if(srd != null) { renderSyntheticResource(req, resp, srd); * return; } */ resp.setContentType(req.getResponseContentType()); resp.setCharacterEncoding("UTF-8"); final PrintWriter pw = resp.getWriter(); @SuppressWarnings("unchecked") final Map<String,Object> map = r.adaptTo(Map.class); if ( map != null ) { dump(pw, r, map); } else if ( r.adaptTo(String.class) != null ) { printPropertyValue(pw, r.getName(), r.adaptTo(String.class), false); } else if ( r.adaptTo(String[].class) != null ) { printPropertyValue(pw, r.getName(), r.adaptTo(String[].class), false); } else { resp.sendError(HttpServletResponse.SC_NO_CONTENT); } }
throw new ResourceNotFoundException("No data to render.");