From 94f5ae33fd1240a6133f8ca2e430759cd807ff8d Mon Sep 17 00:00:00 2001 From: projsaha Date: Thu, 10 Jul 2014 22:27:25 +0530 Subject: [PATCH] jaggr-web and non-osgi sample - Implementation of review comments --- jaggr-web/src/META-INF/MANIFEST.MF | 3 + ...bm.jaggr.core.modulebuilder.IModuleBuilder | 19 + ...m.ibm.jaggr.core.resource.IResourceFactory | 20 + ...om.ibm.jaggr.core.transport.IHttpTransport | 15 + .../ibm/jaggr/web/PlatformServicesImpl.java | 123 +++++++ .../ibm/jaggr/web/ServiceReferenceWeb.java | 36 ++ .../ibm/jaggr/web/ServiceRegistrationWeb.java | 36 ++ .../ibm/jaggr/web/impl/AggregatorImpl.java | 344 ++++++++++++++++++ .../ibm/jaggr/web/impl/config/ConfigImpl.java | 140 +++++++ .../web/impl/transport/DojoHttpTransport.java | 27 ++ .../WebContent/META-INF/MANIFEST.MF | 3 + .../WebContent/WEB-INF/aggrConfig.js | 53 +++ .../classes/jaggrWeb/js/loaderConfig.js | 95 +++++ ...ulebuilder.css.CSSModuleBuilder.properties | 16 + ...ebuilder.i18n.I18nModuleBuilder.properties | 16 + ...ascript.JavaScriptModuleBuilder.properties | 16 + ...ebuilder.less.LessModuleBuilder.properties | 16 + ...ebuilder.text.TextModuleBuilder.properties | 16 + ...source.ClasspathResourceFactory.properties | 16 + ...pl.resource.FileResourceFactory.properties | 16 + ...mpl.resource.JarResourceFactory.properties | 16 + ...mpl.transport.DojoHttpTransport.properties | 17 + jaggr-webSample/WebContent/WEB-INF/web.xml | 45 +++ jaggr-webSample/WebContent/test.html | 90 +++++ 24 files changed, 1194 insertions(+) create mode 100644 jaggr-web/src/META-INF/MANIFEST.MF create mode 100644 jaggr-web/src/META-INF/services/com.ibm.jaggr.core.modulebuilder.IModuleBuilder create mode 100644 jaggr-web/src/META-INF/services/com.ibm.jaggr.core.resource.IResourceFactory create mode 100644 jaggr-web/src/META-INF/services/com.ibm.jaggr.core.transport.IHttpTransport create mode 100644 jaggr-web/src/com/ibm/jaggr/web/PlatformServicesImpl.java create mode 100644 jaggr-web/src/com/ibm/jaggr/web/ServiceReferenceWeb.java create mode 100644 jaggr-web/src/com/ibm/jaggr/web/ServiceRegistrationWeb.java create mode 100644 jaggr-web/src/com/ibm/jaggr/web/impl/AggregatorImpl.java create mode 100644 jaggr-web/src/com/ibm/jaggr/web/impl/config/ConfigImpl.java create mode 100644 jaggr-web/src/com/ibm/jaggr/web/impl/transport/DojoHttpTransport.java create mode 100644 jaggr-webSample/WebContent/META-INF/MANIFEST.MF create mode 100644 jaggr-webSample/WebContent/WEB-INF/aggrConfig.js create mode 100644 jaggr-webSample/WebContent/WEB-INF/classes/jaggrWeb/js/loaderConfig.js create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.css.CSSModuleBuilder.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.i18n.I18nModuleBuilder.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.javascript.JavaScriptModuleBuilder.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.less.LessModuleBuilder.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.text.TextModuleBuilder.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.ClasspathResourceFactory.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.FileResourceFactory.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.JarResourceFactory.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.web.impl.transport.DojoHttpTransport.properties create mode 100644 jaggr-webSample/WebContent/WEB-INF/web.xml create mode 100644 jaggr-webSample/WebContent/test.html diff --git a/jaggr-web/src/META-INF/MANIFEST.MF b/jaggr-web/src/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/jaggr-web/src/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.modulebuilder.IModuleBuilder b/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.modulebuilder.IModuleBuilder new file mode 100644 index 00000000..6b44bde3 --- /dev/null +++ b/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.modulebuilder.IModuleBuilder @@ -0,0 +1,19 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +com.ibm.jaggr.core.impl.modulebuilder.i18n.I18nModuleBuilder +com.ibm.jaggr.core.impl.modulebuilder.javascript.JavaScriptModuleBuilder +com.ibm.jaggr.core.impl.modulebuilder.css.CSSModuleBuilder +com.ibm.jaggr.core.impl.modulebuilder.text.TextModuleBuilder +com.ibm.jaggr.core.impl.modulebuilder.less.LessModuleBuilder \ No newline at end of file diff --git a/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.resource.IResourceFactory b/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.resource.IResourceFactory new file mode 100644 index 00000000..2efea238 --- /dev/null +++ b/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.resource.IResourceFactory @@ -0,0 +1,20 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +com.ibm.jaggr.core.impl.resource.FileResourceFactory +com.ibm.jaggr.core.impl.resource.ClasspathResourceFactory +com.ibm.jaggr.core.impl.resource.JarResourceFactory + + + diff --git a/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.transport.IHttpTransport b/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.transport.IHttpTransport new file mode 100644 index 00000000..5f44ced1 --- /dev/null +++ b/jaggr-web/src/META-INF/services/com.ibm.jaggr.core.transport.IHttpTransport @@ -0,0 +1,15 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +com.ibm.jaggr.web.impl.transport.DojoHttpTransport diff --git a/jaggr-web/src/com/ibm/jaggr/web/PlatformServicesImpl.java b/jaggr-web/src/com/ibm/jaggr/web/PlatformServicesImpl.java new file mode 100644 index 00000000..6a2c31f3 --- /dev/null +++ b/jaggr-web/src/com/ibm/jaggr/web/PlatformServicesImpl.java @@ -0,0 +1,123 @@ +/* + * © Copyright IBM Corp. 2013 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.ibm.jaggr.web; + +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +import com.ibm.jaggr.core.IPlatformServices; +import com.ibm.jaggr.core.IServiceReference; +import com.ibm.jaggr.core.IServiceRegistration; + +public class PlatformServicesImpl implements IPlatformServices { + + private Map serviceReferenceMap; + + public PlatformServicesImpl() { + //But this will be a problem if we ever try to support a command console + //because the console communicates with the aggregator instances that are registered in the service registry, + //and for that to work, the service registry has to be a global object. + serviceReferenceMap = new ConcurrentHashMap(); + } + + @Override + public IServiceRegistration registerService(String clazz, Object service, Dictionary properties) { + StringBuilder sb = new StringBuilder(); + String uniqueKey = sb.append(clazz).append("_") //$NON-NLS-1$ + .append(service.getClass().getName()).toString(); + if (!serviceReferenceMap.containsKey(uniqueKey)) { + Object[] serviceDetails = new Object[3]; + serviceDetails[0] = clazz; + serviceDetails[1] = service; + serviceDetails[2] = properties; + serviceReferenceMap.put(uniqueKey, serviceDetails); + } + IServiceRegistration serviceRegistation = new ServiceRegistrationWeb(uniqueKey, this); + + return serviceRegistation; + } + + + public void unRegisterService(Object serviceRegistration) { + if (serviceReferenceMap.containsKey((String) serviceRegistration)) { + serviceReferenceMap.remove((String) serviceRegistration); + return; + } + } + + @Override + public IServiceReference[] getServiceReferences(String clazz, String filter) { + return getServiceReferences(clazz); + } + + public IServiceReference[] getServiceReferences(String clazz) { + ArrayList serviceReferences = new ArrayList(); + Set srs = serviceReferenceMap.keySet(); + for(String sr : srs){ + int index = ((String) sr).indexOf("_"); //$NON-NLS-1$ + String clz = ((String) sr).substring(0, index); + if(clz.equalsIgnoreCase(clazz) || clazz == null){ + serviceReferences.add(new ServiceReferenceWeb(sr)); + } + } + IServiceReference[] serviceRefs = new IServiceReference[serviceReferences.size()]; + for(int i = 0; i < serviceReferences.size(); i++){ + serviceRefs[i] = serviceReferences.get(i); + } + return serviceRefs; + } + + @Override + public Object getService(IServiceReference serviceReference) { + Object[] serviceDetails = null; + serviceDetails = (Object[])(serviceReferenceMap.get((String)serviceReference.getPlatformObject())); + return serviceDetails[1]; + } + + @Override + public synchronized boolean ungetService(IServiceReference serviceReference) { + boolean status = false; + if(serviceReferenceMap.containsKey((String)serviceReference.getPlatformObject())){ + serviceReferenceMap.remove((String)serviceReference.getPlatformObject()); + status = true; + return status; + } + return status; + } + + @Override + public URL getResource(String resourceName) { + return null; + } + + @Override + public Dictionary getHeaders() { + return null; + } + + @Override + public URI getAppContextURI() throws URISyntaxException { + return null; + } + +} diff --git a/jaggr-web/src/com/ibm/jaggr/web/ServiceReferenceWeb.java b/jaggr-web/src/com/ibm/jaggr/web/ServiceReferenceWeb.java new file mode 100644 index 00000000..c2289e76 --- /dev/null +++ b/jaggr-web/src/com/ibm/jaggr/web/ServiceReferenceWeb.java @@ -0,0 +1,36 @@ +/* + * © Copyright IBM Corp. 2013 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.ibm.jaggr.web; + +import com.ibm.jaggr.core.IServiceReference; + +public class ServiceReferenceWeb implements IServiceReference { + + String serviceReference = null; + + + public ServiceReferenceWeb(String serviceRef){ + serviceReference = serviceRef; + } + + @Override + public Object getPlatformObject(){ + return serviceReference; + + } + +} diff --git a/jaggr-web/src/com/ibm/jaggr/web/ServiceRegistrationWeb.java b/jaggr-web/src/com/ibm/jaggr/web/ServiceRegistrationWeb.java new file mode 100644 index 00000000..b19b97fa --- /dev/null +++ b/jaggr-web/src/com/ibm/jaggr/web/ServiceRegistrationWeb.java @@ -0,0 +1,36 @@ +/* + * © Copyright IBM Corp. 2013 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.ibm.jaggr.web; + +import com.ibm.jaggr.core.IServiceRegistration; + +public class ServiceRegistrationWeb implements IServiceRegistration { + + String ServiceRegistration = null; + PlatformServicesImpl platformServices = null; + + public ServiceRegistrationWeb(String serviceRegistrationWeb, PlatformServicesImpl platformServicesWeb){ + ServiceRegistration = serviceRegistrationWeb; + platformServices = platformServicesWeb; + } + + @Override + public void unregister() { + platformServices.unRegisterService(ServiceRegistration); + } + +} diff --git a/jaggr-web/src/com/ibm/jaggr/web/impl/AggregatorImpl.java b/jaggr-web/src/com/ibm/jaggr/web/impl/AggregatorImpl.java new file mode 100644 index 00000000..2412656e --- /dev/null +++ b/jaggr-web/src/com/ibm/jaggr/web/impl/AggregatorImpl.java @@ -0,0 +1,344 @@ +/* + * (C) Copyright 2012, IBM Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.ibm.jaggr.web.impl; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URL; +import java.util.Collections; +import java.util.Enumeration; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; +import java.util.ServiceLoader; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; + +import org.eclipse.core.runtime.CoreException; + +import com.ibm.jaggr.core.InitParams; +import com.ibm.jaggr.core.InitParams.InitParam; +import com.ibm.jaggr.core.NotFoundException; +import com.ibm.jaggr.core.config.IConfig; +import com.ibm.jaggr.core.deps.IDependencies; +import com.ibm.jaggr.core.executors.IExecutors; +import com.ibm.jaggr.core.impl.AggregatorExtension; +import com.ibm.jaggr.core.impl.OverrideFoldersTreeWalker; +import com.ibm.jaggr.core.impl.deps.DependenciesImpl; +import com.ibm.jaggr.core.impl.executors.ExecutorsImpl; +import com.ibm.jaggr.core.impl.options.OptionsImpl; +import com.ibm.jaggr.core.modulebuilder.IModuleBuilder; +import com.ibm.jaggr.core.options.IOptions; +import com.ibm.jaggr.core.resource.IResourceFactory; +import com.ibm.jaggr.core.transport.IHttpTransport; +import com.ibm.jaggr.web.PlatformServicesImpl; +import com.ibm.jaggr.web.impl.config.ConfigImpl; + +/** + * Implementation for IAggregator and HttpServlet interfaces. + * + * Note that despite the fact that HttpServlet (which this class extends) + * implements Serializable, attempts to serialize instances of this class will + * fail due to the fact that not all instance data is serializable. The + * assumption is that because instances of this class are created by the OSGi + * Framework, and the framework itself does not support serialization, then no + * attempts will be made to serialize instances of this class. + */ +@SuppressWarnings("serial") +public class AggregatorImpl extends com.ibm.jaggr.core.impl.AbstractAggregatorImpl { + + protected static final String RESOURCE_FACTORY = "com.ibm.jaggr.resourcefactory"; //$NON-NLS-1$ + protected static final String DEFAULT_RESOURCEFACTORIES = "com.ibm.jaggr.core.default.resourcefactories"; //$NON-NLS-1$ + protected static final String MODULE_BUILDER = "com.ibm.jaggr.modulebuilder"; //$NON-NLS-1$ + protected static final String DEFAULT_MODULEBUILDERS = "com.ibm.jaggr.core.default.modulebuilders"; //$NON-NLS-1$ + protected static final String HTTP_TRANSPORT = "com.ibm.jaggr.httptransport"; //$NON-NLS-1$ + protected static final String DEFAULT_HTTPTRANSPORT = "com.ibm.jaggr.core.dojo.httptransport"; //$NON-NLS-1$ + private static final Logger log = Logger.getLogger(AggregatorImpl.class.getName()); + + protected ServletContext servletContext = null; + protected ExecutorsImpl ex = null; + protected OptionsImpl op = null; + private File workdir = null; + + @Override + public File getWorkingDirectory() { + return workdir; + } + + public void setInitializationData() { + final String sourceMethod = "setInitializationData"; //$NON-NLS-1$ + boolean isTraceLogging = log.isLoggable(Level.FINER); + if (isTraceLogging) { + log.entering(AggregatorImpl.class.getName(), sourceMethod); + } + try { + + servletContext = getServletContext(); + name = getAggregatorName(); + initParams = getInitParamsFromServletConfig(); + op = new OptionsImpl(true, this); + ex = new ExecutorsImpl(op); + workdir = initWorkingDirectory(); + initExtensions(); + IConfig config = newConfig(); + + // Check last-modified times of resources in the overrides folders. + // These resources + // are considered to be dynamic in a production environment and we + // want to + // detect new/changed resources in these folders on startup so that + // we can clear + // caches, etc. + OverrideFoldersTreeWalker walker = new OverrideFoldersTreeWalker( + this, config); + walker.walkTree(); + deps = newDependencies(walker.getLastModifiedJS()); + cacheMgr = newCacheManager(walker.getLastModified()); + this.config = config; + // Notify listeners + notifyConfigListeners(1); + + // bundleContext.addBundleListener(this); + } catch (Exception e) { + if (log.isLoggable(Level.SEVERE)) { + log.log(Level.SEVERE, e.getMessage(), e); + } + } + if (isTraceLogging) { + log.exiting(AggregatorImpl.class.getName(), sourceMethod); + } + } + + /** + * Returns the name for this aggregator + *

+ * This method is called during aggregator intialization. Subclasses may + * override this method to initialize the aggregator using a different name. + * Use the public {@link AggregatorImpl#getName()} method to get the name of + * an initialized aggregator. + * + * @param configElem + * The configuration element. + * @return The aggregator name + */ + + public String getAggregatorName() { + // trim leading and trailing '/' + String alias = getInitParameter("alias");//$NON-NLS-1$ + while (alias.charAt(0) == '/') + alias = alias.substring(1); + while (alias.charAt(alias.length() - 1) == '/') + alias = alias.substring(0, alias.length() - 1); + return alias; + } + + /** + * Returns the init params for this aggregator + *

+ * This method is called during aggregator intialization. Subclasses may + * override this method to initialize the aggregator using different init + * params. Use the public {@link AggregatorImpl#getInitParams()} method to + * get the init params for an initialized aggregator. + * + * @param configElem + * The configuration element. + * @return The init params + */ + + public InitParams getInitParamsFromServletConfig() { + + List initParams = new LinkedList(); + Enumeration strs = getInitParameterNames(); + while (strs.hasMoreElements()) { + String name = strs.nextElement(); + String value = getInitParameter(name); + if (!(name.equals("alias"))) { //$NON-NLS-1$ + initParams.add(new InitParam(name, value)); + } + } + return new InitParams(initParams); + } + + /** + * Loads and initializes the resource factory, module builder and http + * transport extensions specified in the configuration element for this + * aggregator + * + * @param configElem + * The configuration element + * @throws CoreException + * @throws NotFoundException + */ + protected void initExtensions() throws NotFoundException { + /* + * Init the resource factory extensions + */ + final String sourceMethod = "initExtensions"; //$NON-NLS-1$ + boolean isTraceLogging = log.isLoggable(Level.FINER); + if (isTraceLogging) { + log.entering(AggregatorImpl.class.getName(), sourceMethod); + } + initResourceFactoryExtension(); + initModuleBuilderExtension(); + initHttpTransportExtension(); + + ExtensionRegistrar reg = new ExtensionRegistrar(); + callExtensionInitializers(getExtensions(null), reg); + reg.closeRegistration(); + if (isTraceLogging) { + log.exiting(AggregatorImpl.class.getName(), sourceMethod); + } + } + + @Override + public IOptions getOptions() { + return op; + } + + @Override + public IExecutors getExecutors() { + return ex; + } + + + public ServletContext getAggregatorServletContext(){ + return servletContext; + } + + @Override + protected IDependencies newDependencies(long stamp) { + return new DependenciesImpl(this, stamp); + } + + @Override + public IDependencies getDependencies() { + return (IDependencies) deps; + } + + /** + * Returns the working directory for this aggregator. + *

+ * This method is called during aggregator intialization. Subclasses may + * override this method to initialize the aggregator using a different + * working directory. Use the public {@link #getWorkingDirectory()} method + * to get the working directory from an initialized aggregator. + * + * @param configElem + * The configuration element. Not used by this class but provided + * for use by subclasses. + * @return The {@code File} object for the working directory + * @throws FileNotFoundException + */ + protected File initWorkingDirectory() { + File tmpDir = (File) getServletContext().getAttribute( + "javax.servlet.context.tempdir"); //$NON-NLS-1$ + if (log.isLoggable(Level.INFO)) { + log.log(Level.INFO, tmpDir.getPath()); + } + return tmpDir; + + + } + + public void initResourceFactoryExtension() throws NotFoundException { + final String sourceMethod = "initResourceFactoryExtension"; //$NON-NLS-1$ + boolean isTraceLogging = log.isLoggable(Level.FINER); + if (isTraceLogging) { + log.entering(AggregatorImpl.class.getName(), sourceMethod); + } + ServiceLoader resourceFactoryLoader = ServiceLoader.load(IResourceFactory.class); + for (IResourceFactory resourceFactory : resourceFactoryLoader) { + Properties props = getExtensionPointProperties(resourceFactory); + registerExtension(new AggregatorExtension(resourceFactory, + props,new InitParams(Collections.emptyList()), "com.ibm.jaggr.service.resourcefactory", //$NON-NLS-1$ + DEFAULT_RESOURCEFACTORIES), null); + } + if (isTraceLogging) { + log.exiting(AggregatorImpl.class.getName(), sourceMethod); + } + } + + public void initModuleBuilderExtension() throws NotFoundException { + final String sourceMethod = "initModuleBuilderExtension"; //$NON-NLS-1$ + boolean isTraceLogging = log.isLoggable(Level.FINER); + if (isTraceLogging) { + log.entering(AggregatorImpl.class.getName(), sourceMethod); + } + ServiceLoader moduleBuilderLoader = ServiceLoader.load(IModuleBuilder.class); + for (IModuleBuilder moduleBuilder : moduleBuilderLoader) { + Properties props = getExtensionPointProperties(moduleBuilder); + registerExtension(new AggregatorExtension(moduleBuilder, + props,new InitParams(Collections.emptyList()), "com.ibm.jaggr.service.modulebuilder", //$NON-NLS-1$ + DEFAULT_MODULEBUILDERS), null); + } + if (isTraceLogging) { + log.exiting(AggregatorImpl.class.getName(), sourceMethod); + } + } + + + + + public void initHttpTransportExtension() throws NotFoundException { + final String sourceMethod = "initHttpTransportExtension"; //$NON-NLS-1$ + boolean isTraceLogging = log.isLoggable(Level.FINER); + if (isTraceLogging) { + log.entering(AggregatorImpl.class.getName(), sourceMethod); + } + ServiceLoader httpTransportLoader = ServiceLoader.load(IHttpTransport.class); + for (IHttpTransport httpTransport : httpTransportLoader) { + Properties props = getExtensionPointProperties(httpTransport); + registerExtension(new AggregatorExtension(httpTransport, + props,new InitParams(Collections.emptyList()), "com.ibm.jaggr.service.httptransport", //$NON-NLS-1$ + DEFAULT_HTTPTRANSPORT), null); + } + if (isTraceLogging) { + log.exiting(AggregatorImpl.class.getName(), sourceMethod); + } + } + + public Properties getExtensionPointProperties(Object object){ + Properties prop = new Properties(); + try { + URL propUrl = this.getAggregatorServletContext().getResource("/WEB-INF/extensionPointsConf/" + object.getClass().getName() + ".properties"); //$NON-NLS-1$ //$NON-NLS-2$ + prop.load(propUrl.openStream()); + } catch (Exception e) { + if (log.isLoggable(Level.SEVERE)) { + log.log(Level.SEVERE, e.getMessage(), e); + } + } + return prop; + + } + + @Override + public void init(ServletConfig servletConfig) throws ServletException { + super.init(servletConfig); + platformServices = new PlatformServicesImpl(); + setInitializationData(); + } + + protected IConfig newConfig() throws IOException { + return new ConfigImpl(this); + } + +} diff --git a/jaggr-web/src/com/ibm/jaggr/web/impl/config/ConfigImpl.java b/jaggr-web/src/com/ibm/jaggr/web/impl/config/ConfigImpl.java new file mode 100644 index 00000000..38f4eed5 --- /dev/null +++ b/jaggr-web/src/com/ibm/jaggr/web/impl/config/ConfigImpl.java @@ -0,0 +1,140 @@ +/* + * (C) Copyright 2012, IBM Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.ibm.jaggr.web.impl.config; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.util.Collection; +import java.util.Enumeration; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.mozilla.javascript.Context; +import org.mozilla.javascript.Scriptable; + +import com.ibm.jaggr.core.IAggregator; +import com.ibm.jaggr.core.InitParams; + +public class ConfigImpl extends com.ibm.jaggr.core.impl.config.ConfigImpl { + private static final Logger log = Logger.getLogger(ConfigImpl.class.getName()); + protected Scriptable overrideConfig; + + public ConfigImpl(IAggregator aggregator) throws IOException { + super(aggregator); + } + + /** + * Initializes and returns the URI to the server-side config JavaScript + * + * @return The config URI + * @throws URISyntaxException + * @throws FileNotFoundException + * @throws + */ + + @Override + protected URI loadConfigUri() throws URISyntaxException, + FileNotFoundException { + URI configUri = null; + URL configUrl = null; + Collection configNames = getAggregator().getInitParams() + .getValues(InitParams.CONFIG_INITPARAM); + if (configNames.size() != 1) { + throw new IllegalArgumentException(InitParams.CONFIG_INITPARAM); + } + String configName = configNames.iterator().next(); + + try { + configUrl = ((com.ibm.jaggr.web.impl.AggregatorImpl) this.getAggregator()) + .getAggregatorServletContext().getResource( + "/WEB-INF/" + configName); //$NON-NLS-1$ + } catch (MalformedURLException e1) { + if (log.isLoggable(Level.SEVERE)) { + log.log(Level.SEVERE, e1.getMessage(), e1); + } + } + try { + configUri = new URI(configUrl.toString()); + } catch (URISyntaxException e) { + if (log.isLoggable(Level.SEVERE)) { + log.log(Level.SEVERE, e.getMessage(), e); + } + } + return configUri; + + } + + protected void loadConfig() throws IOException, URISyntaxException { + this.setConfigUri(loadConfigUri()); + // Try to convert to an IResource in case the URI specifies + // an IResource supported scheme like 'namedbundleresource'. + URI uri; + try { + uri = this.getAggregator().newResource(this.getConfigUri()) + .getURI(); + } catch (UnsupportedOperationException e) { + // Not fatal. Just use the configUri as is + uri = this.getConfigUri(); + } + URLConnection connection = uri.toURL().openConnection(); + this.setLastModified(connection.getLastModified()); + + overrideConfig = loadConfig(connection.getInputStream()); + this.setRawConfig(overrideConfig); + } + + protected Location loadBaseURI(Scriptable cfg) throws URISyntaxException { + Object baseObj = cfg.get(BASEURL_CONFIGPARAM, cfg); + Location result; + if (baseObj == Scriptable.NOT_FOUND) { + result = new Location(getConfigUri().resolve(".")); //$NON-NLS-1$ + } else { + Location loc = loadBaseLocation(baseObj, true); + Location configLoc = new Location(getConfigUri(), + loc.getOverride() != null ? getConfigUri() : null); + result = configLoc.resolve(loc); + } + return result; + } + + private Location loadBaseLocation(Object baseObj, boolean b) { + + String str = Context.toString(baseObj); + Location result = null; + + try { + ClassLoader classLoader = Thread.currentThread() + .getContextClassLoader(); + Enumeration resources = classLoader.getResources(str); + while (resources.hasMoreElements()) { + URL resource = resources.nextElement(); + String resourceUrl = resource.toString(); + result = new Location(new URI(resourceUrl)); + } + } catch (Exception e) { + if (log.isLoggable(Level.SEVERE)) { + log.log(Level.SEVERE, e.getMessage(), e); + } + } + return result; + } +} diff --git a/jaggr-web/src/com/ibm/jaggr/web/impl/transport/DojoHttpTransport.java b/jaggr-web/src/com/ibm/jaggr/web/impl/transport/DojoHttpTransport.java new file mode 100644 index 00000000..e827dd31 --- /dev/null +++ b/jaggr-web/src/com/ibm/jaggr/web/impl/transport/DojoHttpTransport.java @@ -0,0 +1,27 @@ +/* + * (C) Copyright 2012, IBM Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.ibm.jaggr.web.impl.transport; + +import com.ibm.jaggr.core.transport.IHttpTransport; + +public class DojoHttpTransport extends + com.ibm.jaggr.core.impl.transport.DojoHttpTransport implements IHttpTransport { + + protected String getLoaderExtensionPath(){ + return getComboUri().getPath() + "loaderExt.js"; //$NON-NLS-1$ + } +} diff --git a/jaggr-webSample/WebContent/META-INF/MANIFEST.MF b/jaggr-webSample/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/jaggr-webSample/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/jaggr-webSample/WebContent/WEB-INF/aggrConfig.js b/jaggr-webSample/WebContent/WEB-INF/aggrConfig.js new file mode 100644 index 00000000..f6e2ea8e --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/aggrConfig.js @@ -0,0 +1,53 @@ +/* + * (C) Copyright 2012, IBM Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is AMD Aggregator config for the Aggregator sample application +{ + baseUrl:'jaggrWeb', + + packages: [ + { + name: 'dojo', + location: 'classpath:///WebContent/source_1.8.0-20120830-IBM_dojo/dojo' + }, + { + name: 'dijit', + location: 'classpath:///WebContent/source_1.8.0-20120830-IBM_dojo/dijit' + }, + { + name: 'dojox', + location: 'classpath:///WebContent/source_1.8.0-20120830-IBM_dojo/dojox' + } + + ], + paths: { + }, + + textPluginDelegators: ["js/css"], + + deps: ["js/bootstrap"], + + depsIncludeBaseUrl: true, // include baseUrl in scan for dependencies + + inlinedImageSizeThreshold: 0, // max image size to inline in CSS + + lazyDetection: false, + + //notice: 'embed.txt', + + cacheBust: '${project.version}' // This is a maven variable, replaced at build time (see pom file for filtered resources). + // You have other options for variable replacement in this file such as "scoped-variables" (see wiki for more info) +} diff --git a/jaggr-webSample/WebContent/WEB-INF/classes/jaggrWeb/js/loaderConfig.js b/jaggr-webSample/WebContent/WEB-INF/classes/jaggrWeb/js/loaderConfig.js new file mode 100644 index 00000000..00e688ca --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/classes/jaggrWeb/js/loaderConfig.js @@ -0,0 +1,95 @@ +/* + * (C) Copyright 2012, IBM Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +(function() { + var href = location.href, + isDebugLoader = /[&?]debugLoader=1/.test(href); + + // make sure we use the global require object + this.require = { + baseUrl: '/test', + packages: [ + { + name: 'dojo', + location: '../jaggr-dojo/dojo', + lib: '.' + }, + { + name: 'dijit', + location: '../jaggr-dojo/dijit', + lib: '.' + }, + { + name: 'dojox', + location: '../jaggr-dojo/dojox', + lib: '.' + } + ], + + paths: { + js: "res/js" + }, + + has: { + "dojo-error-api" : isDebugLoader, + "dojo-trace-api" : isDebugLoader, + "host-browser" : 1 + }, + + // Enable the desired loader tracing options + trace: { + "loader-inject":isDebugLoader, + "loader-inject-combo": isDebugLoader, + "loader-inject-combo-reject": isDebugLoader, + "loader-define":isDebugLoader, + "loader-exec-module":isDebugLoader, + //"loader-run-factory":isDebugLoader, + //"loader-finish-exec":isDebugLoader, + "loader-define-module":isDebugLoader + }, + + // This option only has meaning if has.dojo-timeout-api is enabled + waitSeconds: 10, + + combo: { + contextPath: "/jaggr-webSample/jaggr", + expandRequire: true, + // This is a maven variable, replaced at build time (see pom file for filtered resources). + cacheBust: '${project.version}' + }, + + deps: [ + "dojo/ready", + "dojo/parser", + "js/bootstrap" + ], + + callback: function(ready, parser) { + ready(function() { + parser.parse(); + }); + } + }; + + // get combo propery overrides from URL + for (var s in {optimize:0,expandRequire:0,showFilenames:0,noCache:0}) { + var regex = new RegExp("[&?]"+s+"=([^&]*)","i"); + var result = regex.exec(href) || []; + if (result.length > 1) { + require.combo[s] = result[1]; + } + } + +})(); diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.css.CSSModuleBuilder.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.css.CSSModuleBuilder.properties new file mode 100644 index 00000000..7a693052 --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.css.CSSModuleBuilder.properties @@ -0,0 +1,16 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.web.impl.modulebuilder.css.CSSModuleBuilder +extension=css \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.i18n.I18nModuleBuilder.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.i18n.I18nModuleBuilder.properties new file mode 100644 index 00000000..63fc333d --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.i18n.I18nModuleBuilder.properties @@ -0,0 +1,16 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.core.impl.modulebuilder.i18n.I18nModuleBuilder +extension=js \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.javascript.JavaScriptModuleBuilder.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.javascript.JavaScriptModuleBuilder.properties new file mode 100644 index 00000000..6eea4b49 --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.javascript.JavaScriptModuleBuilder.properties @@ -0,0 +1,16 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.core.impl.modulebuilder.javascript.JavaScriptModuleBuilder +extension=js \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.less.LessModuleBuilder.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.less.LessModuleBuilder.properties new file mode 100644 index 00000000..33123867 --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.less.LessModuleBuilder.properties @@ -0,0 +1,16 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.core.impl.modulebuilder.less.LessModuleBuilder +extension=less \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.text.TextModuleBuilder.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.text.TextModuleBuilder.properties new file mode 100644 index 00000000..8deed96c --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.modulebuilder.text.TextModuleBuilder.properties @@ -0,0 +1,16 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.core.impl.modulebuilder.text.TextModuleBuilder +extension=* \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.ClasspathResourceFactory.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.ClasspathResourceFactory.properties new file mode 100644 index 00000000..3140b265 --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.ClasspathResourceFactory.properties @@ -0,0 +1,16 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.core.impl.resource.ClasspathResourceFactory +scheme=classpath \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.FileResourceFactory.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.FileResourceFactory.properties new file mode 100644 index 00000000..b058110d --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.FileResourceFactory.properties @@ -0,0 +1,16 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.core.impl.resource.FileResourceFactory +scheme=file \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.JarResourceFactory.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.JarResourceFactory.properties new file mode 100644 index 00000000..be5ca649 --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.core.impl.resource.JarResourceFactory.properties @@ -0,0 +1,16 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.core.impl.resource.JarResourceFactory +scheme=jar \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.web.impl.transport.DojoHttpTransport.properties b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.web.impl.transport.DojoHttpTransport.properties new file mode 100644 index 00000000..178a07da --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/extensionPointsConf/com.ibm.jaggr.web.impl.transport.DojoHttpTransport.properties @@ -0,0 +1,17 @@ +# (C) Copyright 2012, IBM Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class=com.ibm.jaggr.web.impl.transport.DojoHttpTransport +path=combo +resourcesUri=classpath:///jaggrCore/js/ \ No newline at end of file diff --git a/jaggr-webSample/WebContent/WEB-INF/web.xml b/jaggr-webSample/WebContent/WEB-INF/web.xml new file mode 100644 index 00000000..1c22555e --- /dev/null +++ b/jaggr-webSample/WebContent/WEB-INF/web.xml @@ -0,0 +1,45 @@ + + + + jaggr-webSample + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + + The jaggr servlet handles requests to aggregate JS modules + JAGGR Servlet + JaggrServlet + com.ibm.jaggr.web.impl.AggregatorImpl + + alias + /jaggr-webSample/jaggr + + + config + aggrConfig.js + + + + JaggrServlet + /jaggr/* + + \ No newline at end of file diff --git a/jaggr-webSample/WebContent/test.html b/jaggr-webSample/WebContent/test.html new file mode 100644 index 00000000..5a81129b --- /dev/null +++ b/jaggr-webSample/WebContent/test.html @@ -0,0 +1,90 @@ + + + + +Test + + + + + + +

+
+
+
+
+
+ +