Updates the built-in date variables (DATE_GMT, DATE_LOCAL, LAST_MODIFIED). @param fromConstructor true if called from the constructor
(boolean fromConstructor)
| 521 | * @param fromConstructor true if called from the constructor |
| 522 | */ |
| 523 | protected void setDateVariables(boolean fromConstructor) { |
| 524 | boolean alreadySet = ssiExternalResolver.getVariableValue(className + ".alreadyset") != null; |
| 525 | // skip this if we are being called from the constructor, and this has already been set |
| 526 | if (!(fromConstructor && alreadySet)) { |
| 527 | ssiExternalResolver.setVariableValue(className + ".alreadyset", "true"); |
| 528 | Date date = new Date(); |
| 529 | TimeZone timeZone = TimeZone.getTimeZone("GMT"); |
| 530 | String retVal = formatDate(date, timeZone); |
| 531 | /* |
| 532 | * If we are setting on of the date variables, we want to remove them from the user defined list of |
| 533 | * variables, because this is what Apache does. |
| 534 | */ |
| 535 | setVariableValue("DATE_GMT", null); |
| 536 | ssiExternalResolver.setVariableValue(className + ".DATE_GMT", retVal); |
| 537 | retVal = formatDate(date, null); |
| 538 | setVariableValue("DATE_LOCAL", null); |
| 539 | ssiExternalResolver.setVariableValue(className + ".DATE_LOCAL", retVal); |
| 540 | retVal = formatDate(new Date(lastModifiedDate), null); |
| 541 | setVariableValue("LAST_MODIFIED", null); |
| 542 | ssiExternalResolver.setVariableValue(className + ".LAST_MODIFIED", retVal); |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | |
| 547 | /** |
no test coverage detected