Package com.medallia.spider.StaticResources

Examples of com.medallia.spider.StaticResources.StaticResource


 
  private final Date boot = Clock.now();
 
  /** serve static resources, e.g. images and css that do not have any dynamic component */
  private boolean serveStatic(String uri, HttpServletResponse res) throws IOException {
    StaticResource staticResource = staticResourceLookup.findStaticResource(uri);
    if (staticResource != null) {
      if (staticResource.exists()) {
        res.setHeader("Content-Type", staticResource.getMimeType());
        res.setDateHeader("Date", boot.getTime());       
        HttpHeaders.addCacheForeverHeaders(res);
        staticResource.copyTo(res.getOutputStream());
      } else {
        res.sendError(404);
        log.warn("Requested resource not found: " + uri);
      }
      return true;
View Full Code Here


    this.srl = srl;
  }

  @Implement public String render(StringTemplate st) {
    String resourceName = String.valueOf(st.getAttribute("it"));
    StaticResource sr = srl.findStaticResource(resourceName);
   
    if (sr != null) {
      // copy into buffer and calculate md5
      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
      try {
        sr.copyTo(buffer);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
     
      // create and return link
View Full Code Here

 
  private final Date boot = Clock.now();
 
  /** serve static resources, e.g. images and css that do not have any dynamic component */
  private boolean serveStatic(String uri, HttpServletResponse res) throws IOException {
    StaticResource staticResource = staticResourceLookup.findStaticResource(uri);
    if (staticResource != null) {
      if (staticResource.exists()) {
        res.setHeader("Content-Type", staticResource.getMimeType());
        res.setDateHeader("Date", boot.getTime());       
        HttpHeaders.addCacheForeverHeaders(res);
        staticResource.copyTo(res.getOutputStream());
      } else {
        res.sendError(404);
        log.warn("Requested resource not found: " + uri);
      }
      return true;
View Full Code Here

TOP

Related Classes of com.medallia.spider.StaticResources.StaticResource

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.