Package com.google.gwt.dev.cfg

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


    for (String moduleName : options.getModuleNames()) {
      TreeLogger loadLogger = getTopLogger().branch(TreeLogger.DEBUG,
          "Bootstrap link for command-line module '" + moduleName + "'");
      try {
        ModuleDef module = loadModule(loadLogger, moduleName, false);
        validateServletTags(loadLogger, servletValidator, module, webXml);
        link(loadLogger, module);
      } catch (UnableToCompleteException e) {
        // Already logged.
        return false;
View Full Code Here


    return "Google Web Toolkit Hosted Mode";
  }

  @Override
  protected boolean initModule(String moduleName) {
    ModuleDef module = modulesByName.get(moduleName);
    if (module == null) {
      getTopLogger().log(
          TreeLogger.WARN,
          "Unknown module requested '"
              + moduleName
              + "'; all active GWT modules must be specified in the command line arguments");
      return false;
    }
    try {
      TreeLogger logger = getTopLogger().branch(TreeLogger.DEBUG,
          "Initializing module '" + module.getName() + "' for hosted mode");
      boolean shouldRefreshPage = false;
      if (module.isGwtXmlFileStale()) {
        shouldRefreshPage = true;
        module = loadModule(logger, module.getCanonicalName(), false);
      }
      link(logger, module);
      return shouldRefreshPage;
    } catch (UnableToCompleteException e) {
      // Already logged.
View Full Code Here

   * Overridden to keep our map up to date.
   */
  @Override
  protected ModuleDef loadModule(TreeLogger logger, String moduleName,
      boolean refresh) throws UnableToCompleteException {
    ModuleDef module = super.loadModule(logger, moduleName, refresh);
    modulesByName.put(module.getName(), module);
    return module;
  }
View Full Code Here

    String partialPath = parts.partialPath;
    String moduleName = parts.moduleName;

    // If the module is renamed, substitute the renamed module name
    ModuleDef moduleDef = loadedModulesByName.get(moduleName);
    if (moduleDef != null) {
      moduleName = moduleDef.getName();
    }

    if (partialPath == null) {
      // Redir back to the same URL but ending with a slash.
      //
View Full Code Here

      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);
      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

   * @throws UnableToCompleteException
   */
  protected ModuleDef loadModule(TreeLogger logger, String moduleName,
      boolean refresh) throws UnableToCompleteException {
    refresh &= alreadySeenModules.contains(moduleName);
    ModuleDef moduleDef = ModuleDefLoader.loadFromClassPath(logger, moduleName,
        refresh);
    alreadySeenModules.add(moduleName);
    assert (moduleDef != null) : "Required module state is absent";
    return moduleDef;
  }
View Full Code Here

        Cursor waitCursor = display.getSystemCursor(SWT.CURSOR_WAIT);
        widgetShell.setCursor(waitCursor);

        // Try to find an existing loaded version of the module def.
        //
        ModuleDef moduleDef = loadModule(logger, moduleName, true);
        assert (moduleDef != null);

        TypeOracle typeOracle = moduleDef.getTypeOracle(logger);
        ShellModuleSpaceHost host = doCreateShellModuleSpaceHost(
            getTopLogger(), typeOracle, moduleDef);
        return host;
      } finally {
        Cursor normalCursor = display.getSystemCursor(SWT.CURSOR_ARROW);
View Full Code Here

        options.setWorkDir(Utility.makeTemporaryDirectory(null, "gwtc"));
        tempWorkDir = true;
      }

      for (String moduleName : options.getModuleNames()) {
        ModuleDef module = ModuleDefLoader.loadFromClassPath(logger,
            moduleName, true);
        File compilerWorkDir = options.getCompilerWorkDir(moduleName);

        if (options.isValidateOnly()) {
          if (!Precompile.validate(logger, options, module,
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.