Package org.bladerunnerjs.model

Examples of org.bladerunnerjs.model.ParsedContentPath


  public void simpleRequest() throws MalformedRequestException
  {
    builder.accepts("request").as("content-form");
    parser = builder.build();
   
    ParsedContentPath request = parser.parse("request");
    assertEquals("1a", 0, request.properties.size());
  }
View Full Code Here


  public void dualOptionRequest() throws MalformedRequestException
  {
    builder.accepts("request-one").as("request-one-form").and("request-two").as("request-two-form");
    parser = builder.build();
   
    ParsedContentPath request = parser.parse("request-one");
    assertEquals("1a", 0, request.properties.size());
   
    request = parser.parse("request-two");
    assertEquals("1a", 0, request.properties.size());
  }
View Full Code Here

  public void requestContainingParametersIsProcessedCorrectly() throws MalformedRequestException
  {
    builder.accepts("request/<token1>/<token2>").as("content-form").where("token1").hasForm("[0-9]+").and("token2").hasForm("[a-z]+");
    parser = builder.build();
   
    ParsedContentPath request = parser.parse("request/33/foo");
    assertEquals("1a", 2, request.properties.size());
    assertEquals("1b", "33", request.properties.get("token1"));
    assertEquals("1c", "foo", request.properties.get("token2"));
  }
View Full Code Here

    builder
      .accepts("<token1>/<token2>").as("content-form")
      .where("token1").hasForm("foo(bar)?")
        .and("token2").hasForm("baz");
    parser = builder.build();
    ParsedContentPath contentPath = parser.parse("foo/baz");
   
    assertEquals("foo", contentPath.properties.get("token1"));
    assertEquals("baz", contentPath.properties.get("token2"));
  }
View Full Code Here

  @Test
  public void specialCharactersAreDecodedBeforeParsing() throws MalformedRequestException
  {
    builder.accepts("<name>").as("content-form").where("name").hasForm(".*");
    parser = builder.build();
    ParsedContentPath parsedContent = parser.parse("some%20path");
    assertEquals("some path", parsedContent.properties.get("name"));
  }
View Full Code Here

        List<String> requestPaths = (contentPath.formName.equals(DEV_BUNDLE_REQUEST)) ? contentPlugin.getValidDevContentPaths(bundleSet) :
          contentPlugin.getValidProdContentPaths(bundleSet);
        ContentPathParser contentPathParser = contentPlugin.getContentPathParser();
       
        for(String requestPath : requestPaths) {
          ParsedContentPath parsedContentPath = contentPathParser.parse(requestPath);
          inputSources.add( new InputSource(parsedContentPath, contentPlugin, bundleSet, contentAccessor, version) );
        }
      }
    }
    catch (MalformedRequestException e) {
View Full Code Here

      if(requestMatcher.lookingAt())
      {
        if ((requestMatcher.start() == 0) && (requestMatcher.end() == request.length()))
        {
          ParsedContentPath contentPath = new ParsedContentPath(requestFormName);
          List<String> tokens = requestFormTokens.get(requestFormName);

          for (int gi = 0; gi < requestMatcher.groupCount() && gi < tokens.size(); ++gi)
          {
            String property = requestMatcher.group(gi + 1);
View Full Code Here

  public boolean canHandleLogicalRequest(String requestPath)
  {
    boolean canHandleRequest = getContentPathParser().canParseRequest(requestPath);
    if (canHandleRequest) {
      ParsedContentPath parsedRequest = parseRequest(requestPath);
      if (parsedRequest.formName.equals(UNVERSIONED_BUNDLE_REQUEST)) {
        /* since unversioned requests (/myApp/somePlugin/file.txt) could also be a request to a custom servlet
         * if the request type is an unversioned bundle request we must first check that a content plugin can ultimately handle it
         */
        String contentPath = parsedRequest.properties.get("content-path");
View Full Code Here

      throw new RuntimeException(ex);
    }
  }
 
  public ResponseContent handleLogicalRequest(String requestPath, UrlContentAccessor contentAccessor) throws MalformedRequestException, ResourceNotFoundException, ContentProcessingException, ModelOperationException {
    ParsedContentPath parsedContentPath = parseRequest(requestPath);
    Map<String, String> pathProperties = parsedContentPath.properties;
    String aspectName = getAspectName(requestPath, pathProperties);

    String devVersion = app.root().getAppVersionGenerator().getDevVersion();
View Full Code Here

      throw new ResourceNotFoundException("No content provider could be found found the logical request path '" + logicalRequestpath + "'");
    }
   
    logger.debug(Messages.BUNDLER_IDENTIFIED_MSG, contentProvider.getPluginClass().getSimpleName(), logicalRequestpath);
   
    ParsedContentPath contentPath = contentProvider.getContentPathParser().parse(logicalRequestpath);
    return contentProvider.handleRequest(contentPath, bundleSet, contentAccessor, version);
  }
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.model.ParsedContentPath

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.