Java Code Examples for org.apache.catalina.util.ServerInfo#getServerInfo()

The following examples show how to use org.apache.catalina.util.ServerInfo#getServerInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandardServiceStartInterceptor.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (isDebug) {
        logger.afterInterceptor(target, args, result, throwable);
    }

    String serverInfo = ServerInfo.getServerInfo();
    ServerMetaDataHolder holder = this.traceContext.getServerMetaDataHolder();
    holder.setServerName(serverInfo);
    holder.notifyListeners();
}
 
Example 2
Source File: StandardServiceModifierTest.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
@Test
public void startShouldCollectServerInfo() throws Exception {
    // Given
    String expectedServerInfo = ServerInfo.getServerInfo();
    // When
    service.start();
    service.stop();
    // Then
    ServerMetaData serverMetaData = getServerMetaData();
    assertEquals(expectedServerInfo, serverMetaData.getServerInfo());
}
 
Example 3
Source File: ServerListener.java    From tomee with Apache License 2.0 5 votes vote down vote up
private synchronized void installServerInfo() {
    if (SystemInstance.get().getOptions().get("tomee.keep-server-info", false)) {
        return;
    }

    // force static init
    final String value = ServerInfo.getServerInfo();

    Field field = null;
    boolean acc = true;
    try {
        field = ServerInfo.class.getDeclaredField("serverInfo");
        acc = field.isAccessible();
        final int slash = value.indexOf('/');
        field.setAccessible(true);
        final String tomeeVersion = OpenEjbVersion.get().getVersion();
        final int modifiers = field.getModifiers();
        if (Modifier.isFinal(modifiers)) { // this is a bit fragile, we can surely drop this feature at some point
            final Field modifiersField = Field.class.getDeclaredField("modifiers");
            modifiersField.setAccessible(true);
            modifiersField.setInt(field, modifiers & ~Modifier.FINAL);
        }
        field.set(null, value.substring(0, slash) + " (TomEE)" + value.substring(slash) + " (" + tomeeVersion + ")");
    } catch (final Exception e) {
        // no-op
    } finally {
        if (field != null) {
            field.setAccessible(acc);
        }
    }
}
 
Example 4
Source File: ApplicationContext.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
public String getServerInfo() {
    return ServerInfo.getServerInfo();
}
 
Example 5
Source File: StandardServer.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * Report the current Tomcat Server Release number
 * @return Tomcat release identifier
 */
public String getServerInfo() {

    return ServerInfo.getServerInfo();
}
 
Example 6
Source File: CheckServerInfoTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Test
public void checkServerInfo() {
    final String serverInfo = ServerInfo.getServerInfo();
    assertTrue(serverInfo, serverInfo.startsWith("Apache Tomcat"));
}
 
Example 7
Source File: ApplicationContext.java    From Tomcat7.0.67 with Apache License 2.0 3 votes vote down vote up
/**
 * Return the name and version of the servlet container.
 */
@Override
public String getServerInfo() {

    return (ServerInfo.getServerInfo());

}
 
Example 8
Source File: ApplicationContext.java    From tomcatsrc with Apache License 2.0 3 votes vote down vote up
/**
 * Return the name and version of the servlet container.
 */
@Override
public String getServerInfo() {

    return (ServerInfo.getServerInfo());

}
 
Example 9
Source File: StandardServer.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * Report the current Tomcat Server Release number
 * @return Tomcat release identifier
 */
public String getServerInfo() {
    return ServerInfo.getServerInfo();
}
 
Example 10
Source File: StandardServer.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Report the current Tomcat Server Release number
 * @return Tomcat release identifier
 */
public String getServerInfo() {
    return ServerInfo.getServerInfo();
}