Package org.exoplatform.web.application.javascript

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


        //
        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()) {
            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 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

        //
        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

      return (modeState != NORMAL_MODE);
   }

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

        }
        final boolean isDebugEnabled = log.isDebugEnabled();
        if (isDebugEnabled) {
            log.debug("About to serve '"+ resourcePath +"'");
        }
        JavascriptConfigService service = (JavascriptConfigService) PortalContainer.getComponent(JavascriptConfigService.class);
        StaticScriptResource r = service.getStaticScriptResource(resourcePath);
        if (r != null) {
            if (isDebugEnabled) {
                log.debug("Found the context '"+ r.getContextPath() +"' for '"+ resourcePath +"'");
            }
View Full Code Here

* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
*/
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) {
            if (key.minified) {
View Full Code Here

        if (name == null) {
            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()) {
                    if (res.isNativeAmd()) {
                        /* Require scopeless id for native AMD modules. They are implicitly SHARED
                         * and baseUrl of requirejs ends with SHARED. Therefore there is no need
                         * to prepend the scope to the name here. */
                        require(res.getId().getName());
View Full Code Here

TOP

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

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.