@Override public Connector createConnector(org.apache.catalina.connector.Connector connector) { return new TomcatConnector(connector); } }
protected RequestGroupInfo getRequestGroupInfo() { Object connectionHandler = this.getConnectionHandler(); if (connectionHandler == null) return null; return this.getRequestGroupInfo(connectionHandler); }
protected Object getConnectionHandler() { return this.getProtocolHandlerProperty("cHandler"); }
@Override public String toString() { InetAddress address = this.getAddress(); return String.format("%s://%s:%d", this.getType(), (address != null) ? address.getHostAddress() : "<undefined>", this.connector.getPort()); }
@Override public long getBytesReceived() { RequestGroupInfo info = this.getRequestGroupInfo(); return (info != null) ? this.getRequestGroupInfo().getBytesReceived() : 0; }
Field findField(Class<?> targetClass, String name) { if ((targetClass == null) || Object.class.equals(targetClass)) return null; for (Field field: targetClass.getDeclaredFields()) { if (field.getName().equals(name)) { return field; } } return this.findField(targetClass.getSuperclass(), name); }
@Override public Type getType() { if (isAJP(this.connector)) return Type.AJP; ProtocolHandler handler = this.connector.getProtocolHandler(); return Boolean.TRUE.equals(IntrospectionUtils.getProperty(handler, "secure")) ? Type.HTTPS : Type.HTTP; }
@Override public long getRequestCount() { RequestGroupInfo info = this.getRequestGroupInfo(); return (info != null) ? this.getRequestGroupInfo().getRequestCount() : 0; }
protected Object getProtocolHandlerProperty(String property) { Field field = this.findField(this.connector.getProtocolHandler().getClass(), property); if (field == null) { return null; } field.setAccessible(true); try { return field.get(this.connector.getProtocolHandler()); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } }
protected Connector createConnector(org.apache.catalina.connector.Connector connector) { return new TomcatConnector(connector); }
@Override public long getBytesSent() { RequestGroupInfo info = this.getRequestGroupInfo(); return (info != null) ? this.getRequestGroupInfo().getBytesSent() : 0; }