Examples of FileContent


Examples of ch.entwine.weblounge.common.content.file.FileContent

      DispatchUtils.sendNotModified(request, response);
      return true;
    }

    // Add mime type header
    FileContent content = fileResource.getContent(language);

    // If the content is hosted externally, send a redirect and be done with it
    if (content.getExternalLocation() != null) {
      try {
        response.sendRedirect(content.getExternalLocation().toExternalForm());
      } catch (IOException e) {
        logger.debug("Client ignore redirect to {}", content.getExternalLocation());
      }
      return true;
    }

    String contentType = content.getMimetype();
    if (contentType == null)
      contentType = MediaType.APPLICATION_OCTET_STREAM;

    // Set the content type
    String characterEncoding = response.getCharacterEncoding();
    if (StringUtils.isNotBlank(characterEncoding))
      response.setContentType(contentType + "; charset=" + characterEncoding.toLowerCase());
    else
      response.setContentType(contentType);

    // Browser caches and proxies are allowed to keep a copy
    response.setHeader("Cache-Control", "public, max-age=" + revalidationTime);

    // Add last modified header
    response.setDateHeader("Last-Modified", ResourceUtils.getModificationDate(fileResource, language).getTime());

    // Add ETag header
    String eTag = ResourceUtils.getETagValue(fileResource);
    response.setHeader("ETag", eTag);

    // Set the Expires header
    response.setDateHeader("Expires", expirationDate);

    // Add content disposition header
    response.setHeader("Content-Disposition", "inline; filename=" + content.getFilename());

    // Add content size
    response.setHeader("Content-Length", Long.toString(content.getSize()));

    // Write the file back to the response
    InputStream fileContents = null;
    try {
      fileContents = contentRepository.getContent(fileURI, language);
View Full Code Here

Examples of com.google.api.client.http.FileContent

    public static com.google.api.services.drive.model.File genericFileToGoogleDriveFile(GenericFile<?> file, Exchange exchange) throws Exception {      
        if (file.getFile() instanceof File) {
            File f = (File) file.getFile();
            com.google.api.services.drive.model.File fileMetadata = new com.google.api.services.drive.model.File();
            fileMetadata.setTitle(f.getName());
            FileContent mediaContent = new FileContent(null, f);
            if (exchange != null) {
                exchange.getIn().setHeader("CamelGoogleDrive.content", fileMetadata);
                exchange.getIn().setHeader("CamelGoogleDrive.mediaContent", mediaContent);
            }
            return fileMetadata;
View Full Code Here

Examples of com.google.code.mojo.license.util.FileContent

        }
    }

    private void createParser() {
        if (parser == null) {
            parser = new HeaderParser(new FileContent(file, encoding), headerDefinition, keywords);
        }
    }
View Full Code Here

Examples of com.google.code.mojo.license.util.FileContent

        }
    }

    public void parseHeader() {
        if (parser == null) {
            parser = new HeaderParser(new FileContent(file, encoding), headerDefinition, keywords);
        }
    }
View Full Code Here

Examples of com.google.code.mojo.license.util.FileContent

        }
    }

    public void parseHeader() {
        if (parser == null) {
            parser = new HeaderParser(new FileContent(file, encoding), headerDefinition, keywords);
        }
    }
View Full Code Here

Examples of com.google.code.mojo.license.util.FileContent

        }
    }

    private void createParser() {
        if (parser == null) {
            parser = new HeaderParser(new FileContent(file, encoding), headerDefinition);
        }
    }
View Full Code Here

Examples of com.google.code.mojo.license.util.FileContent

        }
    }

    private void createParser() {
        if (parser == null) {
            parser = new HeaderParser(new FileContent(file, encoding), headerDefinition, keywords);
        }
    }
View Full Code Here

Examples of com.google.code.mojo.license.util.FileContent

        }
    }

    public void parseHeader() {
        if (parser == null) {
            parser = new HeaderParser(new FileContent(file, encoding), headerDefinition, keywords);
        }
    }
View Full Code Here

Examples of com.google.code.mojo.license.util.FileContent

        }
    }

    private void createParser() {
        if (parser == null) {
            parser = new HeaderParser(new FileContent(file, encoding), headerDefinition);
        }
    }
View Full Code Here

Examples of com.google.code.mojo.license.util.FileContent

*/
public final class HeaderParserTest {

    @Test
    public void test_no_header() throws Exception {
        HeaderParser parser = new HeaderParser(new FileContent(new File("src/test/resources/doc/doc1.txt"), System.getProperty("file.encoding")),
                HeaderType.TEXT.getDefinition(), new String[]{"copyright"});
        assertFalse(parser.gotAnyHeader());
    }
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.