Examples of FallbackFetcher


Examples of org.stringtree.fetcher.FallbackFetcher

  }

  public void setup(StringFinder context, Fetcher tracts, Fetcher templates) {
    Fetcher oldTemplates = (Fetcher)context.getObject(Templater.TEMPLATE);
    if (oldTemplates != null) {
      templates = new FallbackFetcher(
            templates, oldTemplates);
    } else {
      templates = oldTemplates;
    }
View Full Code Here

Examples of org.stringtree.fetcher.FallbackFetcher

        page = new MapTract("Oops, 404: ${mojasef.request.path.URI}");
        StorerHelper.put(context, HTTPConstants.RESPONSE_CODE, "404");
    }

    StringFinder result = new FetcherStringFinder(
        new FallbackFetcher(page.getUnderlyingFetcher(), context.getUnderlyingFetcher()));
    Tract template = findTemplate(result);
    engine.expandTemplate(context, template, collector);
    collector.flush();
  }
View Full Code Here

Examples of org.stringtree.fetcher.FallbackFetcher

        return context.get(MojasefConstants.REQUEST_PATHOBJECT);
  }

  public static StringFinder createSubcontext(StringFinder context, String path, String mountpoint) {
      MapFetcher repository = new MapFetcher();
      Fetcher subcontext = new FallbackFetcher(repository, context.getUnderlyingFetcher());
      repository.put(MojasefConstants.MOUNTCONTEXT, getMountContext(context));
      repository.put(MojasefConstants.MOUNTPOINT, mountpoint);
        repository.put(MojasefConstants.REQUEST_LOCALPATH, path);
      return new FetcherStringKeeper(subcontext);
  }
View Full Code Here

Examples of org.stringtree.fetcher.FallbackFetcher

          fetchers.add(new TractURLFetcher(url));
        } else {
            fetchers.add(new BytesURLFetcher(url));
        }
      }
      return new FallbackFetcher(fetchers);
    }
View Full Code Here

Examples of org.stringtree.fetcher.FallbackFetcher

            System.err.println("Server.appCall unable to locate " + MojasefConstants.HTTP_APPLICATION);
        }
    }
   
    public void request(RequestContext req, OutputCollector res, Object dfl) {
        Fetcher context = new FallbackFetcher(req, common);
       
        try {
            Object file = null;
            res.start();
            String leaf = (String)context.getObject(MojasefConstants.REQUEST_LOCALPATH);
            if (leaf.indexOf(".") > 0) {
                Fetcher pub = (Fetcher)context.getObject(MojasefConstants.FILE_FETCHER);
                file = pub.getObject(leaf);
            }
            if (file != null) {
                String type = mimetype(leaf);
                req.put(HTTPConstants.RESPONSE_CONTENT_TYPE, type);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.