-
-
-
-
-
-
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
index ba192fe..79de5a8 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2019, Erik C. Thauvin (erik@thauvin.net)
+Copyright (c) 2015-2025, Erik C. Thauvin (erik@thauvin.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -24,4 +24,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
index 3ba27e1..40bc87c 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,37 @@
-# HttpStatus JSP Tag Library
+# HttpStatus JSP Tag Library
-[](https://github.com/ethauvin/httpstatus/releases/latest) [](https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik.httpstatus/httpstatus) [](https://bintray.com/ethauvin/maven/HttpStatus/_latestVersion)
-[](http://opensource.org/licenses/BSD-3-Clause) [](https://snyk.io/test/github/ethauvin/httpstatus?targetFile=build.gradle) [](https://sonarcloud.io/dashboard?id=ethauvin_HttpStatus)
-[](https://travis-ci.org/ethauvin/HttpStatus) [](https://ci.appveyor.com/project/ethauvin/httpstatus) [](https://circleci.com/gh/ethauvin/HttpStatus/tree/master)
+[](http://opensource.org/licenses/BSD-3-Clause)
+[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
+[](https://rife2.com/bld)
+[](https://github.com/ethauvin/httpstatus/releases/latest)
+[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/httpstatus/httpstatus/)
+[](https://central.sonatype.com/artifact/net.thauvin.erik.httpstatus/httpstatus)
+[](https://snyk.io/test/github/ethauvin/httpstatus?targetFile=pom.xml)
+[](https://sonarcloud.io/summary/new_code?id=ethauvin_HttpStatus)
+[](https://github.com/ethauvin/httpstatus/actions/workflows/bld.yml)
+[](https://circleci.com/gh/ethauvin/HttpStatus/tree/master)
-A simple [JSP](http://www.oracle.com/technetwork/java/javaee/jsp/index.html) Tag Library to display the [code](#hscode), [reason](#hsreason) and/or [cause](#hscode) for [HTTP status codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) in JSP error pages.
+A simple [JSP](http://www.oracle.com/technetwork/java/javaee/jsp/index.html) Tag Library to display the [code](#hscode), [reason](#hsreason), [cause](#hscode) and/or [message](#hsmessage) for [HTTP status codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) in JSP error pages.
+
+## Table of Contents
+
+- [Examples](#examples)
+- [Usage](#usage)
+ - [Gradle](#gradle)
+ - [bld](#bld)
+ - [Maven](#maven)
+- [JSP Tags](#jsp-tags)
+ - [hs:cause](#hscause)
+ - [hs:code](#hscode)
+ - [hs:message](#hsmessage)
+ - [hs:reason](#hsreason)
+- [StatusCode Bean](#statuscode-bean)
+- [Reasons](#reasons)
+- [Command Line Usage](#command-line-usage)
+- [Contributing](#contributing)
+
+## Examples
For example:
@@ -17,6 +43,7 @@ For example:
Cause:
+Message:
...
```
@@ -27,11 +54,53 @@ or
<%= Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()) %>
```
-would display on a [501 status code](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2):
+would display on a [501 status code](https://www.rfc-editor.org/rfc/rfc9110.html#name-501-not-implemented):
- Not Implemented
+```console
+Not Implemented
+```
-## hs:cause
+## Usage
+
+### [Gradle](https://gradle.org/)
+
+Include the following in your `build.gradle` file:
+
+```gradle
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ implementation 'net.thauvin.erik.httpstatus:httpstatus:1.1.1'
+}
+```
+
+### [bld](https://rife2.com/bld)
+
+Include the following in your `bld` build file:
+
+```java
+scope(compile).include(
+ dependency("net.thauvin.erik.httpstatus","httpstatus", version(1, 1, 0))
+);
+```
+
+### [Maven](http://maven.apache.org/)
+
+As a `Maven` artifact:
+
+```xml
+
+ net.thauvin.erik.httpstatus
+ httpstatus
+ 1.1.1
+
+```
+
+## JSP Tags
+
+### hs:cause
The `` tag displays the cause of current HTTP status code, if any. A shorthand for:
@@ -41,157 +110,262 @@ The `` tag displays the cause of current HTTP status code, if any. A
Optional attributes are:
-Attribute | Description
------------ | -------------------------------------------------------------------------------------------
-`default` | The fallback value to output, if no cause is available.
-`escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default.
+| Attribute | Description |
+| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `default` | The fallback value to output, if no cause is |
+| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
+
+### hs:code
-## hs:code
The `` tag displays the current HTTP status code, if any. A shorthand for:
```jsp
<%= pageContext.getErrorData().getStatusCode() %>
```
-## hs:reason
+### hs:message
-The `` tag displays the reason for a HTTP status code, if any. Optional attributes are:
+The `` tag displays the current error message, if any. A shorthand for:
-Attribute | Description
------------ | -------------------------------------------------------------------------------------------
-`code` | The HTTP status error code. If not specified the current status code is used.
-`default` | The fallback value to output, if no reason is available.
-`escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default.
+```jsp
+<%= request.getAttribute("javax.servlet.error.message") %>
+```
-The reasons are defined in a [ResourceBundle](http://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html) properties as follows:
+Optional attributes are:
-Status Code | Reason
------------ | -----------------------------------
-`100` | Continue
-`101` | Switching Protocols
-`102` | Processing
-`103` | Early Hints
-`200` | OK
-`201` | Created
-`202` | Accepted
-`203` | Non-Authoritative Information
-`204` | No Content
-`205` | Reset Content
-`206` | Partial Content
-`207` | Multi-Status
-`208` | Already Reported
-`226` | IM Used
-`300` | Multiple Choices
-`301` | Moved Permanently
-`302` | Found/Moved Temporarily
-`303` | See Other
-`304` | Not Modified
-`305` | Use Proxy
-`306` | Switch Proxy
-`307` | Temporary Redirect
-`308` | Permanent Redirect
-`400` | Bad Request
-`401` | Unauthorized
-`402` | Payment Required
-`403` | Forbidden
-`404` | Not Found
-`405` | Method Not Allowed
-`406` | Not Acceptable
-`407` | Proxy Authentication Required
-`408` | Request Timeout
-`409` | Conflict
-`410` | Gone
-`411` | Length Required
-`412` | Precondition Failed
-`413` | Request Entity/Payload Too Large
-`414` | Request-URI Too Long
-`415` | Unsupported Media Type
-`416` | Requested Range Not Satisfiable
-`417` | Expectation Failed
-`418` | I'm A Teapot
-`419` | Insufficient Space on Resource
-`420` | Method Failure
-`421` | Misdirected Request
-`422` | Unprocessable Entity
-`423` | Locked
-`424` | Failed Dependency
-`426` | Upgrade Required
-`428` | Precondition Required
-`429` | Too Many Requests
-`431` | Request Header Fields Too Large
-`440` | Login Timeout
-`444` | No Response
-`449` | Retry With
-`450` | Blocked by Windows Parental Controls
-`451` | Unavailable For Legal Reasons
-`494` | Request Header Too Large
-`495` | Cert Error
-`496` | No Cert
-`497` | HTTP to HTTPS
-`498` | Token Expired/Invalid
-`499` | Client Closed Request
-`500` | Internal Server Error
-`501` | Not Implemented
-`502` | Bad Gateway
-`503` | Service Unavailable
-`504` | Gateway Timeout
-`505` | HTTP Version Not Supported
-`506` | Variant Also Negotiates
-`507` | Insufficient Storage
-`508` | Loop Detected
-`509` | Bandwidth Limit Exceeded
-`510` | Not Extended
-`511` | Network Authentication Required
-`520` | Unknown Error
-`522` | Origin Connection Time-out
-`598` | Network Read Timeout Error
-`599` | Network Connect Timeout Error
+| Attribute | Description |
+| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `default` | The fallback value to output, if no error message is available. |
+| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
-## Usage with [Gradle](https://gradle.org/) or [Maven](http://maven.apache.org/)
-Include the following in your `build.gradle` file:
+### hs:reason
-```gradle
-dependencies {
- compile 'net.thauvin.erik.httpstatus:httpstatus:1.0.4'
+The `` tag displays the reason for an HTTP status code, if any. Optional attributes are:
+
+| Attribute | Description |
+| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `default` | The fallback value to output, if no reason is available. |
+| `code` | The HTTP status error code. If not specified the current status code is used. |
+| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
+
+## StatusCode Bean
+
+The `StatusCode` bean can be used to check the class of the status code error. For example, using the JSTL:
+
+```jsp
+<%@ taglib prefix="hs" uri="http://erik.thauvin.net/taglibs/httpstatus" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+
+
+
+
+ An error occurred on your side. ()
+
+
+ An error occurred on our side. ()
+
+
+```
+
+or in a Servlet:
+
+```java
+import net.thauvin.erik.httpstatus.StatusCode;
+
+public class ExampleServlet extends HttpServlet {
+ public void doGet(HttpServletRequest request, HttpServletResponse response) {
+ var statusCode = new StatusCode(
+ (Integer) request.getAttribute("javax.servlet.error.status_code"));
+ if (statusCode.isError()) {
+ if (statusCode.isServerError()) {
+ var reason = statusCode.getReason();
+ } else {
+ // ...
+ }
+ }
+ }
}
```
-or as a Maven artifact:
+The `StatusCode` bean methods are:
-```xml
-
- net.thauvin.erik.httpstatus
- httpstatus
- 1.0.4
-
-```
+| Method | Description |
+| --------------- | -------------------------------------------------------------------- |
+| `getReason` | Returns the reason for the status code (eg: `Internal Server Error`) |
+| `isClientError` | Checks if the status code is a client error. |
+| `isError` | Checks if the status code is a server or client error. |
+| `isInfo` | Checks if the status code is informational. |
+| `isRedirect` | Checks if the status code is a redirect. |
+| `isServerError` | Checks if the status code is a server error. |
+| `isSuccess` | Checks if the status code is a success. (`OK`) |
+| `isValid` | Checks if the status code is valid. |
+
+## Reasons
+
+The reasons are defined in a [ResourceBundle](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ResourceBundle.html) properties as follows:
+
+| Status Code | Reason |
+| ----------- | ---------------------------------------------------------- |
+| `100` | Continue |
+| `101` | Switching Protocols |
+| `102` | Processing |
+| `103` | Early Hints |
+| `110` | Response is Stale |
+| `111` | Revalidation Failed |
+| `112` | Disconnected Operation |
+| `113` | Heuristic Expiration |
+| `199` | Miscellaneous Warning |
+| `200` | OK |
+| `201` | Created |
+| `202` | Accepted |
+| `203` | Non-Authoritative Information |
+| `204` | No Content |
+| `205` | Reset Content |
+| `206` | Partial Content |
+| `207` | Multi-Status |
+| `208` | Already Reported |
+| `214` | Transformation Applied |
+| `218` | This is fine |
+| `226` | IM Used |
+| `299` | Miscellaneous Persistent Warning |
+| `300` | Multiple Choices |
+| `301` | Moved Permanently |
+| `302` | Found/Moved Temporarily |
+| `303` | See Other |
+| `304` | Not Modified |
+| `305` | Use Proxy |
+| `306` | Unused |
+| `307` | Temporary Redirect |
+| `308` | Permanent Redirect |
+| `400` | Bad Request |
+| `401` | Unauthorized |
+| `402` | Payment Required |
+| `403` | Forbidden |
+| `404` | Not Found |
+| `405` | Method Not Allowed |
+| `406` | Not Acceptable |
+| `407` | Proxy Authentication Required |
+| `408` | Request Timeout |
+| `409` | Conflict |
+| `410` | Gone |
+| `411` | Length Required |
+| `412` | Precondition Failed |
+| `413` | Payload Too Large |
+| `414` | URI Too Long |
+| `415` | Unsupported Media Type |
+| `416` | Range Not Satisfiable |
+| `417` | Expectation Failed |
+| `418` | I'm A Teapot |
+| `419` | Insufficient Space on Resource |
+| `420` | Method Failure |
+| `421` | Misdirected Request |
+| `422` | Unprocessable Content |
+| `423` | Locked |
+| `424` | Failed Dependency |
+| `425` | Too Early |
+| `426` | Upgrade Required |
+| `428` | Precondition Required |
+| `429` | Too Many Requests |
+| `430` | Request Header Fields Too Large |
+| `431` | Request Header Fields Too Large |
+| `440` | Login Timeout |
+| `444` | No Response |
+| `449` | Retry With |
+| `450` | Blocked by Windows Parental Controls |
+| `451` | Unavailable For Legal Reasons |
+| `460` | Client Closed Connection Before Load Balancer Idle Timeout |
+| `463` | X-Forwarded-For Header with More than 30 IP Addresses |
+| `494` | Request Header Too Large |
+| `495` | SSL Certificate Error |
+| `496` | SSL Certificate Required |
+| `497` | HTTP Request Sent to HTTPS Port |
+| `498` | Token Expired/Invalid |
+| `499` | Client Closed Request |
+| `500` | Internal Server Error |
+| `501` | Not Implemented |
+| `502` | Bad Gateway |
+| `503` | Service Unavailable |
+| `504` | Gateway Timeout |
+| `505` | HTTP Version Not Supported |
+| `506` | Variant Also Negotiates |
+| `507` | Insufficient Storage |
+| `508` | Loop Detected |
+| `509` | Bandwidth Limit Exceeded |
+| `510` | Not Extended |
+| `511` | Network Authentication Required |
+| `520` | Unknown Error |
+| `521` | Web Server Is Down |
+| `522` | Connection Timed Out |
+| `523` | Origin Is Unreachable |
+| `524` | A Timeout Occurred |
+| `525` | SSL Handshake Failed |
+| `526` | Invalid SSL Certificate |
+| `527` | Railgun Error |
+| `529` | Site is overloaded |
+| `530` | Site is frozen |
+| `540` | Temporarily Disabled |
+| `561` | Unauthorized |
+| `598` | Network Read Timeout Error |
+| `599` | Network Connect Timeout Error |
+| `783` | Unexpected Token |
## Command Line Usage
+
You can query the reason phrase for status codes as follows:
-```sh
-$ java -jar httpstatus-1.0.4.jar 404 500
+```console
+$ java -jar httpstatus-1.1.1.jar 404 500
404: Not Found
500: Internal Server Error
```
If no status code is specified, all will be printed:
-```sh
-$ java -jar httpstatus-1.0.4.jar
+```console
+$ java -jar httpstatus-1.1.1.jar
100: Continue
101: Switching Protocols
102: Processing
103: Early Hints
+110: Response is Stale
+111: Revalidation Failed
+112: Disconnected Operation
+113: Heuristic Expiration
+199: Miscellaneous Warning
200: OK
201: Created
202: Accepted
203: Non-Authoritative Information
-204: No Content
-205: Reset Content
-206: Partial Content
-207: Multi-Status
-208: Already Reported
-226: IM Used
...
```
+
+You can also print status codes by [response classes](https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes):
+
+```console
+$ java -jar httpstatus-1.1.1.jar 2xx
+200: OK
+201: Created
+202: Accepted
+203: Non-Authoritative Information
+...
+```
+
+## Contributing
+
+If you want to contribute to this project, all you have to do is clone the GitHub
+repository:
+
+```console
+git clone git@github.com:ethauvin/HttpStatus.git
+```
+
+Then use [bld](https://rife2.com/bld) to build:
+
+```console
+cd HttpStatus
+./bld compile
+```
+
+The project has an [IntelliJ IDEA](https://www.jetbrains.com/idea/) project structure. You can just open it after all
+the dependencies were downloaded and peruse the code.
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 0ee7361..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-version: "{branch} {build}"
-skip_tags: true
-
-build:
- verbosity: detailed
-
-build_script:
- - gradlew.bat assemble --info --no-daemon
-
-test_script:
- - gradlew.bat check --info --no-daemon
-
-branches:
- only:
- - master
-
-cache:
- - C:\Users\appveyor\.gradle
-
-environment:
- matrix:
- - JAVA_HOME: C:\Program Files\Java\jdk1.8.0
- - JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0
-
-matrix:
- fast_finish: true
diff --git a/bld b/bld
new file mode 100755
index 0000000..0880033
--- /dev/null
+++ b/bld
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.httpstatus.HttpStatusBuild "$@"
\ No newline at end of file
diff --git a/bld.bat b/bld.bat
new file mode 100644
index 0000000..2810ee8
--- /dev/null
+++ b/bld.bat
@@ -0,0 +1,4 @@
+@echo off
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.httpstatus.HttpStatusBuild %*
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 3df0a0b..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,247 +0,0 @@
-plugins {
- id 'checkstyle'
- id 'java'
- id 'jacoco'
- id 'idea'
- id 'application'
- id 'maven'
- id 'maven-publish'
- id 'pmd'
- id 'com.jfrog.bintray' version '1.8.4'
- id 'com.github.ben-manes.versions' version '0.21.0'
- id 'net.thauvin.erik.gradle.semver' version '1.0.0'
- id 'com.github.spotbugs' version '1.7.1'
- id 'org.sonarqube' version '2.7'
-}
-
-import com.github.spotbugs.SpotBugsTask
-import org.apache.tools.ant.taskdefs.condition.Os
-
-defaultTasks 'deploy'
-
-def deployDir = 'deploy'
-
-def mavenName = 'HttpStatus'
-def mavenDescription = 'HttpStatus JSP Tag Library'
-def mavenUrl = 'https://github.com/ethauvin/HttpStatus'
-def mavenLicense = 'The BSD 3-Clause License'
-def mavenLicenseUrl = 'http://opensource.org/licenses/BSD-3-Clause'
-def mavenScmCon = 'https://github.com/ethauvin/HttpStatus.git'
-def mavenScmDevCon = 'git@github.com:ethauvin/HttpStatus.git'
-
-def pkgLicenses = ['BSD 3-Clause']
-def pkgIssueTrackerUrl = mavenUrl + '/issues'
-def pkgLabels = ['jsp', 'tag library', 'http', 'status code', 'java']
-
-group = 'net.thauvin.erik.httpstatus'
-
-mainClassName = 'net.thauvin.erik.httpstatus.Reasons'
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
-
-repositories {
- mavenLocal()
- jcenter()
-}
-
-dependencies {
- implementation 'javax.servlet:javax.servlet-api:4.0.1'
- implementation 'javax.servlet.jsp:jsp-api:2.2.1-b03'
-
- spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0'
- spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.3.sb'
-
- compileOnly 'com.github.spotbugs:spotbugs-annotations:3.1.12'
- testCompileOnly 'com.github.spotbugs:spotbugs-annotations:3.1.12'
-
- testImplementation 'org.testng:testng:6.14.3'
-}
-
-javadoc {
- title = mavenDescription + ' ' + version
- options.source = 8
- options.tags = ['created']
- options.author = true
- options.links('https://docs.oracle.com/javase/8/docs/api/')
- options.addStringOption('Xdoclint:none', '-quiet')
-}
-
-compileJava {
- //options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
-}
-
-
-jar {
- manifest.attributes('Main-Class': mainClassName)
-}
-
-clean {
- doLast {
- project.delete(fileTree(deployDir))
- }
-}
-
-test {
- useTestNG()
-}
-
-pmd {
- ruleSetFiles = files("config/pmd.xml")
- ruleSets = []
-}
-
-tasks.withType(SpotBugsTask) {
- reports {
- xml.enabled = false
- html.enabled = true
- }
- excludeFilter = file("$projectDir/config/spotbugs/excludeFilter.xml")
-}
-
-tasks.withType(Checkstyle) {
- reports {
- xml.enabled = false
- html.enabled = true
- }
-}
-
-bintray {
- user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
- key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
- publications = ['MyPublication']
- dryRun = false
- pkg {
- repo = 'maven'
- name = mavenName
- licenses = pkgLicenses
- desc = mavenDescription
- websiteUrl = mavenUrl
- issueTrackerUrl = pkgIssueTrackerUrl
- vcsUrl = mavenScmCon
- labels = pkgLabels
- publicDownloadNumbers = true
- version {
- gpg {
- sign = true
- }
- }
- }
-}
-
-bintrayUpload {
- versionName = "$project.version"
- versionDesc = "$mavenName $project.version"
- versionVcsTag = "$project.version"
- versionReleased = new Date()
-}
-
-task javadocJar(type: Jar, dependsOn: javadoc) {
- group = 'Build'
- description = 'Builds an archive of the javadoc docs.'
- archiveClassifier = 'javadoc'
- from javadoc.destinationDir
-}
-
-task sourcesJar(type: Jar) {
- group = 'Build'
- description = 'Builds an archive of the source code.'
- archiveClassifier = 'sources'
- from sourceSets.main.allSource
-}
-
-artifacts {
- archives javadocJar
- archives sourcesJar
-}
-
-publishing {
- publications {
- MyPublication(MavenPublication) {
- from components.java
- artifact sourcesJar
- artifact javadocJar
- groupId project.group
- artifactId rootProject.name
-
- pom {
- name = mavenName
- description = mavenDescription
- url = mavenUrl
- licenses {
- license {
- name = mavenLicense
- url = mavenLicenseUrl
- distribution = 'repo'
- }
- }
- developers {
- developer {
- id = 'ethauvin'
- name = 'Erik C. Thauvin'
- email = 'erik@thauvin.net'
- }
- }
- scm {
- connection = 'scm:git:' + mavenScmCon
- developerConnection = 'scm:git:' + mavenScmDevCon
- url = mavenScmCon
- }
- }
- }
- }
-}
-
-task copyToDeploy(type: Copy) {
- from(configurations.runtime) {
- exclude 'javax.servlet-api-*.jar'
- exclude 'jsp-api-*.jar'
- }
- from jar
- into deployDir
-}
-
-task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) {
- description = 'Copies all needed files to the ${deployDir} directory.'
- group = 'Publishing'
- outputs.dir deployDir
- inputs.files copyToDeploy
- mustRunAfter clean
-}
-
-task release(dependsOn: ['wrapper', 'deploy']) {
- group = 'Publishing'
- description = 'Releases new version.'
-}
-
-task pandoc(type: Exec) {
- group = 'Documentation'
- def pandoc_args = ['--from', 'gfm',
- '--to', 'html5',
- '--metadata', "pagetitle=$mavenDescription",
- '-s',
- '-c', 'github-pandoc.css',
- '-o', 'docs/README.html',
- 'README.md']
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
- commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
- } else {
- executable 'pandoc'
- args pandoc_args
- }
- standardOutput = new ByteArrayOutputStream()
- ext.output = {
- return standardOutput.toString()
- }
-}
-
-sonarqube {
- properties {
- property("sonar.projectKey", "ethauvin_HttpStatus")
- property("sonar.sourceEncoding", "UTF-8")
- }
-}
-
-tasks.sonarqube {
- dependsOn("jacocoTestReport")
-}
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
deleted file mode 100644
index c426276..0000000
--- a/config/checkstyle/checkstyle.xml
+++ /dev/null
@@ -1,267 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/config/pmd.xml b/config/pmd.xml
index 6e60806..2641880 100644
--- a/config/pmd.xml
+++ b/config/pmd.xml
@@ -5,250 +5,105 @@
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
Erik's Ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
- ^ignore$
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
diff --git a/config/spotbugs/excludeFilter.xml b/config/spotbugs/excludeFilter.xml
deleted file mode 100644
index ddb2db1..0000000
--- a/config/spotbugs/excludeFilter.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
diff --git a/docs/README.html b/docs/README.html
deleted file mode 100644
index aaf1876..0000000
--- a/docs/README.html
+++ /dev/null
@@ -1,514 +0,0 @@
-
-
-
-
-
-
- HttpStatus JSP Tag Library
-
-
-
-
-
-
-
-
-
diff --git a/docs/github-pandoc.css b/docs/github-pandoc.css
deleted file mode 100644
index d7edd25..0000000
--- a/docs/github-pandoc.css
+++ /dev/null
@@ -1,425 +0,0 @@
-/* github-pandoc.css found at https://gist.github.com/dashed/6714393 */
-/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
-
-/* ==========================================================================
- HTML5 display definitions
- ========================================================================== */
-
-/**
- * Correct `block` display not defined in IE 8/9.
- */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-main,
-nav,
-section,
-summary {
- display: block;
-}
-
-/**
- * Correct `inline-block` display not defined in IE 8/9.
- */
-
-audio,
-canvas,
-video {
- display: inline-block;
-}
-
-/**
- * Prevent modern browsers from displaying `audio` without controls.
- * Remove excess height in iOS 5 devices.
- */
-
-audio:not([controls]) {
- display: none;
- height: 0;
-}
-
-/**
- * Address `[hidden]` styling not present in IE 8/9.
- * Hide the `template` element in IE, Safari, and Firefox < 22.
- */
-
-[hidden],
-template {
- display: none;
-}
-
-/* ==========================================================================
- Base
- ========================================================================== */
-
-/**
- * 1. Set default font family to sans-serif.
- * 2. Prevent iOS text size adjust after orientation change, without disabling
- * user zoom.
- */
-
-html {
- font-family: sans-serif; /* 1 */
- -ms-text-size-adjust: 100%; /* 2 */
- -webkit-text-size-adjust: 100%; /* 2 */
-}
-
-/**
- * Remove default margin.
- */
-
-body {
- margin: 0;
-}
-
-/* ==========================================================================
- Links
- ========================================================================== */
-
-/**
- * Remove the gray background color from active links in IE 10.
- */
-
-a {
- background: transparent;
-}
-
-/**
- * Address `outline` inconsistency between Chrome and other browsers.
- */
-
-a:focus {
- outline: thin dotted;
-}
-
-/**
- * Improve readability when focused and also mouse hovered in all browsers.
- */
-
-a:active,
-a:hover {
- outline: 0;
-}
-
-/* ==========================================================================
- Typography
- ========================================================================== */
-
-/**
- * Address variable `h1` font-size and margin within `section` and `article`
- * contexts in Firefox 4+, Safari 5, and Chrome.
- */
-
-h1 {
- font-size: 2em;
- margin: 0.67em 0;
-}
-
-/**
- * Address styling not present in IE 8/9, Safari 5, and Chrome.
- */
-
-abbr[title] {
- border-bottom: 1px dotted;
-}
-
-/**
- * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
- */
-
-b,
-strong {
- font-weight: bold;
-}
-
-/**
- * Address styling not present in Safari 5 and Chrome.
- */
-
-dfn {
- font-style: italic;
-}
-
-/**
- * Address differences between Firefox and other browsers.
- */
-
-hr {
- -moz-box-sizing: content-box;
- box-sizing: content-box;
- height: 0;
-}
-
-/**
- * Address styling not present in IE 8/9.
- */
-
-mark {
- background: #ff0;
- color: #000;
-}
-
-/**
- * Correct font family set oddly in Safari 5 and Chrome.
- */
-
-code,
-kbd,
-pre,
-samp {
- font-family: monospace, serif;
- font-size: 1em;
-}
-
-/**
- * Improve readability of pre-formatted text in all browsers.
- */
-
-pre {
- white-space: pre-wrap;
-}
-
-/**
- * Set consistent quote types.
- */
-
-q {
- quotes: "\201C" "\201D" "\2018" "\2019";
-}
-
-/**
- * Address inconsistent and variable font size in all browsers.
- */
-
-small {
- font-size: 80%;
-}
-
-/**
- * Prevent `sub` and `sup` affecting `line-height` in all browsers.
- */
-
-sub,
-sup {
- font-size: 75%;
- line-height: 0;
- position: relative;
- vertical-align: baseline;
-}
-
-sup {
- top: -0.5em;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-/* ==========================================================================
- Embedded content
- ========================================================================== */
-
-/**
- * Remove border when inside `a` element in IE 8/9.
- */
-
-img {
- border: 0;
-}
-
-/**
- * Correct overflow displayed oddly in IE 9.
- */
-
-svg:not(:root) {
- overflow: hidden;
-}
-
-/* ==========================================================================
- Figures
- ========================================================================== */
-
-/**
- * Address margin not present in IE 8/9 and Safari 5.
- */
-
-figure {
- margin: 0;
-}
-
-/* ==========================================================================
- Forms
- ========================================================================== */
-
-/**
- * Define consistent border, margin, and padding.
- */
-
-fieldset {
- border: 1px solid #c0c0c0;
- margin: 0 2px;
- padding: 0.35em 0.625em 0.75em;
-}
-
-/**
- * 1. Correct `color` not being inherited in IE 8/9.
- * 2. Remove padding so people aren't caught out if they zero out fieldsets.
- */
-
-legend {
- border: 0; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * 1. Correct font family not being inherited in all browsers.
- * 2. Correct font size not being inherited in all browsers.
- * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
- */
-
-button,
-input,
-select,
-textarea {
- font-family: inherit; /* 1 */
- font-size: 100%; /* 2 */
- margin: 0; /* 3 */
-}
-
-/**
- * Address Firefox 4+ setting `line-height` on `input` using `!important` in
- * the UA stylesheet.
- */
-
-button,
-input {
- line-height: normal;
-}
-
-/**
- * Address inconsistent `text-transform` inheritance for `button` and `select`.
- * All other form control elements do not inherit `text-transform` values.
- * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
- * Correct `select` style inheritance in Firefox 4+ and Opera.
- */
-
-button,
-select {
- text-transform: none;
-}
-
-/**
- * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
- * and `video` controls.
- * 2. Correct inability to style clickable `input` types in iOS.
- * 3. Improve usability and consistency of cursor style between image-type
- * `input` and others.
- */
-
-button,
-html input[type="button"], /* 1 */
-input[type="reset"],
-input[type="submit"] {
- -webkit-appearance: button; /* 2 */
- cursor: pointer; /* 3 */
-}
-
-/**
- * Re-set default cursor for disabled elements.
- */
-
-button[disabled],
-html input[disabled] {
- cursor: default;
-}
-
-/**
- * 1. Address box sizing set to `content-box` in IE 8/9/10.
- * 2. Remove excess padding in IE 8/9/10.
- */
-
-input[type="checkbox"],
-input[type="radio"] {
- box-sizing: border-box; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
- * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
- * (include `-moz` to future-proof).
- */
-
-input[type="search"] {
- -webkit-appearance: textfield; /* 1 */
- -moz-box-sizing: content-box;
- -webkit-box-sizing: content-box; /* 2 */
- box-sizing: content-box;
-}
-
-/**
- * Remove inner padding and search cancel button in Safari 5 and Chrome
- * on OS X.
- */
-
-input[type="search"]::-webkit-search-cancel-button,
-input[type="search"]::-webkit-search-decoration {
- -webkit-appearance: none;
-}
-
-/**
- * Remove inner padding and border in Firefox 4+.
- */
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
- border: 0;
- padding: 0;
-}
-
-/**
- * 1. Remove default vertical scrollbar in IE 8/9.
- * 2. Improve readability and alignment in all browsers.
- */
-
-textarea {
- overflow: auto; /* 1 */
- vertical-align: top; /* 2 */
-}
-
-/* ==========================================================================
- Tables
- ========================================================================== */
-
-/**
- * Remove most spacing between table cells.
- */
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-.go-top {
-position: fixed;
-bottom: 2em;
-right: 2em;
-text-decoration: none;
-background-color: #E0E0E0;
-font-size: 12px;
-padding: 1em;
-display: inline;
-}
-
-/* Github css */
-
-html,body{ margin: auto;
- padding-right: 1em;
- padding-left: 1em;
- max-width: 44em; color:black;}*:not('#mkdbuttons'){margin:0;padding:0}body{font:13.34px helvetica,arial,freesans,clean,sans-serif;-webkit-font-smoothing:subpixel-antialiased;line-height:1.4;padding:3px;background:#fff;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px}p{margin:1em 0}a{color:#4183c4;text-decoration:none}body{background-color:#fff;padding:30px;margin:15px;font-size:14px;line-height:1.6}body>*:first-child{margin-top:0!important}body>*:last-child{margin-bottom:0!important}@media screen{body{box-shadow:0 0 0 1px #cacaca,0 0 0 4px #eee}}h1,h2,h3,h4,h5,h6{margin:20px 0 10px;padding:0;font-weight:bold;-webkit-font-smoothing:subpixel-antialiased;cursor:text}h1{font-size:28px;color:#000}h2{font-size:24px;border-bottom:1px solid #ccc;color:#000}h3{font-size:18px;color:#333}h4{font-size:16px;color:#333}h5{font-size:14px;color:#333}h6{color:#777;font-size:14px}p,blockquote,table,pre{margin:15px 0}ul{padding-left:30px}ol{padding-left:30px}ol li ul:first-of-type{margin-top:0}hr{background:transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAECAYAAACtBE5DAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OENDRjNBN0E2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OENDRjNBN0I2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4Q0NGM0E3ODY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4Q0NGM0E3OTY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqqezsUAAAAfSURBVHjaYmRABcYwBiM2QSA4y4hNEKYDQxAEAAIMAHNGAzhkPOlYAAAAAElFTkSuQmCC) repeat-x 0 0;border:0 none;color:#ccc;height:4px;padding:0}body>h2:first-child{margin-top:0;padding-top:0}body>h1:first-child{margin-top:0;padding-top:0}body>h1:first-child+h2{margin-top:0;padding-top:0}body>h3:first-child,body>h4:first-child,body>h5:first-child,body>h6:first-child{margin-top:0;padding-top:0}a:first-child h1,a:first-child h2,a:first-child h3,a:first-child h4,a:first-child h5,a:first-child h6{margin-top:0;padding-top:0}h1+p,h2+p,h3+p,h4+p,h5+p,h6+p,ul li>:first-child,ol li>:first-child{margin-top:0}dl{padding:0}dl dt{font-size:14px;font-weight:bold;font-style:italic;padding:0;margin:15px 0 5px}dl dt:first-child{padding:0}dl dt>:first-child{margin-top:0}dl dt>:last-child{margin-bottom:0}dl dd{margin:0 0 15px;padding:0 15px}dl dd>:first-child{margin-top:0}dl dd>:last-child{margin-bottom:0}blockquote{border-left:4px solid #DDD;padding:0 15px;color:#777}blockquote>:first-child{margin-top:0}blockquote>:last-child{margin-bottom:0}table{border-collapse:collapse;border-spacing:0;font-size:100%;font:inherit}table th{font-weight:bold;border:1px solid #ccc;padding:6px 13px}table td{border:1px solid #ccc;padding:6px 13px}table tr{border-top:1px solid #ccc;background-color:#fff}table tr:nth-child(2n){background-color:#f8f8f8}img{max-width:100%}code,tt{margin:0 2px;padding:0 5px;white-space:nowrap;border:1px solid #eaeaea;background-color:#f8f8f8;border-radius:3px;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;color:#333}pre>code{margin:0;padding:0;white-space:pre;border:0;background:transparent}.highlight pre{background-color:#f8f8f8;border:1px solid #ccc;font-size:13px;line-height:19px;overflow:auto;padding:6px 10px;border-radius:3px}pre{background-color:#f8f8f8;border:1px solid #ccc;font-size:13px;line-height:19px;overflow:auto;padding:6px 10px;border-radius:3px}pre code,pre tt{background-color:transparent;border:0}.poetry pre{font-family:Georgia,Garamond,serif!important;font-style:italic;font-size:110%!important;line-height:1.6em;display:block;margin-left:1em}.poetry pre code{font-family:Georgia,Garamond,serif!important;word-break:break-all;word-break:break-word;-webkit-hyphens:auto;-moz-hyphens:auto;hyphens:auto;white-space:pre-wrap}sup,sub,a.footnote{font-size:1.4ex;height:0;line-height:1;vertical-align:super;position:relative}sub{vertical-align:sub;top:-1px}@media print{body{background:#fff}img,pre,blockquote,table,figure{page-break-inside:avoid}body{background:#fff;border:0}code{background-color:#fff;color:#333!important;padding:0 .2em;border:1px solid #dedede}pre{background:#fff}pre code{background-color:white!important;overflow:visible}}@media screen{body.inverted{color:#eee!important;border-color:#555;box-shadow:none}.inverted body,.inverted hr .inverted p,.inverted td,.inverted li,.inverted h1,.inverted h2,.inverted h3,.inverted h4,.inverted h5,.inverted h6,.inverted th,.inverted .math,.inverted caption,.inverted dd,.inverted dt,.inverted blockquote{color:#eee!important;border-color:#555;box-shadow:none}.inverted td,.inverted th{background:#333}.inverted h2{border-color:#555}.inverted hr{border-color:#777;border-width:1px!important}::selection{background:rgba(157,193,200,0.5)}h1::selection{background-color:rgba(45,156,208,0.3)}h2::selection{background-color:rgba(90,182,224,0.3)}h3::selection,h4::selection,h5::selection,h6::selection,li::selection,ol::selection{background-color:rgba(133,201,232,0.3)}code::selection{background-color:rgba(0,0,0,0.7);color:#eee}code span::selection{background-color:rgba(0,0,0,0.7)!important;color:#eee!important}a::selection{background-color:rgba(255,230,102,0.2)}.inverted a::selection{background-color:rgba(255,230,102,0.6)}td::selection,th::selection,caption::selection{background-color:rgba(180,237,95,0.5)}.inverted{background:#0b2531;background:#252a2a}.inverted body{background:#252a2a}.inverted a{color:#acd1d5}}.highlight .c{color:#998;font-style:italic}.highlight .err{color:#a61717;background-color:#e3d2d2}.highlight .k,.highlight .o{font-weight:bold}.highlight .cm{color:#998;font-style:italic}.highlight .cp{color:#999;font-weight:bold}.highlight .c1{color:#998;font-style:italic}.highlight .cs{color:#999;font-weight:bold;font-style:italic}.highlight .gd{color:#000;background-color:#fdd}.highlight .gd .x{color:#000;background-color:#faa}.highlight .ge{font-style:italic}.highlight .gr{color:#a00}.highlight .gh{color:#999}.highlight .gi{color:#000;background-color:#dfd}.highlight .gi .x{color:#000;background-color:#afa}.highlight .go{color:#888}.highlight .gp{color:#555}.highlight .gs{font-weight:bold}.highlight .gu{color:#800080;font-weight:bold}.highlight .gt{color:#a00}.highlight .kc,.highlight .kd,.highlight .kn,.highlight .kp,.highlight .kr{font-weight:bold}.highlight .kt{color:#458;font-weight:bold}.highlight .m{color:#099}.highlight .s{color:#d14}.highlight .na{color:#008080}.highlight .nb{color:#0086b3}.highlight .nc{color:#458;font-weight:bold}.highlight .no{color:#008080}.highlight .ni{color:#800080}.highlight .ne,.highlight .nf{color:#900;font-weight:bold}.highlight .nn{color:#555}.highlight .nt{color:#000080}.highlight .nv{color:#008080}.highlight .ow{font-weight:bold}.highlight .w{color:#bbb}.highlight .mf,.highlight .mh,.highlight .mi,.highlight .mo{color:#099}.highlight .sb,.highlight .sc,.highlight .sd,.highlight .s2,.highlight .se,.highlight .sh,.highlight .si,.highlight .sx{color:#d14}.highlight .sr{color:#009926}.highlight .s1{color:#d14}.highlight .ss{color:#990073}.highlight .bp{color:#999}.highlight .vc,.highlight .vg,.highlight .vi{color:#008080}.highlight .il{color:#099}.highlight .gc{color:#999;background-color:#eaf2f5}.type-csharp .highlight .k,.type-csharp .highlight .kt{color:#00F}.type-csharp .highlight .nf{color:#000;font-weight:normal}.type-csharp .highlight .nc{color:#2b91af}.type-csharp .highlight .nn{color:#000}.type-csharp .highlight .s,.type-csharp .highlight .sc{color:#a31515}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index 5c2d1cf..0000000
Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index f4d7b2b..0000000
--- a/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
deleted file mode 100755
index b0d6d0a..0000000
--- a/gradlew
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/usr/bin/env sh
-
-#
-# Copyright 2015 the original author or authors.
-#
-# Licensed 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.
-#
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
deleted file mode 100644
index 9991c50..0000000
--- a/gradlew.bat
+++ /dev/null
@@ -1,100 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem http://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar
new file mode 100644
index 0000000..7d0825c
Binary files /dev/null and b/lib/bld/bld-wrapper.jar differ
diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties
new file mode 100644
index 0000000..418f275
--- /dev/null
+++ b/lib/bld/bld-wrapper.properties
@@ -0,0 +1,7 @@
+bld.downloadExtensionJavadoc=false
+bld.downloadExtensionSources=true
+bld.downloadLocation=
+bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10
+bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.3
+bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES,MAVEN_LOCAL,RIFE2_SNAPSHOTS
+bld.version=2.2.1
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..73cf087
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,50 @@
+
+
+ 4.0.0
+ net.thauvin.erik.httpstatus
+ httpstatus
+ 1.1.2-SNAPSHOT
+ HttpStatus
+ Tag library to display the code, reason, cause and/or message for HTTP status codes in JSP error pages
+ https://github.com/ethauvin/HttpStatus
+
+
+ The BSD 3-Clause License
+ https://opensource.org/licenses/BSD-3-Clause
+
+
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 6.1.0
+ compile
+
+
+ jakarta.servlet.jsp
+ jakarta.servlet.jsp-api
+ 4.0.0
+ compile
+
+
+ jakarta.el
+ jakarta.el-api
+ 6.0.1
+ compile
+
+
+
+
+ ethauvin
+ Erik C. Thauvin
+ erik@thauvin.net
+ https://erik.thauvin.net/
+
+
+
+ scm:git:https://github.com/ethauvin/HttpStatus.git
+ scm:git:git@github.com:ethauvin/HttpStatus.git
+ https://github.com/ethauvin/HttpStatus
+
+
diff --git a/settings.gradle b/settings.gradle
deleted file mode 100644
index b28649f..0000000
--- a/settings.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * This settings file was auto generated by the Gradle buildInit task
- * by 'erik' at '12/2/15 1:19 PM' with Gradle 2.9
- *
- * The settings file is used to specify which projects to include in your build.
- * In a single project build this file can be empty or even removed.
- *
- * Detailed information about configuring a multi-project build in Gradle can be found
- * in the user guide at https://docs.gradle.org/2.9/userguide/multi_project_builds.html
- */
-
-/*
-// To declare projects as part of a multi-project build use the 'include' method
-include 'shared'
-include 'api'
-include 'services:webservice'
-*/
-
-rootProject.name = 'httpstatus'
\ No newline at end of file
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0000000..468f000
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,7 @@
+sonar.organization=ethauvin-github
+sonar.projectKey=ethauvin_HttpStatus
+sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
+sonar.sources=src/main/java/
+sonar.tests=src/test/java/
+sonar.java.binaries=build/main,build/test
+sonar.java.libraries=lib/compile/*.jar
\ No newline at end of file
diff --git a/src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java b/src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java
new file mode 100644
index 0000000..9c36ca8
--- /dev/null
+++ b/src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java
@@ -0,0 +1,157 @@
+/*
+ * HttpStatusBuild.java
+ *
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of this project nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.thauvin.erik.httpstatus;
+
+import rife.bld.BuildCommand;
+import rife.bld.Project;
+import rife.bld.extension.JacocoReportOperation;
+import rife.bld.extension.PmdOperation;
+import rife.bld.publish.*;
+import rife.tools.exceptions.FileUtilsErrorException;
+
+import java.io.File;
+import java.util.List;
+import java.util.jar.Attributes;
+
+import static rife.bld.dependencies.Repository.*;
+import static rife.bld.dependencies.Scope.compile;
+import static rife.bld.dependencies.Scope.test;
+import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
+
+public class HttpStatusBuild extends Project {
+ final PmdOperation pmdOp = new PmdOperation()
+ .fromProject(this)
+ .failOnViolation(true)
+ .ruleSets("config/pmd.xml");
+
+ public HttpStatusBuild() {
+ pkg = "net.thauvin.erik.httpstatus";
+ name = "HttpStatus";
+ version = version(1, 1, 2, "SNAPSHOT");
+
+ var description = "Tag library to display the code, reason, cause and/or message for HTTP status codes in JSP error pages";
+ var url = "https://github.com/ethauvin/HttpStatus";
+
+ mainClass = "net.thauvin.erik.httpstatus.Reasons";
+
+ javaRelease = 17;
+
+ downloadSources = true;
+ autoDownloadPurge = true;
+ repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
+
+ scope(compile)
+ .include(dependency("jakarta.servlet", "jakarta.servlet-api", version(6, 1, 0)))
+ .include(dependency("jakarta.servlet.jsp", "jakarta.servlet.jsp-api", version(4, 0, 0)))
+ .include(dependency("jakarta.el", "jakarta.el-api", version(6, 0, 1)));
+ scope(test)
+ .include(dependency("org.assertj", "assertj-core", version(3, 27, 3)))
+ .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 2)))
+ .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 2)));
+
+ jarOperation().manifestAttribute(Attributes.Name.MAIN_CLASS, pkg + '.' + "Reasons");
+
+ javadocOperation().javadocOptions()
+ .docTitle(description + ' ' + version.toString())
+ .docLint(NO_MISSING)
+ .link("https://jakarta.ee/specifications/platform/9/apidocs/");
+
+ publishOperation()
+ .repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS_LEGACY.location())
+ .withCredentials(property("sonatype.user"), property("sonatype.password"))
+ : repository(SONATYPE_RELEASES_LEGACY.location())
+ .withCredentials(property("sonatype.user"), property("sonatype.password")))
+ .repository(repository("github"))
+ .info(new PublishInfo()
+ .groupId(pkg)
+ .artifactId(name.toLowerCase())
+ .name(name)
+ .version(version)
+ .description(description)
+ .url(url)
+ .developer(new PublishDeveloper()
+ .id("ethauvin")
+ .name("Erik C. Thauvin")
+ .email("erik@thauvin.net")
+ .url("https://erik.thauvin.net/")
+ )
+ .license(new PublishLicense()
+ .name("The BSD 3-Clause License")
+ .url("https://opensource.org/licenses/BSD-3-Clause")
+ )
+ .scm(new PublishScm()
+ .connection("scm:git:" + url + ".git")
+ .developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git")
+ .url(url))
+ .signKey(property("sign.key"))
+ .signPassphrase(property("sign.passphrase")));
+ }
+
+ public static void main(String[] args) {
+ new HttpStatusBuild().start(args);
+ }
+
+ @BuildCommand(summary = "Generates JaCoCo Reports")
+ public void jacoco() throws Exception {
+ new JacocoReportOperation()
+ .fromProject(this)
+ .execute();
+ }
+
+ @BuildCommand(summary = "Runs PMD analysis")
+ public void pmd() throws Exception {
+ pmdOp.execute();
+ }
+
+ @BuildCommand(value = "pmd-cli", summary = "Runs PMD analysis (CLI)")
+ public void pmdCli() throws Exception {
+ pmdOp.includeLineNumber(false).execute();
+ }
+
+ private void pomRoot() throws FileUtilsErrorException {
+ PomBuilder.generateInto(publishOperation().fromProject(this).info(), dependencies(),
+ new File(workDirectory, "pom.xml"));
+ }
+
+ @Override
+ public void publish() throws Exception {
+ super.publish();
+ pomRoot();
+ }
+
+ @Override
+ public void publishLocal() throws Exception {
+ super.publishLocal();
+ pomRoot();
+ }
+}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/Reasons.java b/src/main/java/net/thauvin/erik/httpstatus/Reasons.java
index 5a4ce5c..62b20f0 100644
--- a/src/main/java/net/thauvin/erik/httpstatus/Reasons.java
+++ b/src/main/java/net/thauvin/erik/httpstatus/Reasons.java
@@ -1,7 +1,7 @@
/*
* Reasons.java
*
- * Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,11 +32,8 @@
package net.thauvin.erik.httpstatus;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
import java.util.Map;
import java.util.ResourceBundle;
-import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
@@ -44,7 +41,7 @@ import java.util.concurrent.ConcurrentHashMap;
* Populates the {@link #REASON_PHRASES reason phrases} map from {@link #BUNDLE_BASENAME bundle properties}, and
* implements accessor methods.
*
- * @author Erik C. Thauvin
+ * @author Erik C. Thauvin
* @created 2015-12-02
* @since 1.0
*/
@@ -60,8 +57,8 @@ public final class Reasons {
// Initializes the reason phrases map.
static {
- final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
- for (final String key : bundle.keySet()) {
+ var bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
+ for (var key : bundle.keySet()) {
REASON_PHRASES.put(key, bundle.getString(key));
}
}
@@ -79,7 +76,7 @@ public final class Reasons {
* @param statusCode The status code.
* @return The reason phrase, or null.
*/
- public static String getReasonPhrase(final int statusCode) {
+ public static String getReasonPhrase(int statusCode) {
return getReasonPhrase(Integer.toString(statusCode));
}
@@ -89,32 +86,37 @@ public final class Reasons {
* @param statusCode The status code.
* @return The reason phrase, or null.
*/
- @SuppressWarnings({"WeakerAccess"})
- public static String getReasonPhrase(final String statusCode) {
+ public static String getReasonPhrase(String statusCode) {
return REASON_PHRASES.get(statusCode);
}
/**
* Prints the reason phrase for the given status code(s).
*
- * @param args The status code(s), prints all if none.
+ * @param args The status code(s) or response class(es), prints all if none.
*/
@SuppressWarnings("PMD.SystemPrintln")
- @SuppressFBWarnings("MUI_CONTAINSKEY_BEFORE_GET")
- public static void main(final String... args) {
+ public static void main(String... args) {
+ var keys = new TreeSet<>(REASON_PHRASES.keySet());
if (args.length >= 1) {
- for (final String key : args) {
- if (REASON_PHRASES.containsKey(key)) {
- System.out.println(key + ": " + REASON_PHRASES.get(key));
+ for (var arg : args) {
+ if (arg.endsWith("xx")) { // e.g.: 2xx
+ var responseClass = arg.charAt(0);
+ keys.forEach(k -> {
+ if (k.charAt(0) == responseClass) {
+ System.out.println(k + ": " + REASON_PHRASES.get(k));
+ }
+ });
+ } else { // e.g.: 404
+ var value = REASON_PHRASES.get(arg);
+ if (value != null) {
+ System.out.println(arg + ": " + value);
+ }
}
}
- } else {
- final SortedSet keys = new TreeSet<>(REASON_PHRASES.keySet());
- for (final String key : keys) {
- System.out.println(key + ": " + REASON_PHRASES.get(key));
- }
-
+ } else { // Print all
+ keys.forEach(k -> System.out.println(k + ": " + REASON_PHRASES.get(k)));
System.out.println("Total: " + REASON_PHRASES.size());
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/StatusCode.java b/src/main/java/net/thauvin/erik/httpstatus/StatusCode.java
new file mode 100644
index 0000000..bbcb2ea
--- /dev/null
+++ b/src/main/java/net/thauvin/erik/httpstatus/StatusCode.java
@@ -0,0 +1,153 @@
+/*
+ * StatusCode.java
+ *
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of this project nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.thauvin.erik.httpstatus;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * The StatusCode bean implements methods to check the class of an HTTP status code.
+ *
+ * @author Erik C. Thauvin
+ * @since 1.1.0
+ */
+public class StatusCode implements Serializable {
+ @Serial
+ private static final long serialVersionUID = 1L;
+ private int code;
+
+ /**
+ * Creates a new StatusCode object.
+ */
+ public StatusCode() {
+ // Default constructor.
+ }
+
+ /**
+ * Creates a new StatusCode object.
+ *
+ * @param code The status code.
+ */
+ public StatusCode(int code) {
+ this.code = code;
+ }
+
+ /**
+ * Returns the status code.
+ */
+ public int getCode() {
+ return code;
+ }
+
+ /**
+ * Returns the reason for the status code.
+ *
+ * @return The reason, or null.
+ * @see Reasons#getReasonPhrase(int)
+ */
+ public String getReason() {
+ return Reasons.getReasonPhrase(code);
+ }
+
+ /**
+ * Checks if the status code is a client error. (eg: Internal Server Error)
+ *
+ * @return true if the status code is a client error, false otherwise.
+ */
+ public boolean isClientError() {
+ return code >= 400 && code < 500;
+ }
+
+ /**
+ * Checks if the status code is a client or server error.
+ *
+ * @return true if the status code is an error, false otherwise.
+ */
+ public boolean isError() {
+ return code >= 400 && code < 600;
+ }
+
+ /**
+ * Checks if the status code is informational.
+ *
+ * @return true if the status code is informational, false otherwise.
+ */
+ public boolean isInfo() {
+ return code >= 100 && code < 200;
+ }
+
+ /**
+ * Checks if the status code is a redirect.
+ *
+ * @return true if the status code is a redirect, false otherwise.
+ */
+ public boolean isRedirect() {
+ return code >= 300 && code < 400;
+ }
+
+ /**
+ * Checks if the status code is a server error.
+ *
+ * @return true if the status code is a server error, false otherwise.
+ */
+ public boolean isServerError() {
+ return code >= 500 && code < 600;
+ }
+
+ /**
+ * Checks if the status code is a (OK) success.
+ *
+ * @return true if the status code is a success, false otherwise.
+ */
+ public boolean isSuccess() {
+ return code >= 200 && code < 300;
+ }
+
+ /**
+ * Checks if the status code is valid.
+ *
+ * @return true if the status code is valid, false otherwise.
+ */
+ public boolean isValid() {
+ return code == 783 || (code >= 100 && code < 600);
+ }
+
+ /**
+ * Sets the status code.
+ *
+ * @param code The HTTP status code.
+ */
+ public void setCode(int code) {
+ this.code = code;
+ }
+}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/Utils.java b/src/main/java/net/thauvin/erik/httpstatus/Utils.java
index 48fee4e..5d42b22 100644
--- a/src/main/java/net/thauvin/erik/httpstatus/Utils.java
+++ b/src/main/java/net/thauvin/erik/httpstatus/Utils.java
@@ -1,7 +1,7 @@
/*
* Utils.java
*
- * Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,12 +38,11 @@ import java.io.Writer;
/**
* The Utils class implements a collection of utility methods used throughout this project.
*
- * @author Erik C. Thauvin
+ * @author Erik C. Thauvin
* @created 2015-12-03
* @since 1.0
*/
public final class Utils {
-
/**
* Disables the default constructor.
*
@@ -60,30 +59,18 @@ public final class Utils {
* @param value The string value to convert.
* @return The converted string value.
*/
- public static String escapeXml(final String value) {
- final StringBuilder escaped = new StringBuilder();
+ public static String escapeXml(String value) {
+ var escaped = new StringBuilder();
- for (int i = 0; i < value.length(); i++) {
- final char c = value.charAt(i);
+ for (var i = 0; i < value.length(); i++) {
+ var c = value.charAt(i);
switch (c) {
- case '<':
- escaped.append("<");
- break;
- case '>':
- escaped.append(">");
- break;
- case '&':
- escaped.append("&");
- break;
- case '\'':
- escaped.append("'");
- break;
- case '"':
- escaped.append(""");
- break;
- default:
- escaped.append(c);
- break;
+ case '<' -> escaped.append("<");
+ case '>' -> escaped.append(">");
+ case '&' -> escaped.append("&");
+ case '\'' -> escaped.append("'");
+ case '"' -> escaped.append(""");
+ default -> escaped.append(c);
}
}
@@ -99,20 +86,12 @@ public final class Utils {
* @param xml The {@link #escapeXml(String) xml} flag.
* @throws IOException If an I/O error occurs.
*/
- public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
- throws IOException {
- if (xml) {
- if (value != null) {
- out.write(escapeXml(value));
- } else if (defaultValue != null) {
- out.write(escapeXml(defaultValue));
- }
- } else {
- if (value != null) {
- out.write(value);
- } else if (defaultValue != null) {
- out.write(defaultValue);
- }
+ public static void outWrite(Writer out, String value, String defaultValue, boolean xml)
+ throws IOException {
+ if (value != null) {
+ out.write(xml ? escapeXml(value) : value);
+ } else if (defaultValue != null) {
+ out.write(xml ? escapeXml(defaultValue) : defaultValue);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/taglibs/CauseTag.java b/src/main/java/net/thauvin/erik/httpstatus/taglibs/CauseTag.java
index 1deb166..2bf4018 100644
--- a/src/main/java/net/thauvin/erik/httpstatus/taglibs/CauseTag.java
+++ b/src/main/java/net/thauvin/erik/httpstatus/taglibs/CauseTag.java
@@ -1,7 +1,7 @@
/*
* CauseTag.java
*
- * Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,36 +32,47 @@
package net.thauvin.erik.httpstatus.taglibs;
+import jakarta.servlet.jsp.JspWriter;
+import jakarta.servlet.jsp.PageContext;
import net.thauvin.erik.httpstatus.Utils;
-import javax.servlet.jsp.JspWriter;
-import javax.servlet.jsp.PageContext;
import java.io.IOException;
+
/**
* The <hs:cause> tag returns the cause (if any) for the current HTTP Status Error Code.
*
- * @author Erik C. Thauvin
+ * @author Erik C. Thauvin
* @created 2015-12-03
* @since 1.0
*/
public class CauseTag extends XmlSupport {
/**
- * {@inheritDoc}
+ * Prints the cause (if any) for the current HTTP Status Error Code.
+ *
+ * @throws IOException If an error occurs while writing the output.
*/
@Override
public void doTag() throws IOException {
- final PageContext pageContext = (PageContext) getJspContext();
- final JspWriter out = pageContext.getOut();
+ PageContext pageContext = (PageContext) getJspContext();
+ JspWriter out = pageContext.getOut();
- String cause;
+ Throwable cause = pageContext.getErrorData().getThrowable().getCause();
- try {
- cause = pageContext.getErrorData().getThrowable().getCause().getLocalizedMessage();
- } catch (NullPointerException ignore) {
- cause = defaultValue;
- }
-
- Utils.outWrite(out, cause, defaultValue, escapeXml);
+ Utils.outWrite(out, getCause(cause), defaultValue, escapeXml);
}
-}
\ No newline at end of file
+
+ /**
+ * Returns the cause's localized message or default value.
+ *
+ * @param cause The cause.
+ * @return The cause or {@code null}.
+ */
+ public String getCause(Throwable cause) {
+ if (cause != null && cause.getLocalizedMessage() != null) {
+ return cause.getLocalizedMessage();
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/taglibs/CodeTag.java b/src/main/java/net/thauvin/erik/httpstatus/taglibs/CodeTag.java
index 5aeea04..f74b016 100644
--- a/src/main/java/net/thauvin/erik/httpstatus/taglibs/CodeTag.java
+++ b/src/main/java/net/thauvin/erik/httpstatus/taglibs/CodeTag.java
@@ -1,7 +1,7 @@
/*
* CodeTag.java
*
- * Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,26 +32,29 @@
package net.thauvin.erik.httpstatus.taglibs;
-import javax.servlet.jsp.JspWriter;
-import javax.servlet.jsp.PageContext;
-import javax.servlet.jsp.tagext.SimpleTagSupport;
+import jakarta.servlet.jsp.JspWriter;
+import jakarta.servlet.jsp.PageContext;
+import jakarta.servlet.jsp.tagext.SimpleTagSupport;
+
import java.io.IOException;
/**
* The <hs:code> tag returns the HTTP Status Error Code.
*
- * @author Erik C. Thauvin
+ * @author Erik C. Thauvin
* @created 2015-12-03
* @since 1.0
*/
public class CodeTag extends SimpleTagSupport {
/**
- * {@inheritDoc}
+ * Writes the HTTP Status Error Code to the current JspWriter.
+ *
+ * @throws IOException If an I/O error occurs.
*/
@Override
public void doTag() throws IOException {
- final PageContext pageContext = (PageContext) getJspContext();
- final JspWriter out = pageContext.getOut();
+ PageContext pageContext = (PageContext) getJspContext();
+ JspWriter out = pageContext.getOut();
out.write(String.valueOf(pageContext.getErrorData().getStatusCode()));
}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/taglibs/MessageTag.java b/src/main/java/net/thauvin/erik/httpstatus/taglibs/MessageTag.java
new file mode 100644
index 0000000..7674774
--- /dev/null
+++ b/src/main/java/net/thauvin/erik/httpstatus/taglibs/MessageTag.java
@@ -0,0 +1,64 @@
+/*
+ * MessageTag.java
+ *
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of this project nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.thauvin.erik.httpstatus.taglibs;
+
+import jakarta.servlet.jsp.JspWriter;
+import jakarta.servlet.jsp.PageContext;
+import net.thauvin.erik.httpstatus.Utils;
+
+import java.io.IOException;
+
+/**
+ * The <hs:message> tag returns the message (if any) for the current error.
+ *
+ * @author Erik C. Thauvin
+ * @created 2022-03-16
+ * @since 1.0.5
+ */
+public class MessageTag extends XmlSupport {
+ /**
+ * Writes the error message associated with the current HTTP Status Error Code.
+ *
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public void doTag() throws IOException {
+ PageContext pageContext = (PageContext) getJspContext();
+ JspWriter out = pageContext.getOut();
+
+ String message = (String) pageContext.getRequest().getAttribute(
+ jakarta.servlet.RequestDispatcher.ERROR_MESSAGE);
+
+ Utils.outWrite(out, message, defaultValue, escapeXml);
+ }
+}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/taglibs/ReasonTag.java b/src/main/java/net/thauvin/erik/httpstatus/taglibs/ReasonTag.java
index f20c683..16cd818 100644
--- a/src/main/java/net/thauvin/erik/httpstatus/taglibs/ReasonTag.java
+++ b/src/main/java/net/thauvin/erik/httpstatus/taglibs/ReasonTag.java
@@ -1,7 +1,7 @@
/*
* ReasonTag.java
*
- * Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,18 +32,18 @@
package net.thauvin.erik.httpstatus.taglibs;
+import jakarta.servlet.jsp.JspWriter;
+import jakarta.servlet.jsp.PageContext;
import net.thauvin.erik.httpstatus.Reasons;
import net.thauvin.erik.httpstatus.Utils;
-import javax.servlet.jsp.JspWriter;
-import javax.servlet.jsp.PageContext;
import java.io.IOException;
/**
* The <hs:reason> tag returns the Reason Phrase for the current (or specified) HTTP Status Error
* Code.
*
- * @author Erik C. Thauvin
+ * @author Erik C. Thauvin
* @created 2015-12-02
* @since 1.0
*/
@@ -51,21 +51,21 @@ public class ReasonTag extends XmlSupport {
private int statusCode = -1;
/**
- * {@inheritDoc}
+ * Writes the Reason Phrase for the current (or specified) HTTP Status Error Code.
*/
@Override
public void doTag() {
- final PageContext pageContext = (PageContext) getJspContext();
- final JspWriter out = pageContext.getOut();
+ PageContext pageContext = (PageContext) getJspContext();
+ JspWriter out = pageContext.getOut();
try {
if (statusCode > -1) {
Utils.outWrite(out, Reasons.getReasonPhrase(statusCode), defaultValue, escapeXml);
} else {
Utils.outWrite(out, Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()), defaultValue,
- escapeXml);
+ escapeXml);
}
- } catch (IOException ignore) {
+ } catch (IOException ignored) {
// Ignore.
}
}
@@ -75,10 +75,7 @@ public class ReasonTag extends XmlSupport {
*
* @param statusCode The status code.
*/
- @SuppressWarnings("unused")
- public void setCode(final int statusCode) {
+ public void setCode(int statusCode) {
this.statusCode = statusCode;
}
-
-
}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/taglibs/XmlSupport.java b/src/main/java/net/thauvin/erik/httpstatus/taglibs/XmlSupport.java
index d38760a..5898da1 100644
--- a/src/main/java/net/thauvin/erik/httpstatus/taglibs/XmlSupport.java
+++ b/src/main/java/net/thauvin/erik/httpstatus/taglibs/XmlSupport.java
@@ -1,7 +1,7 @@
/*
* XmlSupport.java
*
- * Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,12 +32,12 @@
package net.thauvin.erik.httpstatus.taglibs;
-import javax.servlet.jsp.tagext.SimpleTagSupport;
+import jakarta.servlet.jsp.tagext.SimpleTagSupport;
/**
* Adds support for the default and escapeXml tag attributes.
*
- * @author Erik C. Thauvin
+ * @author Erik C. Thauvin
* @created 2015-12-03
* @since 1.0
*/
@@ -58,7 +58,7 @@ public abstract class XmlSupport extends SimpleTagSupport {
* @param defaultValue The default value.
*/
@SuppressWarnings("unused")
- public void setDefault(final String defaultValue) {
+ public void setDefault(String defaultValue) {
this.defaultValue = defaultValue;
}
@@ -68,7 +68,7 @@ public abstract class XmlSupport extends SimpleTagSupport {
* @param escapeXml true or false
*/
@SuppressWarnings("unused")
- public void setEscapeXml(final boolean escapeXml) {
+ public void setEscapeXml(boolean escapeXml) {
this.escapeXml = escapeXml;
}
}
\ No newline at end of file
diff --git a/src/main/resources/META-INF/httpstatus.tld b/src/main/resources/META-INF/httpstatus.tld
index b037cbc..eb1a1d5 100644
--- a/src/main/resources/META-INF/httpstatus.tld
+++ b/src/main/resources/META-INF/httpstatus.tld
@@ -2,7 +2,7 @@