List of usage examples for javax.servlet ServletContext getServerInfo
public String getServerInfo();
From source file:org.apache.axis.transport.http.AxisServlet.java
/** * Initialization method./* ww w. ja v a 2s . co m*/ */ public void init() throws javax.servlet.ServletException { super.init(); ServletContext context = getServletConfig().getServletContext(); isDebug = log.isDebugEnabled(); if (isDebug) { log.debug("In servlet init"); } transportName = getOption(context, INIT_PROPERTY_TRANSPORT_NAME, HTTPTransport.DEFAULT_TRANSPORT_NAME); if (JavaUtils.isTrueExplicitly(getOption(context, INIT_PROPERTY_USE_SECURITY, null))) { securityProvider = new ServletSecurityProvider(); } enableList = JavaUtils.isTrueExplicitly(getOption(context, INIT_PROPERTY_ENABLE_LIST, null)); jwsClassDir = getOption(context, INIT_PROPERTY_JWS_CLASS_DIR, null); // Should we list services? disableServicesList = JavaUtils.isTrue(getOption(context, INIT_PROPERTY_DISABLE_SERVICES_LIST, "false")); servicesPath = getOption(context, INIT_PROPERTY_SERVICES_PATH, "/services/"); /** * There are DEFINATE problems here if * getHomeDir and/or getDefaultJWSClassDir return null * (as they could with WebLogic). * This needs to be reexamined in the future, but this * should fix any NPE's in the mean time. */ if (jwsClassDir != null) { if (getHomeDir() != null) { jwsClassDir = getHomeDir() + jwsClassDir; } } else { jwsClassDir = getDefaultJWSClassDir(); } initQueryStringHandlers(); // Setup the service admin try { ServiceAdmin.setEngine(this.getEngine(), context.getServerInfo()); } catch (AxisFault af) { exceptionLog.info("Exception setting AxisEngine on ServiceAdmin " + af); } }
From source file:ro.raisercostin.web.DebuggingFilter.java
public String debug(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, DebuggingPrinter debuggingPrinter, boolean debugAll, boolean debugRequest) { final JspFactory jspFactory = JspFactory.getDefaultFactory(); HttpSession session = request.getSession(); debuggingPrinter.addHeader();/*from www. java 2 s . co m*/ debuggingPrinter.addSection("Request Parameters"); for (Iterator iterator = request.getParameterMap().entrySet().iterator(); iterator.hasNext();) { Map.Entry<String, Object> parameter = (Map.Entry<String, Object>) iterator.next(); addRow(debuggingPrinter, parameter.getKey(), StringUtils.arrayToCommaDelimitedString((Object[]) parameter.getValue())); } debuggingPrinter.endSection(); if (debugRequest) { debuggingPrinter.addSection("Request Header"); for (Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { String parameterName = (String) e.nextElement(); addRow(debuggingPrinter, parameterName, debuggingPrinter.transform(request.getHeader(parameterName))); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Request Attributes"); java.util.Enumeration en = request.getAttributeNames(); while (en.hasMoreElements()) { String attrName = (String) en.nextElement(); try { addRow(debuggingPrinter, split(attrName, 50), toString2(request.getAttribute(attrName), 120)); } catch (Exception e) { addRow(debuggingPrinter, split(attrName, 50), toString(e, 120)); } } debuggingPrinter.endSection(); debuggingPrinter.addSection("Session Attributes"); en = session.getAttributeNames(); while (en.hasMoreElements()) { String attrName = (String) en.nextElement(); try { addRow(debuggingPrinter, split(attrName, 50), toString2(session.getAttribute(attrName), 120)); } catch (Exception e) { addRow(debuggingPrinter, split(attrName, 50), toString(e, 120)); } } debuggingPrinter.endSection(); debuggingPrinter.addSection("Request Info"); addRow(debuggingPrinter, "AuthType", request.getAuthType()); addRow(debuggingPrinter, "ContextPath", request.getContextPath()); addRow(debuggingPrinter, "Method", request.getMethod()); addRow(debuggingPrinter, "PathInfo", request.getPathInfo()); addRow(debuggingPrinter, "PathTranslated", request.getPathTranslated()); addRow(debuggingPrinter, "Protocol", request.getProtocol()); addRow(debuggingPrinter, "QueryString", request.getQueryString()); addRow(debuggingPrinter, "RemoteAddr", request.getRemoteAddr()); addRow(debuggingPrinter, "RemoteUser", request.getRemoteUser()); addRow(debuggingPrinter, "RequestedSessionId", request.getRequestedSessionId()); addRow(debuggingPrinter, "RequestURI", request.getRequestURI()); addRow(debuggingPrinter, "RequestURL", request.getRequestURL().toString()); addRow(debuggingPrinter, "ServletPath", request.getServletPath()); addRow(debuggingPrinter, "Scheme", request.getScheme()); addRow(debuggingPrinter, "ServletPath", request.getServletPath()); } if (debugAll) { debuggingPrinter.addSection("Server"); addRow(debuggingPrinter, "Server Info", servletContext.getServerInfo()); addRow(debuggingPrinter, "Servlet Engine Version", servletContext.getMajorVersion() + "." + servletContext.getMinorVersion()); addRow(debuggingPrinter, "JSP Version", jspFactory.getEngineInfo().getSpecificationVersion()); debuggingPrinter.endSection(); debuggingPrinter.addSection("JVM Properties"); for (Enumeration e = System.getProperties().propertyNames(); e.hasMoreElements();) { String parameterName = (String) e.nextElement(); addRow(debuggingPrinter, parameterName, debuggingPrinter.transform(System.getProperty(parameterName))); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Environment"); for (Map.Entry<String, String> property : System.getenv().entrySet()) { addRow(debuggingPrinter, property.getKey(), debuggingPrinter.transform(property.getValue())); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Debugger Provided by"); addRow(debuggingPrinter, "provided by", "raisercostin"); debuggingPrinter.addRow("source", "<a target='_blank' href='http://code.google.com/p/raisercostin/wiki/DebuggingFilter'>http://code.google.com/p/raisercostin/wiki/DebuggingFilter</a>"); addRow(debuggingPrinter, "version", "1.0"); addRow(debuggingPrinter, "timestamp", "2008.June.14"); addRow(debuggingPrinter, "license", "<a target='_blank' href='http://www.apache.org/licenses/LICENSE-2.0.html'>Apache License 2.0</a>"); debuggingPrinter.endSection(); } debuggingPrinter.addFooter(); return debuggingPrinter.getString(); }
From source file:org.opencms.main.OpenCmsCore.java
/** * Initialization of the OpenCms runtime environment.<p> * * The connection information for the database is read * from the <code>opencms.properties</code> configuration file and all * driver manager are initialized via the initializer, * which usually will be an instance of a <code>OpenCms</code> class. * * @param context configuration of OpenCms from <code>web.xml</code> * @throws CmsInitException in case OpenCms can not be initialized *//*from w w w .j a va 2s.c o m*/ protected synchronized void initContext(ServletContext context) throws CmsInitException { m_gwtServiceContexts = new HashMap<String, CmsGwtServiceContext>(); // automatic servlet container recognition and specific behavior: CmsServletContainerSettings servletContainerSettings = new CmsServletContainerSettings(context); getSystemInfo().init(servletContainerSettings); // Collect the configurations CmsParameterConfiguration configuration; try { configuration = new CmsParameterConfiguration(getSystemInfo().getConfigurationFileRfsPath()); } catch (Exception e) { throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_PROPFILE_1, getSystemInfo().getConfigurationFileRfsPath()), e); } String throwException = configuration.getString("servlet.exception.enabled", "auto"); if (!throwException.equals("auto")) { // set the parameter is not automatic, the rest of the servlet container dependent parameters // will be set when reading the system configuration, if not set to auto boolean throwExc = Boolean.valueOf(throwException).booleanValue(); getSystemInfo().getServletContainerSettings().setServletThrowsException(throwExc); } // check if the wizard is enabled, if so stop initialization if (configuration.getBoolean("wizard.enabled", true)) { throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_WIZARD_0)); } // output startup message and copyright to STDERR System.err.println(Messages.get().getBundle().key(Messages.LOG_STARTUP_CONSOLE_NOTE_2, OpenCms.getSystemInfo().getVersionNumber(), getSystemInfo().getWebApplicationName())); for (int i = 0; i < Messages.COPYRIGHT_BY_ALKACON.length; i++) { System.err.println(Messages.COPYRIGHT_BY_ALKACON[i]); } System.err.println(); // output startup message to log file if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DOT_0)); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DOT_0)); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DOT_0)); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DOT_0)); for (int i = 0; i < Messages.COPYRIGHT_BY_ALKACON.length; i++) { CmsLog.INIT.info(". " + Messages.COPYRIGHT_BY_ALKACON[i]); } CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_LINE_0)); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_STARTUP_TIME_1, new Date(System.currentTimeMillis()))); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_OPENCMS_VERSION_1, OpenCms.getSystemInfo().getVersionNumber())); CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_SERVLET_CONTAINER_1, context.getServerInfo())); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WEBAPP_NAME_1, getSystemInfo().getWebApplicationName())); CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_SERVLET_PATH_1, getSystemInfo().getServletPath())); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_OPENCMS_CONTEXT_1, getSystemInfo().getOpenCmsContext())); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_WEBINF_PATH_1, getSystemInfo().getWebInfRfsPath())); CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_PROPERTY_FILE_1, getSystemInfo().getConfigurationFileRfsPath())); CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_LOG_FILE_1, getSystemInfo().getLogFileRfsPath())); } // initialize the configuration initConfiguration(configuration); }