Package org.exoplatform.web.application.javascript

Examples of org.exoplatform.web.application.javascript.JavascriptConfigService$NormalizeJSReader


        //
        FetchMap<ResourceId> requiredResources = jsMan.getScriptResources();
        log.debug("Resource ids to resolve: {}", requiredResources);

        //
        JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
        Map<String, Boolean> ret = new LinkedHashMap<String, Boolean>();
        Map<String, Boolean> tmp = new LinkedHashMap<String, Boolean>();
        Map<ScriptResource, FetchMode> resolved = service.resolveIds(requiredResources);
        for (ScriptResource rs : resolved.keySet()) {
            ResourceId id = rs.getId();
            //SHARED/bootstrap should be loaded first
            if (ResourceScope.SHARED.equals(id.getScope()) && "bootstrap".equals(id.getName())) {
                ret.put(id.toString(), false);
View Full Code Here


        return ret;
    }

    public JSONObject getJSConfig() throws Exception {
        JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
        PortalRequestContext prc = PortalRequestContext.getCurrentInstance();
        return service.getJSConfig(prc.getControllerContext(), prc.getLocale());
    }
View Full Code Here

        //
        FetchMap<ResourceId> requiredResources = jsMan.getScriptResources();
        log.debug("Resource ids to resolve: {}", requiredResources);

        //
        JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
        LinkedHashMap<String, Boolean> ret = new LinkedHashMap<String, Boolean>();
        Map<ScriptResource, FetchMode> tmp = service.resolveIds(requiredResources);
        for (ScriptResource rs : tmp.keySet()) {
            ResourceId id = rs.getId();
            boolean isRemote = !rs.isEmpty() && rs.getModules().get(0) instanceof Module.Remote;
            ret.put(id.toString(), isRemote);
        }
View Full Code Here

        return ret;
    }

    public JSONObject getJSConfig() throws Exception {
        JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
        StandaloneAppRequestContext context = WebuiRequestContext.getCurrentInstance();
        return service.getJSConfig(context.getControllerContext(), context.getLocale());
    }
View Full Code Here

        //
        FetchMap<ResourceId> requiredResources = jsMan.getScriptResources();
        log.debug("Resource ids to resolve: {}", requiredResources);

        //
        JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
        Map<String, Boolean> ret = new LinkedHashMap<String, Boolean>();
        Map<String, Boolean> tmp = new LinkedHashMap<String, Boolean>();
        Map<ScriptResource, FetchMode> resolved = service.resolveIds(requiredResources);
        for (ScriptResource rs : resolved.keySet()) {
            if (!rs.isNativeAmd()) {
                ResourceId id = rs.getId();
                // SHARED/bootstrap should be loaded first
                if (ResourceScope.SHARED.equals(id.getScope()) && "bootstrap".equals(id.getName())) {
View Full Code Here

     * Return a map of GMD resource ids and their URLs that point to ResourceRequestHandler.
     * this map will be used by GateIn JS module loader (currently, it is requirejs)
     * @throws Exception
     */
    public JSONObject getJSConfig() throws Exception {
        JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
        PortalRequestContext prc = PortalRequestContext.getCurrentInstance();
        return service.getJSConfig(prc.getControllerContext(), prc.getLocale());
    }
View Full Code Here

   }

   protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,
      IOException
   {
      JavascriptConfigService service =
         (JavascriptConfigService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
            JavascriptConfigService.class);

      // Julien: should we also set charset along with the content type ?
      response.setContentType("application/x-javascript");
      ServletOutputStream stream = response.getOutputStream();
      service.writeMergedJavascript(stream);
   }
View Full Code Here

      return (modeState != NORMAL_MODE);
   }

   public Collection<String> getJavascriptURLs()
   {
      JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
      return service.getAvailableScriptsPaths();
   }
View Full Code Here

      {
         throw new IllegalArgumentException("name can't be null");
      }
      ResourceId id = new ResourceId(scope, name);
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      JavascriptConfigService service = (JavascriptConfigService)container.getComponentInstanceOfType(JavascriptConfigService.class);
      ScriptResource resource = service.getResource(id);
      if (resource != null)
      {
         if (FetchMode.IMMEDIATE.equals(resource.getFetchMode()))
         {
            resourceIds.add(id, null);        
         }
         else
         {
            Map<ResourceId, FetchMode> tmp = new HashMap<ResourceId, FetchMode>();
            tmp.put(id, null);
            for (ScriptResource res : service.resolveIds(tmp).keySet())
            {
               require(res.getId().toString());
            }
         }        
      }
View Full Code Here

class ScriptLoader implements Loader<ScriptKey, ScriptResult, ControllerContext>
{

   public ScriptResult retrieve(ControllerContext context, ScriptKey key) throws Exception
   {
      JavascriptConfigService service = (JavascriptConfigService) PortalContainer.getComponent(JavascriptConfigService.class);

      //
      Reader script = service.getScript(key.id, key.locale);
      String sourceName = key.id.getScope() + "/" + key.id.getName() + ".js";

      //
      if (script != null)
      {
View Full Code Here

TOP

Related Classes of org.exoplatform.web.application.javascript.JavascriptConfigService$NormalizeJSReader

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.