Package org.emrys.webosgi.core.resource.extension

Examples of org.emrys.webosgi.core.resource.extension.ResFolder


        }
      }
    }

    if (res instanceof ResFolder) {
      ResFolder resFolder = ((ResFolder) res);
      List<ResFilter> filters = resFolder.getFilter();

      if ((quickID != null && quickID.length() > 0 && reqPath
          .equals(new Path(res.getQuickID()).toPortableString()))
          || reqPath.equals(newAliasPath)) {

        // check if folder browse allowed???
        IResourceVisitController visitController = (IResourceVisitController) threadScope
            .get().get(RESPONSE_CUR_VISIT_CTRL);
        if (visitController != null
            && !visitController.canBrowseFolder(req)) {
          // Buffer the status marking that a folder be found.
          threadScope.get().put(RESPONSE_IS_FOLDER, Boolean.TRUE);
          return true;
        }

        File resolvedFolder = null;
        // Get file from resolver.
        if (res.getResolver() != null)
          resolvedFolder = res.getResolver().resolve(req, path,
              alias, quickID);

        // Case the folder report to large, here create a temporary file
        // to store the
        // content.
        File tmpFile;
        FileOutputStream fout;
        try {
          tmpFile = File.createTempFile("FolderRep"
              + Thread.currentThread().getId(), "tmp");
          fout = new FileOutputStream(tmpFile);

          PrintWriter writer = new PrintWriter(new BufferedWriter(
              new OutputStreamWriter(fout, TEXT_CHARSET)));
          List<BaseResource> subReses = resFolder.getResources();
          if (subReses.size() > 0) {
            for (BaseResource r : subReses) {
              String childAlias = r.getAlias();
              if (childAlias == null)
                childAlias = r.getPath();
View Full Code Here


  private void reportVirtualRes(BaseResource res, PrintWriter writer,
      IPath parentAliasPath, IPath rawReqPath, IPath parentLocalPath,
      List<ResFilter> filters) {
    if (!(res instanceof ResFolder))
      return;
    ResFolder resFolder = (ResFolder) res;

    HttpServletRequest req = (HttpServletRequest) threadScope.get().get(
        RESPONSE_REQ);
    String path = resFolder.getPath();
    if (path == null || path.length() == 0)
      return;

    String alias = res.getAlias();
    String quickID = res.getQuickID();

    if (alias == null || alias.length() == 0)
      alias = path;

    IPath newAliasPath = parentAliasPath.append(alias);
    IPath newLocalPath = parentLocalPath.append(path);

    File resolvedFolder = null;
    // Get file from resolver.
    if (res.getResolver() != null)
      resolvedFolder = res.getResolver().resolve(req, path, alias,
          quickID);

    List<BaseResource> subReses = resFolder.getResources();
    if (resolvedFolder == null && subReses != null && subReses.size() > 0) {
      for (BaseResource r : subReses) {
        String childAlias = r.getAlias();
        if (childAlias == null)
          childAlias = r.getPath();
View Full Code Here

   * @return
   */
  public DefinesRoot registerWebContextRoot(Bundle bundle, String wabCtxPath,
      String rootPath) {
    DefinesRoot root = new DefinesRoot();
    ResFolder webContentFoler = new ResFolder();
    webContentFoler.setPath(wabCtxPath);
    webContentFoler.setAlias(wabCtxPath);
    IPublishedFileResolver resolver = new BundleWebContentFileResolver(
        bundle, rootPath);
    webContentFoler.setResolverID(resolver.getClass().getName());
    webContentFoler.setResolver(resolver);
    root.getResResolvers().put(resolver.getClass().getName(), resolver);
    root.getResources().add(webContentFoler);
    root.setSourceBundle(bundle);
    root.setName(wabCtxPath);
    root.setId(bundle.getSymbolicName());
View Full Code Here

TOP

Related Classes of org.emrys.webosgi.core.resource.extension.ResFolder

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.