MCPcopy Create free account
hub / github.com/apache/tomcat / setAttribute

Method setAttribute

java/org/apache/catalina/connector/Request.java:1419–1448  ·  view source on GitHub ↗
(String name, Object value)

Source from the content-addressed store, hash-verified

1417
1418
1419 @Override
1420 public void setAttribute(String name, Object value) {
1421 // Null value is the same as removeAttribute()
1422 if (value == null) {
1423 removeAttribute(name);
1424 return;
1425 }
1426
1427 if (name == null) {
1428 throw new IllegalArgumentException(sm.getString("request.nullAttributeName"));
1429 }
1430
1431 // Special attributes
1432 SpecialAttributeAdapter adapter = specialAttributes.get(name);
1433 if (adapter != null) {
1434 adapter.set(this, name, value);
1435 return;
1436 }
1437
1438 // Add or replace the specified attribute
1439 Object oldValue = attributes.put(name, value);
1440
1441 // Pass special attributes to the native layer
1442 if (name.startsWith("org.apache.tomcat.")) {
1443 coyoteRequest.setAttribute(name, value);
1444 }
1445
1446 // Notify interested application event listeners
1447 notifyAttributeAssigned(name, value, oldValue);
1448 }
1449
1450
1451 /**

Callers 2

dispatchMethod · 0.95
handleReadExceptionMethod · 0.95

Calls 8

removeAttributeMethod · 0.95
setMethod · 0.95
getStringMethod · 0.65
getMethod · 0.65
putMethod · 0.65
setAttributeMethod · 0.65
startsWithMethod · 0.45

Tested by

no test coverage detected