Package org.structr.rest.resource

Examples of org.structr.rest.resource.ViewFilterResource


        boolean found = false;
       
        // check views first
        if (propertyViews.contains(part)) {
       
          Resource resource = new ViewFilterResource();
          resource.checkAndConfigure(part, securityContext, request);
          resource.configureIdProperty(defaultIdProperty);
          resource.configurePropertyView(propertyView);
         
          resourceChain.add(resource);
         
          // mark this part as successfully parsed
          found = true;
         
        } else {

          // look for matching pattern
          for (Map.Entry<Pattern, Class<? extends Resource>> entry : resourceMap.entrySet()) {

            Pattern pattern = entry.getKey();
            Matcher matcher = pattern.matcher(pathParts[i]);

            if (matcher.matches()) {

              Class<? extends Resource> type = entry.getValue();
              Resource resource              = null;

              try {

                // instantiate resource constraint
                resource = type.newInstance();
              } catch (Throwable t) {

                logger.log(Level.WARNING, "Error instantiating resource class", t);

              }

              if (resource != null) {

                // set security context
                resource.setSecurityContext(securityContext);

                if (resource.checkAndConfigure(part, securityContext, request)) {

                  logger.log(Level.FINE, "{0} matched, adding resource of type {1} for part {2}", new Object[] { matcher.pattern(), type.getName(),
                    part });

                  // allow constraint to modify context
                  resource.configurePropertyView(propertyView);
                  resource.configureIdProperty(defaultIdProperty);

                  // add constraint and go on
                  resourceChain.add(resource);

                  found = true;
View Full Code Here


   * @return finalResource
   * @throws FrameworkException
   */
  public static Resource optimizeNestedResourceChain(final List<Resource> resourceChain, final PropertyKey defaultIdProperty) throws FrameworkException {

    ViewFilterResource view = null;
    int num                 = resourceChain.size();
    boolean found           = false;

    do {

View Full Code Here

TOP

Related Classes of org.structr.rest.resource.ViewFilterResource

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.