Package ratpack.file

Examples of ratpack.file.FileSystemBinding


    // TODO - validate the path isn't escaping up with ../
  }

  public void handle(Context context) {
    FileSystemBinding parentBinding = context.get(FileSystemBinding.class);
    FileSystemBinding binding = parentBinding.binding(path);
    if (binding == null) {
      context.clientError(404);
    } else {
      context.insert(Registries.just(FileSystemBinding.class, binding), handler);
    }
View Full Code Here


  @Provides
  @Singleton
  GroovyTemplateRenderingEngine provideGroovyTemplateRenderingEngine(LaunchConfig launchConfig, Config config) {
    String templatesPath = config.getTemplatesPath();
    FileSystemBinding templateDir = launchConfig.getBaseDir().binding(templatesPath);
    if (templateDir == null) {
      throw new IllegalStateException("templatesPath '" + templatesPath + "' is outside the file system binding");
    }

    return new GroovyTemplateRenderingEngine(
View Full Code Here

  @Singleton
  TemplateLoader provideTemplateLoader(LaunchConfig launchConfig) {
    String path = templatesPath == null ? launchConfig.getOther("handlebars.templatesPath", "handlebars") : templatesPath;
    String suffix = templatesSuffix == null ? launchConfig.getOther("handlebars.templatesSuffix", ".hbs") : templatesSuffix;

    FileSystemBinding templatesBinding = launchConfig.getBaseDir().binding(path);
    return new FileSystemBindingTemplateLoader(templatesBinding, suffix);
  }
View Full Code Here

TOP

Related Classes of ratpack.file.FileSystemBinding

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.