Package play.vfs

Examples of play.vfs.VirtualFile


     * Load Model instances from a YAML file and persist them using the underlying persistence mechanism.
     * The format of the YAML file is constrained, see the Fixtures manual page
     * @param name Name of a YAML file somewhere in the classpath (or conf/)
     */
    public static void loadModels(String name) {
        VirtualFile yamlFile = null;
        try {
            for (VirtualFile vf : Play.javaPath) {
                yamlFile = vf.child(name);
                if (yamlFile != null && yamlFile.exists()) {
                    break;
                }
            }
            if (yamlFile == null) {
                throw new RuntimeException("Cannot load fixture " + name + ", the file was not found");
View Full Code Here


        return (T)loadYaml(name, yaml);
    }

    @SuppressWarnings("unchecked")
    public static <T> T loadYaml(String name, Yaml yaml) {
        VirtualFile yamlFile = null;
        try {
            for (VirtualFile vf : Play.javaPath) {
                yamlFile = vf.child(name);
                if (yamlFile != null && yamlFile.exists()) {
                    break;
                }
            }
            InputStream is = Play.classloader.getResourceAsStream(name);
            if (is == null) {
View Full Code Here

                serialized.put(prefix + "." + key.toString(), r);
            } else if (value instanceof String && value.toString().matches("<<<\\s*\\{[^}]+}\\s*")) {
                Matcher m = Pattern.compile("<<<\\s*\\{([^}]+)}\\s*").matcher(value.toString());
                m.find();
                String file = m.group(1);
                VirtualFile f = Play.getVirtualFile(file);
                if (f != null && f.exists()) {
                    serialized.put(prefix + "." + key.toString(), new String[]{f.contentAsString()});
                }
            } else {
                serialized.put(prefix + "." + key.toString(), new String[]{value.toString()});
            }
        }
View Full Code Here

    // in test
    String nodeGroupConfFileLocation = "conf/"
        + configFile.toString().toLowerCase(Locale.ENGLISH) + ".conf";
    try {

      VirtualFile vf = VirtualFile
          .fromRelativePath(nodeGroupConfFileLocation);
      File realFile = vf.getRealFile();

      FileReader fr = new FileReader(realFile);
      BufferedReader reader = new BufferedReader(fr);
      String line = null;
View Full Code Here

    // in test
    String nodeGroupConfFileLocation = "conf/"
        + configFile.toString().toLowerCase(Locale.ENGLISH) + ".conf";
    try {

      VirtualFile vf = VirtualFile
          .fromRelativePath(nodeGroupConfFileLocation);
      File realFile = vf.getRealFile();

      boolean append = false;
      FileWriter fw = new FileWriter(realFile, append);
      fw.write(configFileContent);
View Full Code Here

    // Play.configuration.getProperty("agentmaster.nodegroup.conf.file.location");

    // in test
    try {

      VirtualFile vf = VirtualFile
          .fromRelativePath(ConfUtils.nodeGroupConfFileLocation);
      File realFile = vf.getRealFile();

      FileReader fr = new FileReader(realFile);
      BufferedReader reader = new BufferedReader(fr);
      String line = null;
View Full Code Here

    // Play.configuration.getProperty("agentmaster.agentcommand.conf.file.location");

    // in test
    try {

      VirtualFile vf = VirtualFile
          .fromRelativePath(ConfUtils.agentCommandConfFileLocation);
      File realFile = vf.getRealFile();

      FileReader fr = new FileReader(realFile);
      BufferedReader reader = new BufferedReader(fr);
      String line = null;
      String requestContentLine = null;
View Full Code Here

    // Play.configuration.getProperty("agentmaster.aggregation.conf.file.location");

    // in test
    try {

      VirtualFile vf = VirtualFile
          .fromRelativePath(ConfUtils.aggregationConfFileLocation);
      File realFile = vf.getRealFile();

      FileReader fr = new FileReader(realFile);
      BufferedReader reader = new BufferedReader(fr);
      String line = null;
      String requestContentLine = null;
View Full Code Here

  public synchronized void updateCommonHttpHeaderFromConf() {

    // in test
    try {

      VirtualFile vf = VirtualFile
          .fromRelativePath(ConfUtils.httpHeaderConfFileLocation);
      File realFile = vf.getRealFile();

      FileReader fr = new FileReader(realFile);
      BufferedReader reader = new BufferedReader(fr);
      String httpHeaderType = null;
      String line = null;
View Full Code Here

        HttpResponse nettyResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.valueOf(response.status));
        if (exposePlayServer) {
            nettyResponse.setHeader(SERVER, signature);
        }
        try {
            VirtualFile file = Play.getVirtualFile(renderStatic.file);
            if (file != null && file.exists() && file.isDirectory()) {
                file = file.child("index.html");
                if (file != null) {
                    renderStatic.file = file.relativePath();
                }
            }
            if ((file == null || !file.exists())) {
                serve404(new NotFound("The file " + renderStatic.file + " does not exist"), ctx, request, nettyRequest);
            } else {
                boolean raw = Play.pluginCollection.serveStatic(file, Request.current(), Response.current());
                if (raw) {
                    copyResponse(ctx, request, response, nettyRequest);
                } else {
                    final File localFile = file.getRealFile();
                    final boolean keepAlive = isKeepAlive(nettyRequest);
                    nettyResponse = addEtag(nettyRequest, nettyResponse, localFile);

                    if (nettyResponse.getStatus().equals(HttpResponseStatus.NOT_MODIFIED)) {
View Full Code Here

TOP

Related Classes of play.vfs.VirtualFile

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.