ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/catalina/valves/ValveBase.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/catalina/valves/ValveBase.java
Status
scanned
Type
file
Name
ValveBase.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
6434 (6.3 KB)
MD5
70f19f2699e740992c302c5fed9025f7
SHA1
57326e0f1eddbb6f1bb4e38b41d59d6f98cd91dc
SHA256
01d8ff5a90fa64fc7fc98ef2f36ce06bf7c6775aeb653b4974f8338c819b7310
SHA512

      
    
SHA1_git
882bb69087aa7189a734b92cbad2e2490ee2c67a
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
ValveBase.java | 6.3 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.catalina.valves; import org.apache.catalina.Contained; import org.apache.catalina.Container; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleState; import org.apache.catalina.Pipeline; import org.apache.catalina.Valve; import org.apache.catalina.util.LifecycleMBeanBase; import org.apache.catalina.util.ToStringUtil; import org.apache.juli.logging.Log; import org.apache.tomcat.util.res.StringManager; /** * Convenience base class for implementations of the <b>Valve</b> interface. A subclass <strong>MUST</strong> implement * an <code>invoke()</code> method to provide the required functionality, and <strong>MAY</strong> implement the * <code>Lifecycle</code> interface to provide configuration management and lifecycle support. */ public abstract class ValveBase extends LifecycleMBeanBase implements Contained, Valve { protected static final StringManager sm = StringManager.getManager(ValveBase.class); // ------------------------------------------------------ Constructor public ValveBase() { this(false); } public ValveBase(boolean asyncSupported) { this.asyncSupported = asyncSupported; } // ------------------------------------------------------ Instance Variables /** * Does this valve support Servlet 3+ async requests? */ protected boolean asyncSupported; /** * The Container whose pipeline this Valve is a component of. */ protected Container container = null; /** * Container log */ protected Log containerLog = null; /** * The next Valve in the pipeline this Valve is a component of. */ protected Valve next = null; // -------------------------------------------------------------- Properties @Override public Container getContainer() { return container; } @Override public void setContainer(Container container) { this.container = container; } @Override public boolean isAsyncSupported() { return asyncSupported; } public void setAsyncSupported(boolean asyncSupported) { this.asyncSupported = asyncSupported; } @Override public Valve getNext() { return next; } @Override public void setNext(Valve valve) { this.next = valve; } // ---------------------------------------------------------- Public Methods /** * {@inheritDoc} * <p> * The default implementation is NO-OP. */ @Override public void backgroundProcess() { // NOOP by default } @Override protected void initInternal() throws LifecycleException { super.initInternal(); containerLog = getContainer().getLogger(); } /** * 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 void startInternal() throws LifecycleException { setState(LifecycleState.STARTING); } /** * Stop this component and implement the requirements of * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. * * @exception LifecycleException if this component detects a fatal error that prevents this component from being * used */ @Override protected void stopInternal() throws LifecycleException { setState(LifecycleState.STOPPING); } @Override public String toString() { return ToStringUtil.toString(this); } // -------------------- JMX and Registration -------------------- @Override public String getObjectNameKeyProperties() { StringBuilder name = new StringBuilder("type=Valve"); Container container = getContainer(); name.append(container.getMBeanKeyProperties()); int seq = 0; // Pipeline may not be present in unit testing Pipeline p = container.getPipeline(); if (p != null) { for (Valve valve : p.getValves()) { // Skip null valves if (valve == null) { continue; } // Only compare valves in pipeline until we find this valve if (valve == this) { break; } if (valve.getClass() == this.getClass()) { // Duplicate valve earlier in pipeline // increment sequence number seq++; } } } if (seq > 0) { name.append(",seq="); name.append(seq); } String className = this.getClass().getName(); int period = className.lastIndexOf('.'); if (period >= 0) { className = className.substring(period + 1); } name.append(",name="); name.append(className); return name.toString(); } @Override public String getDomainInternal() { Container c = getContainer(); if (c == null) { return null; } else { return c.getDomain(); } } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
20.62
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9