Package org.apache.sling.api.resource

Examples of org.apache.sling.api.resource.ResourceNotFoundException


                realPathList = new String[] { uri.getPath() };

                logger.debug("resolve: Mapped path is an URL, using new request path {}", requestPath);
            } catch (final URIException use) {
                // TODO: log and fail
                throw new ResourceNotFoundException(absPath);
            }
        }

        // now we have the real path resolved from virtual host mapping
        // this path may be absolute or relative, in which case we try
View Full Code Here


            return;
        }

        final Resource resource = request.getResource();
        if (ResourceUtil.isNonExistingResource(resource)) {
            throw new ResourceNotFoundException("No data to render.");
        }

        // trailing slash on url means directory listing
        if ("/".equals(request.getRequestPathInfo().getSuffix())) {
            renderDirectory(request, response, included);
View Full Code Here

    Item item = jcrSession.getItem(resourcePath);
    if (item != null) {
      resourcePath = item.getPath();
    } else {
      throw new ResourceNotFoundException("Resource is not a JCR Node");
    }

    // Calculate a map of privileges to all the aggregate privileges it is contained in.
    // Use for fast lookup during the mergePrivilegeSets calls below.
        AccessControlManager accessControlManager = AccessControlUtil.getAccessControlManager(jcrSession);
View Full Code Here

        if (jcrSession == null) {
          throw new RepositoryException("JCR Session not found");
        }

          if (resourcePath == null) {
          throw new ResourceNotFoundException("Resource path was not supplied.");
          }

        Item item = jcrSession.getItem(resourcePath);
        if (item != null) {
          resourcePath = item.getPath();
        } else {
          throw new ResourceNotFoundException("Resource is not a JCR Node");
        }

        //load the principalIds array into a set for quick lookup below
      Set<String> pidSet = new HashSet<String>();
      pidSet.addAll(Arrays.asList(principalNamesToDelete));
View Full Code Here

    }
    PrincipalManager principalManager = AccessControlUtil.getPrincipalManager(jcrSession);
    Principal principal = principalManager.getPrincipal(principalId);
   
      if (resourcePath == null) {
      throw new ResourceNotFoundException("Resource path was not supplied.");
      }

    Item item = jcrSession.getItem(resourcePath);
    if (item != null) {
      resourcePath = item.getPath();
    } else {
      throw new ResourceNotFoundException("Resource is not a JCR Node");
    }
   
    // Collect the modified privileges from the request.
    Set<String> grantedPrivilegeNames = new HashSet<String>();
    Set<String> deniedPrivilegeNames = new HashSet<String>();
View Full Code Here

            SlingHttpServletResponse response) throws ServletException,
            IOException {

        // cannot handle the request for missing resources
        if (ResourceUtil.isNonExistingResource(request.getResource())) {
            throw new ResourceNotFoundException(
                request.getResource().getPath(), "No resource found");
        }

        Servlet rendererServlet;
        String ext = request.getRequestPathInfo().getExtension();
View Full Code Here

  protected void doGet(SlingHttpServletRequest request,
      SlingHttpServletResponse response) throws ServletException,
      IOException {
    String propertyName = request.getParameter("property");
    if ("".equals(propertyName) || propertyName == null)
      throw new ResourceNotFoundException("No property specified.");

    ServletOutputStream out = response.getOutputStream();
    Resource resource = request.getResource();
    Node currentNode = resource.adaptTo(Node.class);
    javax.jcr.Property property = null;
    try {
      property = currentNode.getProperty(propertyName);
    } catch (PathNotFoundException e) {
      response.sendError(HttpServletResponse.SC_NOT_FOUND, "Not found.");
      throw new ResourceNotFoundException("Not found.");
    } catch (RepositoryException e) {
      response.sendError(HttpServletResponse.SC_NOT_FOUND, "Not found.");
      throw new ResourceNotFoundException("Not found.");
    }
    InputStream stream = null;
    try {
      if (property == null || property.getType() != PropertyType.BINARY) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND, "Not found.");
        throw new ResourceNotFoundException("Not found.");
      }
      long length = property.getLength();
      if (length > 0) {
        if (length < Integer.MAX_VALUE) {
          response.setContentLength((int) length);
View Full Code Here

            SlingHttpServletResponse response) throws ServletException,
            IOException {

        // cannot handle the request for missing resources
        if (ResourceUtil.isNonExistingResource(request.getResource())) {
            throw new ResourceNotFoundException(
                request.getResource().getPath(), "No Resource found");
        }

        Servlet rendererServlet;
        String ext = request.getRequestPathInfo().getExtension();
View Full Code Here

    protected void doGet(SlingHttpServletRequest req,
            SlingHttpServletResponse resp) throws IOException {
        // Access and check our data
        final Resource r = req.getResource();
        if (r instanceof NonExistingResource) {
            throw new ResourceNotFoundException("No data to dump");
        }

        // Do we have a Property?
        final Property p = r.adaptTo(Property.class);
        if (p != null) {
View Full Code Here

        if (resources == null) {

            // ensure we have an item underlying the request's resource
            Item item = resource.adaptTo(Item.class);
            if (item == null) {
                throw new ResourceNotFoundException("Missing source "
                    + resource + " for " + getOperationName());
            }

            String dstName = trailingSlash ? null : ResourceUtil.getName(dest);
            execute(response, item, dstParent, dstName);
View Full Code Here

TOP

Related Classes of org.apache.sling.api.resource.ResourceNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.