当前位置: 首页>>代码示例>>Java>>正文


Java ServerInfo类代码示例

本文整理汇总了Java中org.apache.catalina.util.ServerInfo的典型用法代码示例。如果您正苦于以下问题:Java ServerInfo类的具体用法?Java ServerInfo怎么用?Java ServerInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServerInfo类属于org.apache.catalina.util包,在下文中一共展示了ServerInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serverinfo

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Writes System OS and JVM properties.
 * @param writer Writer to render to
 */
protected void serverinfo(PrintWriter writer) {
    if (debug >= 1)
        log("serverinfo");
    try {
        StringBuffer props = new StringBuffer();
        props.append("OK - Server info");
        props.append("\nTomcat Version: ");
        props.append(ServerInfo.getServerInfo());
        props.append("\nOS Name: ");
        props.append(System.getProperty("os.name"));
        props.append("\nOS Version: ");
        props.append(System.getProperty("os.version"));
        props.append("\nOS Architecture: ");
        props.append(System.getProperty("os.arch"));
        props.append("\nJVM Version: ");
        props.append(System.getProperty("java.runtime.version"));
        props.append("\nJVM Vendor: ");
        props.append(System.getProperty("java.vm.vendor"));
        writer.println(props.toString());
    } catch (Throwable t) {
        getServletContext().log("ManagerServlet.serverinfo",t);
        writer.println(sm.getString("managerServlet.exception",
                                    t.toString()));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:ManagerServlet.java

示例2: serverinfo

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Writes System OS and JVM properties.
 *
 * @param writer Writer to render to
 */
protected void serverinfo(final PrintWriter writer) {
  if (debug >= 1) {
    log("serverinfo");
  }
  try {
    final StringBuffer props = new StringBuffer(100);
    props.append("Tomcat Version: ");
    props.append(ServerInfo.getServerInfo());
    props.append("\nOS Name: ");
    props.append(System.getProperty("os.name"));
    props.append("\nOS Version: ");
    props.append(System.getProperty("os.version"));
    props.append("\nOS Architecture: ");
    props.append(System.getProperty("os.arch"));
    props.append("\nJVM Version: ");
    props.append(System.getProperty("java.runtime.version"));
    props.append("\nJVM Vendor: ");
    props.append(System.getProperty("java.vm.vendor"));
    writer.println(props.toString());
  } catch (Throwable t) {
    getServletContext().log("ManagerServlet.serverinfo", t);
    writer.println(sm.getString("managerServlet.exception",
            t.toString()));
  }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:ManagerServlet.java

示例3: serverinfo

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Writes System OS and JVM properties.
 * 
 * @param writer
 *            Writer to render to
 */
protected void serverinfo(PrintWriter writer, StringManager smClient) {
	if (debug >= 1)
		log("serverinfo");
	try {
		StringBuilder props = new StringBuilder();
		props.append("OK - Server info");
		props.append("\nTomcat Version: ");
		props.append(ServerInfo.getServerInfo());
		props.append("\nOS Name: ");
		props.append(System.getProperty("os.name"));
		props.append("\nOS Version: ");
		props.append(System.getProperty("os.version"));
		props.append("\nOS Architecture: ");
		props.append(System.getProperty("os.arch"));
		props.append("\nJVM Version: ");
		props.append(System.getProperty("java.runtime.version"));
		props.append("\nJVM Vendor: ");
		props.append(System.getProperty("java.vm.vendor"));
		writer.println(props.toString());
	} catch (Throwable t) {
		ExceptionUtils.handleThrowable(t);
		getServletContext().log("ManagerServlet.serverinfo", t);
		writer.println(smClient.getString("managerServlet.exception", t.toString()));
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:ManagerServlet.java

示例4: start

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
public boolean start() throws ContainerException {
    // load the web applications
    loadComponents();

    // Start the Tomcat server
    try {
        tomcat.getServer().start();
    } catch (LifecycleException e) {
        throw new ContainerException(e);
    }

    for (Connector con: tomcat.getService().findConnectors()) {
        Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " +
            (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
    }
    Debug.logInfo("Started " + ServerInfo.getServerInfo(), module);
    return true;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:19,代码来源:CatalinaContainer.java

示例5: process

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * The process message is responsible for processing an incoming serviceTask and generate
 * a response based on the incoming serviceTask input
 * @param serviceTask The serviceTask that will be processed by the service
 * @return A result based on the processed incoming serviceTask
 * @see ServiceTask
 * @see ServiceResult
 */
@Override
public ServiceResult<GetSystemInformationOutput> process(final ServiceTask<GetSystemInformationInput> serviceTask) {
    final SystemInformationDto systemInformation = new SystemInformationDto();
    systemInformation.setJavaVersion(System.getProperty("java.version"));
    systemInformation.setJavaVendor(System.getProperty("java.vendor"));
    systemInformation.setOperatingSystemName(System.getProperty("os.name"));
    systemInformation.setTomcatBuilt(ServerInfo.getServerBuilt());
    systemInformation.setTomcatInfo(ServerInfo.getServerInfo());
    systemInformation.setTomcatVersion(ServerInfo.getServerNumber());
    systemInformation.setAvailableProcessors(Runtime.getRuntime().availableProcessors());
    systemInformation.setTotalMemory(Runtime.getRuntime().totalMemory() / 1000000); // Megabytes
    systemInformation.setMaxMemory(Runtime.getRuntime().maxMemory() / 1000000); // Megabytes
    systemInformation.setFreeMemory(Runtime.getRuntime().freeMemory() / 1000000); // Megabytes
    systemInformation.setCastleMockHomeDirectory(this.castleMockHomeDirectory);
    final GetSystemInformationOutput output = new GetSystemInformationOutput(systemInformation);
    return createServiceResult(output);
}
 
开发者ID:castlemock,项目名称:castlemock,代码行数:26,代码来源:GetSystemInformationService.java

示例6: publishServerAsAService

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
private ServiceRegistration publishServerAsAService(StandardService server) {
	Properties props = new Properties();
	// put some extra properties to easily identify the service
	props.put(Constants.SERVICE_VENDOR, "Spring Dynamic Modules");
	props.put(Constants.SERVICE_DESCRIPTION, ServerInfo.getServerInfo());
	props.put(Constants.BUNDLE_VERSION, ServerInfo.getServerNumber());
	props.put(Constants.BUNDLE_NAME, bundleContext.getBundle().getSymbolicName());

	// spring-dm specific property
	props.put("org.springframework.osgi.bean.name", "tomcat-server");

	// publish just the interfaces and the major classes (server/handlerWrapper)
	String[] classes = new String[] { StandardService.class.getName(), Service.class.getName(),
		MBeanRegistration.class.getName(), Lifecycle.class.getName() };

	return bundleContext.registerService(classes, server, props);
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:18,代码来源:Activator.java

示例7: serverinfo

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Writes System OS and JVM properties.
 * @param writer Writer to render to
 */
protected void serverinfo(PrintWriter writer,  StringManager smClient) {
    if (debug >= 1)
        log("serverinfo");
    try {
        StringBuilder props = new StringBuilder();
        props.append("OK - Server info");
        props.append("\nTomcat Version: ");
        props.append(ServerInfo.getServerInfo());
        props.append("\nOS Name: ");
        props.append(System.getProperty("os.name"));
        props.append("\nOS Version: ");
        props.append(System.getProperty("os.version"));
        props.append("\nOS Architecture: ");
        props.append(System.getProperty("os.arch"));
        props.append("\nJVM Version: ");
        props.append(System.getProperty("java.runtime.version"));
        props.append("\nJVM Vendor: ");
        props.append(System.getProperty("java.vm.vendor"));
        writer.println(props.toString());
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        getServletContext().log("ManagerServlet.serverinfo",t);
        writer.println(smClient.getString("managerServlet.exception",
                t.toString()));
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:31,代码来源:ManagerServlet.java

示例8: open

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Open the new log file for the date specified by <code>dateStamp</code>.
 */
@Override
protected synchronized void open() {
    super.open();
    if (currentLogFile.length()==0) {
        writer.println("#Fields: " + pattern);
        writer.println("#Version: 2.0");
        writer.println("#Software: " + ServerInfo.getServerInfo());
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:13,代码来源:ExtendedAccessLogValve.java

示例9: startInternal

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
    
    // Log our server identification information
    if(log.isInfoEnabled())
        log.info( "Starting Servlet Engine: " + ServerInfo.getServerInfo());

    // Standard container startup
    super.startInternal();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:StandardEngine.java

示例10: open

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Open the new log file for the date specified by <code>dateStamp</code>.
 */
protected synchronized void open() {
    super.open();
    if (currentLogFile.length()==0) {
        writer.println("#Fields: " + pattern);
        writer.println("#Version: 2.0");
        writer.println("#Software: " + ServerInfo.getServerInfo());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:ExtendedAccessLogValve.java

示例11: addVersionInfo

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
private void addVersionInfo(List<MetricFamilySamples> mfs) {
    GaugeMetricFamily tomcatInfo = new GaugeMetricFamily(
            "tomcat_info",
            "tomcat version info",
            Arrays.asList("version", "build"));
    tomcatInfo.addMetric(Arrays.asList(ServerInfo.getServerNumber(), ServerInfo.getServerBuilt()), 1);
    mfs.add(tomcatInfo);
}
 
开发者ID:nlighten,项目名称:tomcat_exporter,代码行数:9,代码来源:TomcatGenericExports.java

示例12: open

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Open the new log file for the date specified by <code>dateStamp</code>.
 */
@Override
protected synchronized void open() {
	super.open();
	if (currentLogFile.length() == 0) {
		writer.println("#Fields: " + pattern);
		writer.println("#Version: 2.0");
		writer.println("#Software: " + ServerInfo.getServerInfo());
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:13,代码来源:ExtendedAccessLogValve.java

示例13: startInternal

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
/**
 * Start this component and implement the requirements of
 * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException
 *                if this component detects a fatal error that prevents this
 *                component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {

	// Log our server identification information
	if (log.isInfoEnabled())
		log.info("Starting Servlet Engine: " + ServerInfo.getServerInfo());

	// Standard container startup
	super.startInternal();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:19,代码来源:StandardEngine.java

示例14: startShouldCollectServerInfo

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
@Test
public void startShouldCollectServerInfo() throws Exception {
    // Given
    String expectedServerInfo = ServerInfo.getServerInfo();
    // When
    service.start();
    service.stop();
    // Then
    ServerMetaData serverMetaData = getServerMetaData();
    assertEquals(serverMetaData.getServerInfo(), expectedServerInfo);
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:12,代码来源:StandardServiceModifierTest.java

示例15: start

import org.apache.catalina.util.ServerInfo; //导入依赖的package包/类
public boolean start() throws ContainerException {
    // Start the Tomcat server
    try {
        tomcat.getServer().start();
    } catch (LifecycleException e) {
        throw new ContainerException(e);
    }

    // load the web applications
    loadComponents();

    for (Connector con: tomcat.getService().findConnectors()) {
        ProtocolHandler ph = con.getProtocolHandler();
        int port = con.getPort();
        con.setAttribute("port", port);
        if (ph instanceof Http11Protocol) {
            Http11Protocol hph = (Http11Protocol) ph;
            Debug.logInfo("Connector " + hph.getName() + " @ " + hph.getPort() + " - " +
                (hph.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
        } else {
            Debug.logInfo("Connector " + con.getProtocol() + " @ " + con.getPort() + " - " +
                (con.getSecure() ? "secure" : "not-secure") + " [" + con.getProtocolHandlerClassName() + "] started.", module);
        }
    }
    Debug.logInfo("Started " + ServerInfo.getServerInfo(), module);
    return true;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:28,代码来源:CatalinaContainer.java


注:本文中的org.apache.catalina.util.ServerInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。