jawr-bundle-processor/src/main/java/net/jawr/web/bundle/processor/BundleProcessor.java
/**
	 * Process the Jawr Servlets
	 * 
	 * @param destDirPath
	 *            the destination directory path
	 * @param jawrServletDefinitions
	 *            the destination directory
	 * @throws Exception
	 *             if an exception occurs.
	 */
Process the Jawr Servlets

@param destDirPath
the destination directory path
@param jawrServletDefinitions
the destination directory
@throws Exception
if an exception occurs.
Process the Jawr Servlets @param destDirPath the destination directory path @param jawrServletDefinitions the destination directory @throws Exception if an exception occurs .
protected void processJawrServlets(String destDirPath,
			List<ServletDefinition> jawrServletDefinitions,
			boolean keepUrlMapping) throws Exception {
		String appRootDir = "";
		String jsServletMapping = "";
		String cssServletMapping = "";
		String binaryServletMapping = "";
		for (Iterator<ServletDefinition> iterator = jawrServletDefinitions
				.iterator(); iterator.hasNext();) {
			ServletDefinition servletDef = (ServletDefinition) iterator.next();
			ServletConfig servletConfig = servletDef.getServletConfig();
			Map<?, ?> initParameters = ((MockServletConfig) servletConfig)
					.getInitParameters();
			initParameters.remove("jawr.config.reload.interval");
			String jawrServletMapping = servletConfig
					.getInitParameter(JawrConstant.SERVLET_MAPPING_PROPERTY_NAME);
			String servletMapping = servletConfig
					.getInitParameter(JawrConstant.SPRING_SERVLET_MAPPING_PROPERTY_NAME);
			if (servletMapping == null) {
				servletMapping = jawrServletMapping;
			}
			ResourceBundlesHandler bundleHandler = null;
			BinaryResourcesHandler binaryRsHandler = null;
			ServletContext servletContext = servletConfig.getServletContext();
			String type = servletConfig.getInitParameter(TYPE_INIT_PARAMETER);
			if (type == null || type.equals(JawrConstant.JS_TYPE)) {
				bundleHandler = (ResourceBundlesHandler) servletContext
						.getAttribute(JawrConstant.JS_CONTEXT_ATTRIBUTE);
				String contextPathOverride = bundleHandler.getConfig()
						.getContextPathOverride();
				if (StringUtils.isNotEmpty(contextPathOverride)) {
					int idx = contextPathOverride.indexOf("//");
					if (idx != -1) {
						idx = contextPathOverride.indexOf("/", idx + 2);
						if (idx != -1) {
							appRootDir = PathNormalizer
									.asPath(contextPathOverride.substring(idx));
						}
					}
				}
				if (jawrServletMapping != null) {
					jsServletMapping = PathNormalizer
							.asPath(jawrServletMapping);
				}
			} else if (type.equals(JawrConstant.CSS_TYPE)) {
				bundleHandler = (ResourceBundlesHandler) servletContext
						.getAttribute(JawrConstant.CSS_CONTEXT_ATTRIBUTE);
				if (jawrServletMapping != null) {
					cssServletMapping = PathNormalizer
							.asPath(jawrServletMapping);
				}
			} else if (type.equals(JawrConstant.BINARY_TYPE)) {
				binaryRsHandler = (BinaryResourcesHandler) servletContext
						.getAttribute(JawrConstant.BINARY_CONTEXT_ATTRIBUTE);
				if (jawrServletMapping != null) {
					binaryServletMapping = PathNormalizer
							.asPath(jawrServletMapping);
				}
			}
			if (bundleHandler != null) {
				createBundles(servletDef.getServlet(), bundleHandler,
						destDirPath, servletMapping, keepUrlMapping);
			} else if (binaryRsHandler != null) {
				createBinaryBundle(servletDef.getServlet(), binaryRsHandler,
						destDirPath, servletConfig, keepUrlMapping);
			}
		}
		createApacheRewriteConfigFile(destDirPath, appRootDir,
				jsServletMapping, cssServletMapping, binaryServletMapping);
	}
protected void processJawrServlets ( String destDirPath , List < ServletDefinition > jawrServletDefinitions , boolean keepUrlMapping ) throws Exception { String appRootDir = "" ; String jsServletMapping = "" ; String cssServletMapping = "" ; String binaryServletMapping = "" ; for ( Iterator < ServletDefinition > iterator = jawrServletDefinitions . iterator ( ) ; iterator . hasNext ( ) ; ) { ServletDefinition servletDef = ( ServletDefinition ) iterator . next ( ) ; ServletConfig servletConfig = servletDef . getServletConfig ( ) ; Map < ? , ? > initParameters = ( ( MockServletConfig ) servletConfig ) . getInitParameters ( ) ; initParameters . remove ( "jawr.config.reload.interval" ) ; String jawrServletMapping = servletConfig . getInitParameter ( JawrConstant . SERVLET_MAPPING_PROPERTY_NAME ) ; String servletMapping = servletConfig . getInitParameter ( JawrConstant . SPRING_SERVLET_MAPPING_PROPERTY_NAME ) ; if ( servletMapping == null ) { servletMapping = jawrServletMapping ; } ResourceBundlesHandler bundleHandler = null ; BinaryResourcesHandler binaryRsHandler = null ; ServletContext servletContext = servletConfig . getServletContext ( ) ; String type = servletConfig . getInitParameter ( TYPE_INIT_PARAMETER ) ; if ( type == null || type . equals ( JawrConstant . JS_TYPE ) ) { bundleHandler = ( ResourceBundlesHandler ) servletContext . getAttribute ( JawrConstant . JS_CONTEXT_ATTRIBUTE ) ; String contextPathOverride = bundleHandler . getConfig ( ) . getContextPathOverride ( ) ; if ( StringUtils . isNotEmpty ( contextPathOverride ) ) { int idx = contextPathOverride . indexOf ( "//" ) ; if ( idx != - 1 ) { idx = contextPathOverride . indexOf ( "/" , idx + 2 ) ; if ( idx != - 1 ) { appRootDir = PathNormalizer . asPath ( contextPathOverride . substring ( idx ) ) ; } } } if ( jawrServletMapping != null ) { jsServletMapping = PathNormalizer . asPath ( jawrServletMapping ) ; } } else if ( type . equals ( JawrConstant . CSS_TYPE ) ) { bundleHandler = ( ResourceBundlesHandler ) servletContext . getAttribute ( JawrConstant . CSS_CONTEXT_ATTRIBUTE ) ; if ( jawrServletMapping != null ) { cssServletMapping = PathNormalizer . asPath ( jawrServletMapping ) ; } } else if ( type . equals ( JawrConstant . BINARY_TYPE ) ) { binaryRsHandler = ( BinaryResourcesHandler ) servletContext . getAttribute ( JawrConstant . BINARY_CONTEXT_ATTRIBUTE ) ; if ( jawrServletMapping != null ) { binaryServletMapping = PathNormalizer . asPath ( jawrServletMapping ) ; } } if ( bundleHandler != null ) { createBundles ( servletDef . getServlet ( ) , bundleHandler , destDirPath , servletMapping , keepUrlMapping ) ; } else if ( binaryRsHandler != null ) { createBinaryBundle ( servletDef . getServlet ( ) , binaryRsHandler , destDirPath , servletConfig , keepUrlMapping ) ; } } createApacheRewriteConfigFile ( destDirPath , appRootDir , jsServletMapping , cssServletMapping , binaryServletMapping ) ; }
Process the Jawr Servlets
Process the Jawr Servlets
// Force the production mode, and remove config listener parameters // Retrieve the bundle Handler // Create the apache rewrite config file.