List of usage examples for javax.servlet ServletConfig getServletContext
public ServletContext getServletContext();
From source file:be.fedict.eid.idp.webapp.ProtocolEntryServlet.java
@Override public void init(ServletConfig config) throws ServletException { /*//from w w w .j a v a 2 s . com * Get init-params. */ this.unknownProtocolPageInitParam = getRequiredInitParameter(config, "UnknownProtocolPage"); this.unsupportedBrowserPageInitParam = getRequiredInitParameter(config, "UnsupportedBrowserPage"); this.protocolErrorPageInitParam = getRequiredInitParameter(config, "ProtocolErrorPage"); this.protocolErrorMessageSessionAttributeInitParam = getRequiredInitParameter(config, "ProtocolErrorMessageSessionAttribute"); this.identificationPageInitParam = getRequiredInitParameter(config, "IdentificationPage"); this.authenticationPageInitParam = getRequiredInitParameter(config, "AuthenticationPage"); this.blockedPageInitParam = getRequiredInitParameter(config, "BlockedPage"); this.blockedMessageSessionAttributeInitParam = getRequiredInitParameter(config, "BlockedMessageSessionAttribute"); /* * Initialize the protocol services. */ ServletContext servletContext = config.getServletContext(); if (null == findProtocolServices(servletContext)) { Map<String, IdentityProviderProtocolService> protocolServices = new HashMap<String, IdentityProviderProtocolService>(); setProtocolService(protocolServices, servletContext); List<IdentityProviderProtocolType> identityProviderProtocols = this.protocolServiceManager .getProtocolServices(); for (IdentityProviderProtocolType identityProviderProtocol : identityProviderProtocols) { String name = identityProviderProtocol.getName(); LOG.debug("protocol name: " + name); IdentityProviderProtocolService protocolService = this.protocolServiceManager .getProtocolService(identityProviderProtocol); String contextPath = identityProviderProtocol.getContextPath(); if (protocolServices.containsKey(contextPath)) { throw new ServletException( "protocol service for context path already registered: " + contextPath); } protocolService.init(servletContext, this.identityService); protocolServices.put(contextPath, protocolService); } } /* * Initialize the attribute services. */ if (null == findAttributeServices(servletContext)) { Map<String, IdentityProviderAttributeService> attributeServices = new HashMap<String, IdentityProviderAttributeService>(); setAttributeServices(attributeServices, servletContext); List<IdentityProviderAttributeType> identityProviderAttributes = this.attributeServiceManager .getAttributeServiceTypes(); for (IdentityProviderAttributeType identityProviderAttribute : identityProviderAttributes) { String uri = identityProviderAttribute.getURI(); LOG.debug("attribute URI: " + uri); IdentityProviderAttributeService attributeService = this.attributeServiceManager .getAttributeService(identityProviderAttribute); if (attributeServices.containsKey(uri)) { throw new ServletException("attribute service for URI already registered: " + uri); } attributeService.init(servletContext); attributeServices.put(uri, attributeService); } } }
From source file:org.dspace.app.webui.jsptag.LayoutTag.java
public int doEndTag() throws JspException { // Context objects ServletRequest request = pageContext.getRequest(); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); ServletConfig config = pageContext.getServletConfig(); // header file String header = templatePath + "header-default.jsp"; // Choose default style unless one is specified if (style != null) { header = templatePath + "header-" + style.toLowerCase() + ".jsp"; }// ww w . j a v a 2 s .co m if (sidebar != null) { request.setAttribute("dspace.layout.sidebar", sidebar); } // Now include the header try { // Set headers to prevent browser caching, if appropriate if ((noCache != null) && noCache.equalsIgnoreCase("true")) { response.addDateHeader("expires", 1); response.addHeader("Pragma", "no-cache"); response.addHeader("Cache-control", "no-store"); } // Ensure the HTTP header will declare that UTF-8 is used // in the response. response.setContentType("text/html; charset=UTF-8"); RequestDispatcher rd = config.getServletContext().getRequestDispatcher(header); rd.include(request, response); //pageContext.getOut().write(getBodyContent().getString()); getBodyContent().writeOut(pageContext.getOut()); } catch (IOException ioe) { throw new JspException("Got IOException: " + ioe); } catch (ServletException se) { log.warn("Exception", se.getRootCause()); throw new JspException("Got ServletException: " + se); } // Footer file to use String footer = templatePath + "footer-default.jsp"; // Choose default flavour unless one is specified if (style != null) { footer = templatePath + "footer-" + style.toLowerCase() + ".jsp"; } try { // Ensure body is included before footer pageContext.getOut().flush(); RequestDispatcher rd = config.getServletContext().getRequestDispatcher(footer); rd.include(request, response); } catch (ServletException se) { throw new JspException("Got ServletException: " + se); } catch (IOException ioe) { throw new JspException("Got IOException: " + ioe); } style = null; title = null; sidebar = null; navbar = null; locbar = null; parentTitle = null; parentLink = null; noCache = null; feedData = null; return EVAL_PAGE; }
From source file:com.portfolio.data.attachment.FileServlet.java
@Override public void init(ServletConfig config) { /// List possible local address try {/*from w ww .ja v a 2s. co m*/ Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface current = interfaces.nextElement(); if (!current.isUp() || current.isLoopback() || current.isVirtual()) continue; Enumeration<InetAddress> addresses = current.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress current_addr = addresses.nextElement(); if (current_addr instanceof Inet4Address) ourIPs.add(current_addr.getHostAddress()); } } } catch (Exception e) { } servContext = config.getServletContext(); backend = config.getServletContext().getInitParameter("backendserver"); server = config.getServletContext().getInitParameter("fileserver"); try { String dataProviderName = config.getInitParameter("dataProviderClass"); dataProvider = (DataProvider) Class.forName(dataProviderName).newInstance(); InitialContext cxt = new InitialContext(); if (cxt == null) { throw new Exception("no context found!"); } /// Init this here, might fail depending on server hosting ds = (DataSource) cxt.lookup("java:/comp/env/jdbc/portfolio-backend"); if (ds == null) { throw new Exception("Data jdbc/portfolio-backend source not found!"); } } catch (Exception e) { e.printStackTrace(); } }
From source file:ORG.oclc.os.SRW.SRWServletInfo.java
public void init(final ServletConfig config) { try {//from w ww .j a v a2s . com String propsfilePath = EscidocConfiguration.getInstance() .get(EscidocConfiguration.SEARCH_PROPERTIES_DIRECTORY, "search/config"); if (!propsfilePath.equals("")) { String escidocHome = EscidocConfiguration.getInstance().getEscidocHome(); if (!escidocHome.isEmpty()) { if (!escidocHome.endsWith("/")) { escidocHome += "/"; } escidocHome += "conf/"; if (propsfilePath.startsWith("/")) { propsfilePath = propsfilePath.substring(1); } propsfilePath = escidocHome + propsfilePath; } if (!propsfilePath.endsWith("/")) { propsfilePath += "/"; } } propsfileName = propsfilePath + "SRWServer.props"; log.info("Reading properties file: " + propsfileName); srwHome = config.getServletContext().getRealPath("/"); if (srwHome.endsWith("/")) srwHome = srwHome.substring(0, srwHome.length() - 1); if (srwHome.endsWith("\\")) srwHome = srwHome.substring(0, srwHome.length() - 1); log.debug("srwHome=" + srwHome); int off = srwHome.lastIndexOf('/'); if (off < 0) off = srwHome.lastIndexOf('\\'); if (off > 0) { webappHome = srwHome.substring(0, off); log.debug("webappHome=" + webappHome); off = webappHome.lastIndexOf('/'); if (off < 0) off = webappHome.lastIndexOf('\\'); if (off > 0) tomcatHome = webappHome.substring(0, off); log.debug("tomcatHome=" + tomcatHome); } InputStream is; try { is = Utilities.openInputStream(propsfileName, srwHome, null); properties.load(is); properties.setProperty("propsfilePath", propsfilePath); is.close(); } catch (java.io.FileNotFoundException e) { log.info("Unable to load properties file: " + propsfileName); log.info("Will using web.xml for configuration parameters"); Enumeration enumer = config.getInitParameterNames(); String propName; while (enumer.hasMoreElements()) { propName = (String) enumer.nextElement(); properties.setProperty(propName, config.getInitParameter(propName)); } } buildDbList(properties, dbVector, dbnames, config.getServletContext().getRealPath("/")); srwHome = properties.getProperty("SRW.Home"); if (srwHome == null) { srwHome = config.getServletContext().getRealPath("/"); } log.info("SRW.Home=" + srwHome); pathInfoIndex = Integer .parseInt(properties.getProperty("pathInfoIndex", Integer.toString(pathInfoIndex))); log.info("pathInfoIndex=" + pathInfoIndex); resultSetIdleTime = Integer .parseInt(properties.getProperty("resultSetIdleTime", Integer.toString(resultSetIdleTime))); log.info("resultSetIdleTime=" + resultSetIdleTime + " seconds"); defaultDatabase = properties.getProperty("default.database"); if (defaultDatabase == null) defaultDatabase = "default.database not specified in properties file"; log.info("default.database=" + defaultDatabase); indexDotHtmlLocation = properties.getProperty("index.html"); if (indexDotHtmlLocation == null) indexDotHtmlLocation = srwHome + "index.html"; String s = properties.getProperty("makeIndex.html"); if (s != null) if (s.equalsIgnoreCase("true")) makeIndexDotHtml = true; // any dbs to open automatically? s = properties.getProperty("SRW.OpenAllDatabasesOnStartup"); if (s == null) { // maybe a short list to open? s = properties.getProperty("SRW.OpenDatabasesInListOnStartup"); if (s != null) { log.info("Opening databases: " + s); createDBs(s); } else log.info("Not opening databases yet"); } else if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("t") || s.equals("1")) { Enumeration enumer = properties.propertyNames(); int offset; String dbname, list = new String(","), t; while (enumer.hasMoreElements()) { t = (String) enumer.nextElement(); if (t.startsWith("db.")) { offset = t.indexOf(".", 3); dbname = t.substring(3, offset); if (list.indexOf(", " + dbname + ",") == -1) { // not yet in list list = list + " " + dbname + ","; } } } log.info("Opening all databases :" + list); createDBs(list); } // load the sru-srw extension mapping table Enumeration enumer = properties.propertyNames(); String extension, namespace, sruParm, t; while (enumer.hasMoreElements()) { t = (String) enumer.nextElement(); if (t.startsWith("extension.") && !t.endsWith(".namespace")) { sruParm = t.substring(10); extension = properties.getProperty(t); extensions.put(sruParm, extension); log.debug("added extension=" + extension + ", with sru parm=" + sruParm); namespace = properties.getProperty("extension." + extension + ".namespace"); namespaces.put(sruParm, namespace); log.debug("added namespace=" + namespace + ", with sru parm=" + sruParm); } } log.info("SRWServletInfo initialization complete"); } catch (Exception e) { log.error(e, e); } }
From source file:org.deegree.services.controller.OGCFrontController.java
@Override public void init(ServletConfig config) throws ServletException { instance = this; try {/* w ww . j a va2 s . c o m*/ super.init(config); ctxPath = config.getServletContext().getContextPath(); LOG.info("--------------------------------------------------------------------------------"); DeegreeAALogoUtils.logInfo(LOG); LOG.info("--------------------------------------------------------------------------------"); LOG.info("deegree modules"); LOG.info("--------------------------------------------------------------------------------"); LOG.info(""); try { modulesInfo = extractModulesInfo(config.getServletContext()); } catch (Throwable t) { LOG.error("Unable to extract deegree module information: " + t.getMessage()); modulesInfo = emptyList(); } for (ModuleInfo moduleInfo : modulesInfo) { LOG.info("- " + moduleInfo.toString()); if ("deegree-services-commons".equals(moduleInfo.getArtifactId())) { version = moduleInfo.getVersion(); } } if (version == null) { version = "unknown"; } LOG.info(""); LOG.info("--------------------------------------------------------------------------------"); LOG.info("System info"); LOG.info("--------------------------------------------------------------------------------"); LOG.info(""); LOG.info("- java version " + System.getProperty("java.version") + " (" + System.getProperty("java.vendor") + ")"); LOG.info("- operating system " + System.getProperty("os.name") + " (" + System.getProperty("os.version") + ", " + System.getProperty("os.arch") + ")"); LOG.info("- container " + config.getServletContext().getServerInfo()); LOG.info("- webapp path " + ctxPath); LOG.info("- default encoding " + DEFAULT_ENCODING); LOG.info("- system encoding " + Charset.defaultCharset().displayName()); LOG.info("- temp directory " + defaultTMPDir); LOG.info("- XMLOutputFactory " + XMLOutputFactory.newInstance().getClass().getCanonicalName()); LOG.info("- XMLInputFactory " + XMLInputFactory.newInstance().getClass().getCanonicalName()); LOG.info(""); initWorkspace(); } catch (NoClassDefFoundError e) { LOG.error("Initialization failed!"); LOG.error("You probably forgot to add a required .jar to the WEB-INF/lib directory."); LOG.error("The resource that could not be found was '{}'.", e.getMessage()); LOG.debug("Stack trace:", e); throw new ServletException(e); } catch (Exception e) { LOG.error("Initialization failed!"); LOG.error("An unexpected error was caught, stack trace:", e); throw new ServletException(e); } finally { CONTEXT.remove(); } }
From source file:org.apache.tapestry.request.RequestContext.java
/** * Writes the state of the context to the writer, typically for inclusion * in a HTML page returned to the user. This is useful * when debugging. The Inspector uses this as well. * **//*from w ww . j a v a 2 s . c o m*/ public void write(IMarkupWriter writer) { // Create a box around all of this stuff ... writer.begin("table"); writer.attribute("class", "request-context-border"); writer.begin("tr"); writer.begin("td"); // Get the session, if it exists, and display it. HttpSession session = getSession(); if (session != null) { object(writer, "Session"); writer.begin("table"); writer.attribute("class", "request-context-object"); section(writer, "Properties"); header(writer, "Name", "Value"); pair(writer, "id", session.getId()); datePair(writer, "creationTime", session.getCreationTime()); datePair(writer, "lastAccessedTime", session.getLastAccessedTime()); pair(writer, "maxInactiveInterval", session.getMaxInactiveInterval()); pair(writer, "new", session.isNew()); List names = getSorted(session.getAttributeNames()); int count = names.size(); for (int i = 0; i < count; i++) { if (i == 0) { section(writer, "Attributes"); header(writer, "Name", "Value"); } String name = (String) names.get(i); pair(writer, name, session.getAttribute(name)); } writer.end(); // Session } object(writer, "Request"); writer.begin("table"); writer.attribute("class", "request-context-object"); // Parameters ... List parameters = getSorted(_request.getParameterNames()); int count = parameters.size(); for (int i = 0; i < count; i++) { if (i == 0) { section(writer, "Parameters"); header(writer, "Name", "Value(s)"); } String name = (String) parameters.get(i); String[] values = _request.getParameterValues(name); writer.begin("tr"); writer.attribute("class", getRowClass()); writer.begin("th"); writer.print(name); writer.end(); writer.begin("td"); if (values.length > 1) writer.begin("ul"); for (int j = 0; j < values.length; j++) { if (values.length > 1) writer.beginEmpty("li"); writer.print(values[j]); } writer.end("tr"); } section(writer, "Properties"); header(writer, "Name", "Value"); pair(writer, "authType", _request.getAuthType()); pair(writer, "characterEncoding", _request.getCharacterEncoding()); pair(writer, "contentLength", _request.getContentLength()); pair(writer, "contentType", _request.getContentType()); pair(writer, "method", _request.getMethod()); pair(writer, "pathInfo", _request.getPathInfo()); pair(writer, "pathTranslated", _request.getPathTranslated()); pair(writer, "protocol", _request.getProtocol()); pair(writer, "queryString", _request.getQueryString()); pair(writer, "remoteAddr", _request.getRemoteAddr()); pair(writer, "remoteHost", _request.getRemoteHost()); pair(writer, "remoteUser", _request.getRemoteUser()); pair(writer, "requestedSessionId", _request.getRequestedSessionId()); pair(writer, "requestedSessionIdFromCookie", _request.isRequestedSessionIdFromCookie()); pair(writer, "requestedSessionIdFromURL", _request.isRequestedSessionIdFromURL()); pair(writer, "requestedSessionIdValid", _request.isRequestedSessionIdValid()); pair(writer, "requestURI", _request.getRequestURI()); pair(writer, "scheme", _request.getScheme()); pair(writer, "serverName", _request.getServerName()); pair(writer, "serverPort", _request.getServerPort()); pair(writer, "contextPath", _request.getContextPath()); pair(writer, "servletPath", _request.getServletPath()); // Now deal with any headers List headers = getSorted(_request.getHeaderNames()); count = headers.size(); for (int i = 0; i < count; i++) { if (i == 0) { section(writer, "Headers"); header(writer, "Name", "Value"); } String name = (String) headers.get(i); String value = _request.getHeader(name); pair(writer, name, value); } // Attributes List attributes = getSorted(_request.getAttributeNames()); count = attributes.size(); for (int i = 0; i < count; i++) { if (i == 0) { section(writer, "Attributes"); header(writer, "Name", "Value"); } String name = (String) attributes.get(i); pair(writer, name, _request.getAttribute(name)); } // Cookies ... Cookie[] cookies = _request.getCookies(); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (i == 0) { section(writer, "Cookies"); header(writer, "Name", "Value"); } Cookie cookie = cookies[i]; pair(writer, cookie.getName(), cookie.getValue()); } // Cookies loop } writer.end(); // Request object(writer, "Servlet"); writer.begin("table"); writer.attribute("class", "request-context-object"); section(writer, "Properties"); header(writer, "Name", "Value"); pair(writer, "servlet", _servlet); pair(writer, "name", _servlet.getServletName()); pair(writer, "servletInfo", _servlet.getServletInfo()); ServletConfig config = _servlet.getServletConfig(); List names = getSorted(config.getInitParameterNames()); count = names.size(); for (int i = 0; i < count; i++) { if (i == 0) { section(writer, "Init Parameters"); header(writer, "Name", "Value"); } String name = (String) names.get(i); ; pair(writer, name, config.getInitParameter(name)); } writer.end(); // Servlet ServletContext context = config.getServletContext(); object(writer, "Servlet Context"); writer.begin("table"); writer.attribute("class", "request-context-object"); section(writer, "Properties"); header(writer, "Name", "Value"); pair(writer, "majorVersion", context.getMajorVersion()); pair(writer, "minorVersion", context.getMinorVersion()); pair(writer, "serverInfo", context.getServerInfo()); names = getSorted(context.getInitParameterNames()); count = names.size(); for (int i = 0; i < count; i++) { if (i == 0) { section(writer, "Initial Parameters"); header(writer, "Name", "Value"); } String name = (String) names.get(i); pair(writer, name, context.getInitParameter(name)); } names = getSorted(context.getAttributeNames()); count = names.size(); for (int i = 0; i < count; i++) { if (i == 0) { section(writer, "Attributes"); header(writer, "Name", "Value"); } String name = (String) names.get(i); pair(writer, name, context.getAttribute(name)); } writer.end(); // Servlet Context writeSystemProperties(writer); writer.end("table"); // The enclosing border }
From source file:com.ibm.jaggr.core.impl.AbstractAggregatorImpl.java
@Override public void init(ServletConfig servletConfig) throws ServletException { final String sourceMethod = "init"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod, new Object[] { servletConfig }); }/*from w ww. j a v a 2 s.c om*/ super.init(servletConfig); final ServletContext context = servletConfig.getServletContext(); // Set servlet context attributes for access though the request context.setAttribute(IAggregator.AGGREGATOR_REQATTRNAME, this); if (isTraceLogging) { log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod); } }
From source file:net.centro.rtb.monitoringcenter.MonitoringCenterServlet.java
@Override public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); boolean disableAuthorization = Boolean.TRUE.toString() .equalsIgnoreCase(servletConfig.getInitParameter(DISABLE_AUTHORIZATION_INIT_PARAM)); if (!disableAuthorization) { String credentials = null; String username = servletConfig.getInitParameter(USERNAME_INIT_PARAM); String password = servletConfig.getInitParameter(PASSWORD_INIT_PARAM); if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) { credentials = username.trim() + ":" + password.trim(); } else {/* w ww . j ava 2s. c om*/ credentials = DEFAULT_CREDENTIALS; } this.encodedCredentials = BaseEncoding.base64().encode(credentials.getBytes()); } this.objectMapper = new ObjectMapper() .registerModule(new MetricsModule(TimeUnit.SECONDS, TimeUnit.MICROSECONDS, false)) .registerModule(new HealthCheckModule()).setSerializationInclusion(JsonInclude.Include.NON_NULL) .setTimeZone(TimeZone.getDefault()).setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z")); this.graphiteMetricFormatter = new GraphiteMetricFormatter(TimeUnit.SECONDS, TimeUnit.MICROSECONDS); try { this.threadDumpGenerator = new ThreadDump(ManagementFactory.getThreadMXBean()); } catch (NoClassDefFoundError ignore) { } ServletContext servletContext = servletConfig.getServletContext(); String servletSpecVersion = servletContext.getMajorVersion() + "." + servletContext.getMinorVersion(); this.serverInfo = ServerInfo.create(servletContext.getServerInfo(), servletSpecVersion); }
From source file:net.jawr.web.bundle.processor.BundleProcessor.java
/** * Process the Jawr Servlets//from ww w. ja v a 2 s . c om * * @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(); // Force the production mode, and remove config listener parameters 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; // Retrieve the bundle Handler 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); } } // Create the apache rewrite config file. createApacheRewriteConfigFile(destDirPath, appRootDir, jsServletMapping, cssServletMapping, binaryServletMapping); }
From source file:org.theospi.portfolio.portal.web.XsltPortal.java
public void init(ServletConfig config) throws ServletException { super.init(config); setPortalManager((PortalManager) ComponentManager.get(PortalManager.class.getName() + ".tx")); try {//from w ww . j av a 2s .c o m setDocumentBuilder(DocumentBuilderFactory.newInstance().newDocumentBuilder()); String transformPath = config.getInitParameter("transform"); Templates templates = createTemplate(config, transformPath); setTemplates(templates); String transformToolCategoryPath = config.getInitParameter("transformToolCategory"); Templates templatesToolCategory = createTemplate(config, transformToolCategoryPath); setServletResolver(new PortalResourceUriResolver(getPortalManager(), config.getServletContext())); setToolCategoryTemplates(templatesToolCategory); categoryBasePath = config.getInitParameter("categoryBasePath"); if (categoryBasePath == null || categoryBasePath.length() == 0) { categoryBasePath = "/WEB-INF/category"; } Collection categoriesNeedingLoading = getPortalManager().getCategoriesInNeedOfFiles(); if (categoriesNeedingLoading != null) { for (Iterator<ToolCategory> i = categoriesNeedingLoading.iterator(); i.hasNext();) { processCategoryFiles(i.next(), config.getServletContext()); } getPortalManager().saveToolCategories(categoriesNeedingLoading); } } catch (ParserConfigurationException e) { throw new ServletException(e); } catch (TransformerConfigurationException e) { throw new ServletException(e); } catch (MalformedURLException e) { throw new ServletException(e); } catch (IOException e) { throw new ServletException(e); } }