(String name, Object value)
| 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 | /** |
no test coverage detected