Package com.google.gwt.dev.cfg

Examples of com.google.gwt.dev.cfg.ModuleDef


      logger = logger.branch(TreeLogger.TRACE, "Request " + id + ": " + url,
          null);
    }

    String servletClassName = null;
    ModuleDef moduleDef = null;

    try {
      // Attempt to split the URL into module/path, which we'll use to see
      // if we can map the request to a module's servlet.
      RequestParts parts = new RequestParts(request);

      if ("favicon.ico".equalsIgnoreCase(parts.moduleName)) {
        sendErrorResponse(response, HttpServletResponse.SC_NOT_FOUND,
            "Icon not available");
        return;
      }

      // See if the request references a module we know.
      moduleDef = getModuleDef(logger, parts.moduleName);
      if (moduleDef != null) {
        // Okay, we know this module. Do we know this servlet path?
        // It is right to prepend the slash because (1) ModuleDefSchema requires
        // every servlet path to begin with a slash and (2) RequestParts always
        // rips off the leading slash.
        String servletPath = "/" + parts.partialPath;
        servletClassName = moduleDef.findServletForPath(servletPath);

        // Fall-through below, where we check servletClassName.
      } else {
        // Fall-through below, where we check servletClassName.
      }
    } catch (UnableToCompleteException e) {
      // Do nothing, since it was speculative anyway.
    }

    // BEGIN BACKWARD COMPATIBILITY
    if (servletClassName == null) {
      // Try to map a bare path that isn't preceded by the module name.
      // This is no longer the recommended practice, so we warn.
      String path = request.getPathInfo();
      moduleDef = modulesByServletPath.get(path);
      if (moduleDef != null) {
        // See if there is a servlet we can delegate to for the given url.
        servletClassName = moduleDef.findServletForPath(path);

        if (servletClassName != null) {
          TreeLogger branch = logger.branch(TreeLogger.WARN,
              "Use of deprecated hosted mode servlet path mapping", null);
          branch.log(
              TreeLogger.WARN,
              "The client code is invoking the servlet with a URL that is not module-relative: "
                  + path, null);
          branch.log(
              TreeLogger.WARN,
              "Prepend GWT.getModuleBaseURL() to the URL in client code to create a module-relative URL: /"
                  + moduleDef.getName() + path, null);
          branch.log(
              TreeLogger.WARN,
              "Using module-relative URLs ensures correct URL-independent behavior in external servlet containers",
              null);
        }
View Full Code Here


    URL foundResource = null;
    try {
      // Look for the requested file on the public path.
      //
      ModuleDef moduleDef = getModuleDef(logger, moduleName);
      if (shouldAutoGenerateResources()) {
        Resource publicResource = moduleDef.findPublicFile(partialPath);
        if (publicResource != null) {
          foundResource = publicResource.getURL();
        }

        if (foundResource == null) {
View Full Code Here

   * We don't actually log this on purpose since the client does anyway.
   */
  private ModuleDef getModuleDef(TreeLogger logger, String moduleName)
      throws UnableToCompleteException {
    synchronized (loadedModulesByName) {
      ModuleDef moduleDef = loadedModulesByName.get(moduleName);
      if (moduleDef == null) {
        moduleDef = ModuleDefLoader.loadFromClassPath(logger, moduleName, false);
        loadedModulesByName.put(moduleName, moduleDef);
        loadedModulesByName.put(moduleDef.getName(), moduleDef);

        // BEGIN BACKWARD COMPATIBILITY
        // The following map of servlet path to module is included only
        // for backward-compatibility. We are going to remove this functionality
        // when we go out of beta. The new behavior is that the client should
        // specify the module name as part of the URL and construct it using
        // getModuleBaseURL().
        String[] servletPaths = moduleDef.getServletPaths();
        for (int i = 0; i < servletPaths.length; i++) {
          modulesByServletPath.put(servletPaths[i], moduleDef);
        }
        // END BACKWARD COMPATIBILITY
      }
View Full Code Here

  protected ModuleDef maybeCompileModuleImpl(String moduleName,
      String syntheticModuleName, Strategy strategy,
      BatchingStrategy batchingStrategy, TreeLogger treeLogger)
      throws UnableToCompleteException {

    ModuleDef moduleDef = maybeCompileModuleImpl2(moduleName,
        syntheticModuleName, strategy, treeLogger);

    // Add all test blocks for the module if we haven't seen this module before.
    if (!compiledModuleNames.contains(syntheticModuleName)) {
      compiledModuleNames.add(syntheticModuleName);
View Full Code Here

      throws UnableToCompleteException {
    /*
     * Synthesize a synthetic module that derives from the user-specified module
     * but also includes JUnit support.
     */
    ModuleDef moduleDef = ModuleDefLoader.createSyntheticModule(treeLogger,
        syntheticModuleName, new String[]{
            moduleName, strategy.getModuleInherit()}, false);

    // Replace any user entry points with our test runner.
    moduleDef.clearEntryPoints();
    moduleDef.addEntryPointTypeName(GWTRunner.class.getName());

    // Squirrel away the name of the active module for GWTRunnerGenerator
    ConfigurationProperty moduleNameProp = moduleDef.getProperties().createConfiguration(
        "junit.moduleName", false);
    moduleNameProp.setValue(syntheticModuleName);

    strategy.processModule(moduleDef);

View Full Code Here

        modulesToCompile.add(curModuleName);
      }
    }

    // Compile the requested module if needed.
    ModuleDef moduleDef = preCompiledModuleDefs.get(syntheticModuleName);
    if (moduleDef == null) {
      moduleDef = maybeCompileModuleImpl(moduleName, syntheticModuleName,
          strategy, batchingStrategy, treeLogger);
    }
    return moduleDef;
View Full Code Here

  protected ModuleDef maybeCompileModuleImpl(String moduleName,
      String syntheticModuleName, Strategy strategy,
      BatchingStrategy batchingStrategy, TreeLogger treeLogger)
      throws UnableToCompleteException {
    modulesToCompile.remove(syntheticModuleName);
    ModuleDef moduleDef = super.maybeCompileModuleImpl(moduleName,
        syntheticModuleName, strategy, batchingStrategy, treeLogger);
    preCompiledModuleDefs.put(syntheticModuleName, moduleDef);
    return moduleDef;
  }
View Full Code Here

      preCompiledModuleDefs = new HashMap<String, ModuleDef>();
      for (String moduleName : GWTTestCase.getAllTestModuleNames()) {
        TestModuleInfo moduleInfo = GWTTestCase.getTestsForModule(moduleName);
        String syntheticModuleName = moduleInfo.getSyntheticModuleName();
        if (syntheticModuleName != null) {
          ModuleDef moduleDef = maybeCompileModuleImpl(
              moduleInfo.getModuleName(), syntheticModuleName,
              moduleInfo.getStrategy(), batchingStrategy, treeLogger);
          preCompiledModuleDefs.put(syntheticModuleName, moduleDef);
        }
      }
View Full Code Here

    assert typeOracle != null : "Load a module first";
    return typeOracle.findType(name);
  }

  private ModuleDef loadModule(String moduleName) throws Exception {
    ModuleDef moduleDef = ModuleDefLoader.loadFromClassPath(getLogger(),
        moduleName, true);
    assert moduleDef != null : "Required module state is absent";
    return moduleDef;
  }
View Full Code Here

  }

  void compileForWebMode(String moduleName, String... userAgents)
      throws UnableToCompleteException {
    // Never fresh during JUnit.
    ModuleDef module = ModuleDefLoader.loadFromClassPath(getTopLogger(),
        moduleName, false);
    if (userAgents != null && userAgents.length > 0) {
      Properties props = module.getProperties();
      Property userAgent = props.find("user.agent");
      if (userAgent instanceof BindingProperty) {
        BindingProperty bindingProperty = (BindingProperty) userAgent;
        bindingProperty.setAllowedValues(bindingProperty.getRootCondition(),
            userAgents);
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.cfg.ModuleDef

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.