Skip to content

Commit

Permalink
Re-apply code formatting. No functional change.
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Nov 22, 2024
1 parent 6280d27 commit 483fc81
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 63 deletions.
4 changes: 2 additions & 2 deletions java/org/apache/catalina/WebResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public interface WebResource {
String getETag();

/**
* Return the strong ETag if available else return the weak ETag calculated from the
* content length and last modified.
* Return the strong ETag if available else return the weak ETag calculated from the content length and last
* modified.
*
* @return The ETag for this resource
*/
Expand Down
44 changes: 17 additions & 27 deletions java/org/apache/catalina/manager/StatusTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,10 @@ public static void writeConnectorState(PrintWriter writer, ObjectName tpName, St
}
appendJSonValue(writer, "name", jsonName).append(',').println();
indent(writer, 3).append('"').append("threadInfo").append('"').append(':').append('{');
appendJSonValue(writer, "maxThreads", mBeanServer.getAttribute(tpName, "maxThreads"))
appendJSonValue(writer, "maxThreads", mBeanServer.getAttribute(tpName, "maxThreads")).append(',');
appendJSonValue(writer, "currentThreadCount", mBeanServer.getAttribute(tpName, "currentThreadCount"))
.append(',');
appendJSonValue(writer, "currentThreadCount",
mBeanServer.getAttribute(tpName, "currentThreadCount")).append(',');
appendJSonValue(writer, "currentThreadsBusy",
mBeanServer.getAttribute(tpName, "currentThreadsBusy"));
appendJSonValue(writer, "currentThreadsBusy", mBeanServer.getAttribute(tpName, "currentThreadsBusy"));
writer.append('}');

ObjectName grpName = null;
Expand All @@ -471,12 +469,10 @@ public static void writeConnectorState(PrintWriter writer, ObjectName tpName, St
writer.append(',').println();
indent(writer, 3).append('"').append("requestInfo").append('"').append(':').append('{');
appendJSonValue(writer, "maxTime", mBeanServer.getAttribute(grpName, "maxTime")).append(',');
appendJSonValue(writer, "processingTime",
mBeanServer.getAttribute(grpName, "processingTime")).append(',');
appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(grpName, "requestCount"))
.append(',');
appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(grpName, "errorCount"))
appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(grpName, "processingTime"))
.append(',');
appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(grpName, "requestCount")).append(',');
appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(grpName, "errorCount")).append(',');
appendJSonValue(writer, "bytesReceived", mBeanServer.getAttribute(grpName, "bytesReceived"))
.append(',');
appendJSonValue(writer, "bytesSent", mBeanServer.getAttribute(grpName, "bytesSent"));
Expand Down Expand Up @@ -838,8 +834,7 @@ protected static void writeContext(PrintWriter writer, ObjectName objectName, MB
appendJSonValue(writer, "startTime",
new Date(((Long) mBeanServer.getAttribute(objectName, "startTime")).longValue()).toString())
.append(',');
appendJSonValue(writer, "startupTime", mBeanServer.getAttribute(objectName, "startupTime"))
.append(',');
appendJSonValue(writer, "startupTime", mBeanServer.getAttribute(objectName, "startupTime")).append(',');
appendJSonValue(writer, "tldScanTime", mBeanServer.getAttribute(objectName, "tldScanTime"));
if (managerON != null) {
writeManager(writer, managerON, mBeanServer, mode);
Expand Down Expand Up @@ -909,18 +904,16 @@ public static void writeManager(PrintWriter writer, ObjectName objectName, MBean
.append(',');
appendJSonValue(writer, "sessionCounter", mBeanServer.getAttribute(objectName, "sessionCounter"))
.append(',');
appendJSonValue(writer, "maxActive", mBeanServer.getAttribute(objectName, "maxActive"))
appendJSonValue(writer, "maxActive", mBeanServer.getAttribute(objectName, "maxActive")).append(',');
appendJSonValue(writer, "rejectedSessions", mBeanServer.getAttribute(objectName, "rejectedSessions"))
.append(',');
appendJSonValue(writer, "expiredSessions", mBeanServer.getAttribute(objectName, "expiredSessions"))
.append(',');
appendJSonValue(writer, "sessionMaxAliveTime", mBeanServer.getAttribute(objectName, "sessionMaxAliveTime"))
.append(',');
appendJSonValue(writer, "rejectedSessions",
mBeanServer.getAttribute(objectName, "rejectedSessions")).append(',');
appendJSonValue(writer, "expiredSessions",
mBeanServer.getAttribute(objectName, "expiredSessions")).append(',');
appendJSonValue(writer, "sessionMaxAliveTime",
mBeanServer.getAttribute(objectName, "sessionMaxAliveTime")).append(',');
appendJSonValue(writer, "sessionAverageAliveTime",
mBeanServer.getAttribute(objectName, "sessionAverageAliveTime")).append(',');
appendJSonValue(writer, "processingTime",
mBeanServer.getAttribute(objectName, "processingTime"));
appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(objectName, "processingTime"));
writer.append('}');
}

Expand Down Expand Up @@ -1022,12 +1015,9 @@ public static void writeWrapper(PrintWriter writer, ObjectName objectName, MBean
appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(objectName, "processingTime"))
.append(',');
appendJSonValue(writer, "maxTime", mBeanServer.getAttribute(objectName, "maxTime")).append(',');
appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(objectName, "requestCount"))
.append(',');
appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(objectName, "errorCount"))
.append(',');
appendJSonValue(writer, "loadTime", mBeanServer.getAttribute(objectName, "loadTime"))
.append(',');
appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(objectName, "requestCount")).append(',');
appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(objectName, "errorCount")).append(',');
appendJSonValue(writer, "loadTime", mBeanServer.getAttribute(objectName, "loadTime")).append(',');
appendJSonValue(writer, "classLoadTime", mBeanServer.getAttribute(objectName, "classLoadTime"));
writer.append('}');
}
Expand Down
70 changes: 37 additions & 33 deletions java/org/apache/catalina/servlets/WebdavServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
* this configuration.
* <p>
* Mapping a subpath (e.g. <code>/webdav/*</code> to this servlet has the effect of re-mounting the entire web
* application under that sub-path, with WebDAV access to all the resources. To restore the DefaultServlet
* behavior set <code>serveSubpathOnly</code> to <code>true</code>. The <code>WEB-INF</code> and
* <code>META-INF</code> directories are protected in this re-mounted resource tree.
* application under that sub-path, with WebDAV access to all the resources. To restore the DefaultServlet behavior set
* <code>serveSubpathOnly</code> to <code>true</code>. The <code>WEB-INF</code> and <code>META-INF</code> directories
* are protected in this re-mounted resource tree.
* <p>
* To enable WebDAV for a context add the following to web.xml:
*
Expand Down Expand Up @@ -135,14 +135,13 @@
* access will be able to edit content available via http://host:port/context/content using
* http://host:port/context/webdavedit/content
* <p>
* The Servlet provides support for arbitrary dead properties on all resources (dead properties are properties
* whose values are not protected by the server, such as the content length of a resource). By default the Servlet
* will use non persistent memory storage for them. Persistence can be achieved by implementing
* the <code>PropertyStore</code> interface and configuring the Servlet to use that store.
* The <code>propertyStore</code> init-param allows configuring the classname of the store to use, while the
* parameters in the form of <code>store.xxx</code> will be set on the store object as bean properties.
* For example, this would configure a store with class <code>com.MyPropertyStore</code>, and set its field
* <code>myName</code> to value <code>myValue</code>:
* The Servlet provides support for arbitrary dead properties on all resources (dead properties are properties whose
* values are not protected by the server, such as the content length of a resource). By default the Servlet will use
* non persistent memory storage for them. Persistence can be achieved by implementing the <code>PropertyStore</code>
* interface and configuring the Servlet to use that store. The <code>propertyStore</code> init-param allows configuring
* the classname of the store to use, while the parameters in the form of <code>store.xxx</code> will be set on the
* store object as bean properties. For example, this would configure a store with class
* <code>com.MyPropertyStore</code>, and set its field <code>myName</code> to value <code>myValue</code>:
*
* <pre>
* &lt;init-param&gt;
Expand Down Expand Up @@ -203,7 +202,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen
*/
protected static final String SUPPORTED_LOCKS =
"\n <D:lockentry><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry>\n" +
" <D:lockentry><D:lockscope><D:shared/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry>\n";
" <D:lockentry><D:lockscope><D:shared/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry>\n";

/**
* Simple date format for the creation date ISO representation (partial).
Expand Down Expand Up @@ -249,8 +248,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen
private boolean strictIfProcessing = true;

/**
* Serve resources from the mounted subpath only, restoring the behavior of
* {@code DefaultServlet}.
* Serve resources from the mounted subpath only, restoring the behavior of {@code DefaultServlet}.
*/
private boolean serveSubpathOnly = false;

Expand Down Expand Up @@ -364,10 +362,9 @@ public void periodicEvent() {


/**
* Handling of dead properties on resources. This interface allows
* providing storage for dead properties. Store configuration is done
* through the <code>propertyStore</code> init parameter of the WebDAV
* Servlet, which should contain the class name of the store.
* Handling of dead properties on resources. This interface allows providing storage for dead properties. Store
* configuration is done through the <code>propertyStore</code> init parameter of the WebDAV Servlet, which should
* contain the class name of the store.
*/
public interface PropertyStore {

Expand All @@ -389,7 +386,7 @@ public interface PropertyStore {
/**
* Copy resource. Dead properties should be copied to the destination path.
*
* @param source the copy source path
* @param source the copy source path
* @param destination the copy destination path
*/
void copy(String source, String destination);
Expand All @@ -404,19 +401,20 @@ public interface PropertyStore {
/**
* Generate propfind XML fragments for dead properties.
*
* @param resource the resource path
* @param property the dead property, if null then all dead properties must be written
* @param nameOnly true if only the property name element should be generated
* @param resource the resource path
* @param property the dead property, if null then all dead properties must be written
* @param nameOnly true if only the property name element should be generated
* @param generatedXML the current generated XML for the PROPFIND response
* @return true if a property was specified and a corresponding dead property was found on the resource,
* false otherwise
*
* @return true if a property was specified and a corresponding dead property was found on the resource, false
* otherwise
*/
boolean propfind(String resource, Node property, boolean nameOnly, XMLWriter generatedXML);

/**
* Apply proppatch to the specified resource.
*
* @param resource the resource path on which to apply the proppatch
* @param resource the resource path on which to apply the proppatch
* @param operations the set and remove to apply, the final status codes of the result should be set on each
* operation
*/
Expand All @@ -438,7 +436,8 @@ public static class ProppatchOperation {

/**
* PROPPATCH operation constructor.
* @param updateType the update type, either SET or REMOVE
*
* @param updateType the update type, either SET or REMOVE
* @param propertyNode the XML node that contains the property name (and value if SET)
*/
public ProppatchOperation(PropertyUpdateType updateType, Node propertyNode) {
Expand Down Expand Up @@ -490,15 +489,18 @@ public boolean getProtectedProperty() {
* Type of PROPFIND request.
*/
enum PropfindType {
FIND_BY_PROPERTY, FIND_ALL_PROP, FIND_PROPERTY_NAMES
FIND_BY_PROPERTY,
FIND_ALL_PROP,
FIND_PROPERTY_NAMES
}


/**
* Type of property update in a PROPPATCH.
*/
enum PropertyUpdateType {
SET, REMOVE
SET,
REMOVE
}


Expand Down Expand Up @@ -1758,8 +1760,9 @@ protected void doUnlock(HttpServletRequest req, HttpServletResponse resp) throws
} else {
if ((parentPath != path && parentLock.depth > 0) || parentPath == path) {
if (parentLock.isExclusive()) {
if (lockTokenHeader.contains(":" + parentLock.token + ">") && (parentLock.principal == null ||
parentLock.principal.equals(req.getRemoteUser()))) {
if (lockTokenHeader.contains(":" + parentLock.token + ">") &&
(parentLock.principal == null ||
parentLock.principal.equals(req.getRemoteUser()))) {
resourceLocks.remove(parentPath);
unlocked = true;
break;
Expand Down Expand Up @@ -1959,7 +1962,8 @@ private boolean isLocked(String path, String principal, String ifHeader) {
(lock.principal == null || lock.principal.equals(principal))) {
return false;
}
// Since it is a shared lock, continue to look up the tree but note that there was a lock
// Since it is a shared lock, continue to look up the tree but note that there
// was a lock
unmatchedSharedLock = true;
}
}
Expand Down Expand Up @@ -2576,8 +2580,8 @@ private void propfindResource(XMLWriter generatedXML, String rewrittenUrl, Strin

for (Node propertyNode : properties) {
String property = getDAVNode(propertyNode);
boolean protectedProperty =
property != null && (!(property.equals("displayname") || property.equals("getcontentlanguage")));
boolean protectedProperty = property != null &&
(!(property.equals("displayname") || property.equals("getcontentlanguage")));
if (property == null || !protectedProperty) {
if (!store.propfind(path, propertyNode, false, generatedXML)) {
propertiesNotFound.add(propertyNode);
Expand Down
3 changes: 2 additions & 1 deletion java/org/apache/catalina/startup/Catalina.java
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,8 @@ protected void generateClassHeader(Digester digester, boolean start) {
code.append(" implements ");
code.append(ServerXml.class.getName().replace('$', '.')).append(" {").append(System.lineSeparator());
code.append("public void load(").append(Catalina.class.getName());
code.append(' ').append(digester.toVariableName(this)).append(") throws Exception {").append(System.lineSeparator());
code.append(' ').append(digester.toVariableName(this)).append(") throws Exception {")
.append(System.lineSeparator());
}


Expand Down

0 comments on commit 483fc81

Please sign in to comment.