Package org.wymiwyg.commons.util.dirbrowser

Examples of org.wymiwyg.commons.util.dirbrowser.PathNode


   * @return {@link PathNode}
   */
  @GET
  @Path("{path:.+}")
  public PathNode getStaticFile(@PathParam("path") String path) {
    final PathNode node = fileServer.getNode(path);
    logger.debug("Serving static {}", node);
    return node;
  }
View Full Code Here


    if (slashPos == -1) {
      childMap.put(subPath, new ValueNode(path+"/"+subPath, data));
    } else {
      String subPath1 = subPath.substring(0, slashPos);
      String subPath2 = subPath.substring(slashPos+1);
      PathNode directChild = childMap.get(subPath1);
      if (directChild == null) {
        directChild = new Hierarchy(path+"/"+subPath1);
        childMap.put(subPath1, directChild);
      } else {
        if (!(directChild instanceof Hierarchy)) {
View Full Code Here

  private LanguageService languageService;
 
  protected void activate(ComponentContext context) throws IOException, URISyntaxException {
    Bundle bundle = context.getBundleContext().getBundle();
    URL resourceDir = getClass().getResource("staticweb");
    PathNode pathNode = new BundlePathNode(bundle, resourceDir.getPath());

    fileServer = new FileServer(pathNode);

    URL template = getClass().getResource("language-list.ssp");
    renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
View Full Code Here

    return responseBuilder.build();
  }

  private byte[] createOfflineSite(String baseUri, String targetUri,
      String rootLinkPrefix, List<String> formatExtensions) throws IOException {
    PathNode baseNode = createFileHierarchy(baseUri, baseUri, targetUri, rootLinkPrefix,
        formatExtensions);
    PathNode allHostsNode = createFileHierarchy(Constants.ALL_HOSTS_URI_PREFIX+"/",
        baseUri,targetUri, rootLinkPrefix, formatExtensions);
    PathNode rootNode = new MultiPathNode(allHostsNode, baseNode);
    try {
      return ZipCreationUtil.createZip(rootNode);
    } catch (IOException ex) {
      throw new WebApplicationException(ex);
    }
View Full Code Here

   * @param componentContext
   */
  protected void activate(ComponentContext context) {
    Bundle bundle = context.getBundleContext().getBundle();
    URL resourceDir = getClass().getResource("staticweb");
    PathNode pathNode = new BundlePathNode(bundle, resourceDir.getPath());
    logger.debug("Initializing file server for {} ({})", resourceDir,
        resourceDir.getFile());
    fileServer = new FileServer(pathNode);
  }
View Full Code Here

  }

  @GET
  @Path("2/{path:.+}")
  public PathNode getYui2File(@PathParam("path") String path) {
    final PathNode node = fileServer.getNode("2/"+path);
    logger.debug("Serving static {}", node);
    return node;
  }
View Full Code Here

  }
 
  @GET
  @Path("3/{path:.+}")
  public PathNode getYui3File(@PathParam("path") String path) {
    final PathNode node = fileServer.getNode("3/"+path);
    logger.debug("Serving static {}", node);
    return node;
  }
View Full Code Here

public class TestFileServer {

  @Test
  public void testGetResource() throws IOException {
    URL testRoot = getClass().getResource("test-root");
    PathNode pathNode = PathNodeFactory.getPathNode(testRoot);
    FileServer fileServer = new FileServer(pathNode);
    PathNode file = fileServer.getNode("dir/subdir/file.txt");
    Assert.assertEquals(PathNodeFactory.
        getPathNode(getClass().
        getResource("test-root/dir/subdir/file.txt")).getPath(), file.getPath());

  }
View Full Code Here

  @Path("{path:.*}")
  @GET
  public PathNode getNode(@PathParam("path") String path) {
    String[] pathSections = path.split("/");
    PathNode current = getRootNode();
    for (String pathSection : pathSections) {
      current = current.getSubPath(pathSection);
      if (!current.exists()) {
        throw new WebApplicationException(404);
      }
    }
    return current;

View Full Code Here

    }
    updateFileServer();
  }

  private void registerStaticFiles(Bundle bundle) {
    PathNode pathNode = new BundlePathNode(bundle, "META-INF/static-web");
    bundleNodeMap.put(bundle, pathNode);
  }
View Full Code Here

TOP

Related Classes of org.wymiwyg.commons.util.dirbrowser.PathNode

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.