本文整理汇总了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()));
}
}
示例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()));
}
}
示例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()));
}
}
示例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;
}
示例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);
}
示例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);
}
示例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()));
}
}
示例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());
}
}
示例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();
}
示例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());
}
}
示例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);
}
示例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());
}
}
示例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();
}
示例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);
}
示例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;
}