diff --git a/.circleci/config.yml b/.circleci/config.yml
index f0fb009..65723f0 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,42 +1,41 @@
-version: 2.1
+inversion: 2
+defaults: &defaults
+ working_directory: ~/repo
+ environment:
+ JVM_OPTS: -Xmx3200m
+ TERM: dumb
+ CI_NAME: "CircleCI"
+
+defaults_gradle: &defaults_bld
+ steps:
+ - checkout
+ - run:
+ name: Download the dependencies
+ command: ./bld download
+ - run:
+ name: Run tests with bld
+ command: ./bld compile test
-commands:
- build_and_test:
- parameters:
- reports-dir:
- type: string
- default: "build/reports/test_results"
- steps:
- - checkout
- - run:
- name: Download dependencies
- command: ./bld download
- - run:
- name: Compile source
- command: ./bld compile
- - run:
- name: Run tests
- command: ./bld jacoco -reports-dir=<< parameters.reports-dir >>
- - store_test_results:
- path: << parameters.reports-dir >>
- - store_artifacts:
- path: build/reports/jacoco/test/html
jobs:
+ bld_jdk20:
+ <<: *defaults
+
+ docker:
+ - image: cimg/openjdk:20.0
+
+ <<: *defaults_bld
+
bld_jdk17:
+ <<: *defaults
+
docker:
- image: cimg/openjdk:17.0
- steps:
- - build_and_test
- bld_jdk21:
- docker:
- - image: cimg/openjdk:21.0
- steps:
- - build_and_test
+ <<: *defaults_bld
workflows:
+ version: 2
bld:
jobs:
- bld_jdk17
- - bld_jdk21
-
+ - bld_jdk20
diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml
index 057289d..79093d1 100644
--- a/.github/workflows/bld.yml
+++ b/.github/workflows/bld.yml
@@ -4,50 +4,50 @@ on: [ push, pull_request, workflow_dispatch ]
jobs:
build-bld-project:
+ runs-on: ubuntu-latest
+
env:
- COVERAGE_JDK: "17"
+ COVERAGE_SDK: "17"
strategy:
matrix:
- java-version: [ 17, 21, 24 ]
- os: [ ubuntu-latest, windows-latest, macos-latest ]
-
- runs-on: ${{ matrix.os }}
+ java-version: [ 17, 20 ]
steps:
- name: Checkout source repository
- uses: actions/checkout@v4
+ uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v3
with:
- distribution: "zulu"
+ distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- - name: Download dependencies
+ - name: Grant execute permission for bld
+ run: chmod +x bld
+
+ - name: Download the dependencies
run: ./bld download
- - name: Compile source
- run: ./bld compile
-
- - name: Run tests
- run: ./bld jacoco
+ - name: Run tests with bld
+ run: ./bld compile jacoco
- name: Remove pom.xml
- if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest'
+ if: success() && matrix.java-version == env.COVERAGE_SDK
run: rm -rf pom.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
- if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest'
+ if: success() && matrix.java-version == env.COVERAGE_SDK
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest'
+ if: success() && matrix.java-version == env.COVERAGE_SDK
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+
diff --git a/.github_changelog_generator b/.github_changelog_generator
index 9410c34..19e45d2 100644
--- a/.github_changelog_generator
+++ b/.github_changelog_generator
@@ -1 +1 @@
-future-release=1.1.2
+future-release=1.1.0
diff --git a/.idea/bld.xml b/.idea/bld.xml
deleted file mode 100644
index 6600cee..0000000
--- a/.idea/bld.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml
index 153a060..722b42e 100644
--- a/.idea/libraries/bld.xml
+++ b/.idea/libraries/bld.xml
@@ -2,12 +2,11 @@
-
+
-
-
+
@@ -15,4 +14,4 @@
-
+
\ No newline at end of file
diff --git a/.idea/libraries/compile.xml b/.idea/libraries/compile.xml
index 99cc0c0..9bd86aa 100644
--- a/.idea/libraries/compile.xml
+++ b/.idea/libraries/compile.xml
@@ -7,7 +7,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/.idea/libraries/runtime.xml b/.idea/libraries/runtime.xml
index d4069f2..2ae5c4b 100644
--- a/.idea/libraries/runtime.xml
+++ b/.idea/libraries/runtime.xml
@@ -8,7 +8,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/.idea/libraries/test.xml b/.idea/libraries/test.xml
index 57ed5ef..b80486a 100644
--- a/.idea/libraries/test.xml
+++ b/.idea/libraries/test.xml
@@ -8,7 +8,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 71f1817..9963c9f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,20 +1,15 @@
+
-
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 32bf99b..2dd24a5 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -1,11 +1,11 @@
{
- "version": "0.2.0",
- "configurations": [
- {
- "type": "java",
- "name": "Run Tests",
- "request": "launch",
- "mainClass": "net.thauvin.erik.httpstatus.HttpStatusTest"
- }
- ]
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "java",
+ "name": "Run Tests",
+ "request": "launch",
+ "mainClass": "net.thauvin.erik.httpstatus.HttpStatusTest"
+ }
+ ]
}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 3ef096f..5ae2eaa 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -3,12 +3,13 @@
"src/main/java",
"src/main/resources",
"src/test/java",
- "src/bld/java",
- "src/bld/resources"
+ "src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
- "${HOME}/.bld/dist/bld-2.2.1.jar",
- "lib/**/*.jar",
+ "${HOME}bld-1.7.0.jar",
+ "lib/compile/*.jar",
+ "lib/runtime/*.jar",
+ "lib/test/*.jar"
]
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 159135a..8a090c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,14 +1,5 @@
# Changelog
-## [1.1.1](https://github.com/ethauvin/httpstatus/tree/1.1.1) (2024-06-07)
-
-[Full Changelog](https://github.com/ethauvin/httpstatus/compare/1.1.0...1.1.1)
-
-**Implemented enhancements:**
-
-- Sort command line output [\#10](https://github.com/ethauvin/HttpStatus/issues/10)
-- Update reasons properties status codes [\#9](https://github.com/ethauvin/HttpStatus/issues/9)
-
## [1.1.0](https://github.com/ethauvin/httpstatus/tree/1.1.0) (2023-09-29)
[Full Changelog](https://github.com/ethauvin/httpstatus/compare/1.0.5...1.1.0)
diff --git a/LICENSE.txt b/LICENSE.txt
index 79de5a8..3f79a9e 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2025, Erik C. Thauvin (erik@thauvin.net)
+Copyright (c) 2015-2023, Erik C. Thauvin (erik@thauvin.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/README.md b/README.md
index 40bc87c..4b6545c 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,9 @@
[](http://opensource.org/licenses/BSD-3-Clause)
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
-[](https://rife2.com/bld)
+[](https://rife2.com/bld)
[](https://github.com/ethauvin/httpstatus/releases/latest)
-[](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/httpstatus/httpstatus/)
+[](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)
@@ -17,11 +17,11 @@ A simple [JSP](http://www.oracle.com/technetwork/java/javaee/jsp/index.html) Tag
## Table of Contents
- [Examples](#examples)
-- [Usage](#usage)
+- Usage
- [Gradle](#gradle)
- [bld](#bld)
- [Maven](#maven)
-- [JSP Tags](#jsp-tags)
+- JSP Tags
- [hs:cause](#hscause)
- [hs:code](#hscode)
- [hs:message](#hsmessage)
@@ -29,7 +29,6 @@ A simple [JSP](http://www.oracle.com/technetwork/java/javaee/jsp/index.html) Tag
- [StatusCode Bean](#statuscode-bean)
- [Reasons](#reasons)
- [Command Line Usage](#command-line-usage)
-- [Contributing](#contributing)
## Examples
@@ -56,7 +55,7 @@ or
would display on a [501 status code](https://www.rfc-editor.org/rfc/rfc9110.html#name-501-not-implemented):
-```console
+```plain
Not Implemented
```
@@ -72,7 +71,7 @@ repositories {
}
dependencies {
- implementation 'net.thauvin.erik.httpstatus:httpstatus:1.1.1'
+ implementation 'net.thauvin.erik.httpstatus:httpstatus:1.1.0'
}
```
@@ -94,7 +93,7 @@ As a `Maven` artifact:
net.thauvin.erik.httpstatus
httpstatus
- 1.1.1
+ 1.1.0
```
@@ -111,7 +110,7 @@ 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 |
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
@@ -134,7 +133,7 @@ The `` tag displays the current error message, if any. A shorthand
Optional attributes are:
| 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. |
@@ -143,7 +142,7 @@ Optional attributes are:
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. |
@@ -191,7 +190,7 @@ public class ExampleServlet extends HttpServlet {
The `StatusCode` bean methods are:
| 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. |
@@ -206,16 +205,11 @@ The `StatusCode` bean methods are:
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 |
@@ -225,17 +219,15 @@ The reasons are defined in a [ResourceBundle](https://docs.oracle.com/en/java/ja
| `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 |
+| `306` | Switch Proxy |
| `307` | Temporary Redirect |
| `308` | Permanent Redirect |
| `400` | Bad Request |
@@ -251,19 +243,18 @@ The reasons are defined in a [ResourceBundle](https://docs.oracle.com/en/java/ja
| `410` | Gone |
| `411` | Length Required |
| `412` | Precondition Failed |
-| `413` | Payload Too Large |
-| `414` | URI Too Long |
+| `413` | Request Entity/Payload Too Large |
+| `414` | Request-URI Too Long |
| `415` | Unsupported Media Type |
-| `416` | Range Not Satisfiable |
+| `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 Content |
+| `422` | Unprocessable Entity |
| `423` | Locked |
| `424` | Failed Dependency |
-| `425` | Too Early |
| `426` | Upgrade Required |
| `428` | Precondition Required |
| `429` | Too Many Requests |
@@ -278,7 +269,7 @@ The reasons are defined in a [ResourceBundle](https://docs.oracle.com/en/java/ja
| `463` | X-Forwarded-For Header with More than 30 IP Addresses |
| `494` | Request Header Too Large |
| `495` | SSL Certificate Error |
-| `496` | SSL Certificate Required |
+| `496` | No SSL Certificate |
| `497` | HTTP Request Sent to HTTPS Port |
| `498` | Token Expired/Invalid |
| `499` | Client Closed Request |
@@ -296,7 +287,7 @@ The reasons are defined in a [ResourceBundle](https://docs.oracle.com/en/java/ja
| `511` | Network Authentication Required |
| `520` | Unknown Error |
| `521` | Web Server Is Down |
-| `522` | Connection Timed Out |
+| `522` | Origin Connection Time-out |
| `523` | Origin Is Unreachable |
| `524` | A Timeout Occurred |
| `525` | SSL Handshake Failed |
@@ -304,35 +295,27 @@ The reasons are defined in a [ResourceBundle](https://docs.oracle.com/en/java/ja
| `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:
-```console
-$ java -jar httpstatus-1.1.1.jar 404 500
+```sh
+$ java -jar httpstatus-1.1.0.jar 404 500
404: Not Found
500: Internal Server Error
```
If no status code is specified, all will be printed:
-```console
-$ java -jar httpstatus-1.1.1.jar
+```sh
+$ java -jar httpstatus-1.1.0.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
@@ -342,30 +325,11 @@ $ java -jar httpstatus-1.1.1.jar
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
+```sh
+$ java -jar httpstatus-1.1.0.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/config/pmd.xml b/config/pmd.xml
index 2641880..1039e40 100644
--- a/config/pmd.xml
+++ b/config/pmd.xml
@@ -7,9 +7,9 @@
+
+
-
-
@@ -24,8 +24,8 @@
-
+
@@ -35,9 +35,8 @@
-
-
+
@@ -53,6 +52,8 @@
+
+
@@ -106,4 +107,4 @@
-
+
\ No newline at end of file
diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar
index 7d0825c..605e3e4 100644
Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ
diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties
index 418f275..6ee7345 100644
--- a/lib/bld/bld-wrapper.properties
+++ b/lib/bld/bld-wrapper.properties
@@ -1,7 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
+bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2
+bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1-SNAPSHOT
+bld.repositories=MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES,MAVEN_CENTRAL
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
+bld.version=1.7.2
diff --git a/pom.xml b/pom.xml
index 73cf087..cc15182 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,33 +4,33 @@
4.0.0
net.thauvin.erik.httpstatus
httpstatus
- 1.1.2-SNAPSHOT
+ 1.1.0
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
+ http://opensource.org/licenses/BSD-3-Clause
jakarta.servlet
jakarta.servlet-api
- 6.1.0
+ 6.0.0
compile
jakarta.servlet.jsp
jakarta.servlet.jsp-api
- 4.0.0
+ 3.1.1
compile
jakarta.el
jakarta.el-api
- 6.0.1
+ 5.0.1
compile
diff --git a/src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java b/src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java
index 9c36ca8..9547222 100644
--- a/src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java
+++ b/src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java
@@ -1,7 +1,7 @@
/*
* HttpStatusBuild.java
*
- * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,8 @@ import rife.bld.extension.PmdOperation;
import rife.bld.publish.*;
import rife.tools.exceptions.FileUtilsErrorException;
-import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
import java.util.List;
import java.util.jar.Attributes;
@@ -49,15 +50,10 @@ 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");
+ version = version(1, 1, 0);
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";
@@ -67,17 +63,16 @@ public class HttpStatusBuild extends Project {
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)));
+ .include(dependency("jakarta.servlet", "jakarta.servlet-api", version(6, 0, 0)))
+ .include(dependency("jakarta.servlet.jsp", "jakarta.servlet.jsp-api", version(3, 1, 1)))
+ .include(dependency("jakarta.el", "jakarta.el-api", version(5, 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)));
+ .include(dependency("org.assertj", "assertj-core", version(3, 24, 2)))
+ .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0)))
+ .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0)));
jarOperation().manifestAttribute(Attributes.Name.MAIN_CLASS, pkg + '.' + "Reasons");
@@ -89,9 +84,8 @@ public class HttpStatusBuild extends Project {
publishOperation()
.repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS_LEGACY.location())
.withCredentials(property("sonatype.user"), property("sonatype.password"))
- : repository(SONATYPE_RELEASES_LEGACY.location())
+ : repository("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
.withCredentials(property("sonatype.user"), property("sonatype.password")))
- .repository(repository("github"))
.info(new PublishInfo()
.groupId(pkg)
.artifactId(name.toLowerCase())
@@ -99,18 +93,11 @@ public class HttpStatusBuild extends Project {
.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")
+ .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("http://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"))
@@ -122,36 +109,35 @@ public class HttpStatusBuild extends Project {
}
@BuildCommand(summary = "Generates JaCoCo Reports")
- public void jacoco() throws Exception {
+ public void jacoco() throws IOException {
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"));
+ public void pmd() {
+ new PmdOperation()
+ .fromProject(this)
+ .failOnViolation(true)
+ .ruleSets("config/pmd.xml")
+ .execute();
}
@Override
public void publish() throws Exception {
super.publish();
- pomRoot();
+ rootPom();
}
@Override
public void publishLocal() throws Exception {
super.publishLocal();
- pomRoot();
+ rootPom();
+ }
+
+ private void rootPom() throws FileUtilsErrorException {
+ PomBuilder.generateInto(publishOperation().info(), publishOperation().dependencies(),
+ Path.of(workDirectory.getPath(), "pom.xml").toFile());
}
}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/Reasons.java b/src/main/java/net/thauvin/erik/httpstatus/Reasons.java
index 62b20f0..f090c8e 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 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,6 @@ package net.thauvin.erik.httpstatus;
import java.util.Map;
import java.util.ResourceBundle;
-import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
/**
@@ -57,8 +56,8 @@ public final class Reasons {
// Initializes the reason phrases map.
static {
- var bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
- for (var key : bundle.keySet()) {
+ final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
+ for (final String key : bundle.keySet()) {
REASON_PHRASES.put(key, bundle.getString(key));
}
}
@@ -76,7 +75,7 @@ public final class Reasons {
* @param statusCode The status code.
* @return The reason phrase, or null
.
*/
- public static String getReasonPhrase(int statusCode) {
+ public static String getReasonPhrase(final int statusCode) {
return getReasonPhrase(Integer.toString(statusCode));
}
@@ -86,7 +85,7 @@ public final class Reasons {
* @param statusCode The status code.
* @return The reason phrase, or null
.
*/
- public static String getReasonPhrase(String statusCode) {
+ public static String getReasonPhrase(final String statusCode) {
return REASON_PHRASES.get(statusCode);
}
@@ -96,26 +95,29 @@ public final class Reasons {
* @param args The status code(s) or response class(es), prints all if none.
*/
@SuppressWarnings("PMD.SystemPrintln")
- public static void main(String... args) {
- var keys = new TreeSet<>(REASON_PHRASES.keySet());
+ public static void main(final String... args) {
if (args.length >= 1) {
- for (var arg : args) {
- if (arg.endsWith("xx")) { // e.g.: 2xx
- var responseClass = arg.charAt(0);
- keys.forEach(k -> {
+ for (final String key : args) {
+ if (key.endsWith("xx")) {
+ var responseClass = key.charAt(0);
+ REASON_PHRASES.forEach((k, v) -> {
if (k.charAt(0) == responseClass) {
- System.out.println(k + ": " + REASON_PHRASES.get(k));
+ System.out.println(k + ": " + v);
}
});
- } else { // e.g.: 404
- var value = REASON_PHRASES.get(arg);
+ } else {
+ final String value = REASON_PHRASES.get(key);
if (value != null) {
- System.out.println(arg + ": " + value);
+ System.out.println(key + ": " + value);
}
}
}
- } else { // Print all
- keys.forEach(k -> System.out.println(k + ": " + REASON_PHRASES.get(k)));
+ } else {
+ REASON_PHRASES.forEach((k, v) -> {
+ if (v != null) {
+ System.out.println(k + ": " + v);
+ }
+ });
System.out.println("Total: " + REASON_PHRASES.size());
}
}
diff --git a/src/main/java/net/thauvin/erik/httpstatus/StatusCode.java b/src/main/java/net/thauvin/erik/httpstatus/StatusCode.java
index bbcb2ea..1982200 100644
--- a/src/main/java/net/thauvin/erik/httpstatus/StatusCode.java
+++ b/src/main/java/net/thauvin/erik/httpstatus/StatusCode.java
@@ -1,7 +1,7 @@
/*
* StatusCode.java
*
- * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,7 @@ public class StatusCode implements Serializable {
*
* @param code The status code.
*/
- public StatusCode(int code) {
+ public StatusCode(final int code) {
this.code = code;
}
@@ -139,7 +139,7 @@ public class StatusCode implements Serializable {
* @return true
if the status code is valid, false
otherwise.
*/
public boolean isValid() {
- return code == 783 || (code >= 100 && code < 600);
+ return code >= 100 && code < 600;
}
/**
@@ -147,7 +147,7 @@ public class StatusCode implements Serializable {
*
* @param code The HTTP status code.
*/
- public void setCode(int code) {
+ public void setCode(final 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 5d42b22..35422f3 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 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -59,11 +59,11 @@ public final class Utils {
* @param value The string value to convert.
* @return The converted string value.
*/
- public static String escapeXml(String value) {
- var escaped = new StringBuilder();
+ public static String escapeXml(final String value) {
+ final StringBuilder escaped = new StringBuilder();
- for (var i = 0; i < value.length(); i++) {
- var c = value.charAt(i);
+ for (int i = 0; i < value.length(); i++) {
+ final char c = value.charAt(i);
switch (c) {
case '<' -> escaped.append("<");
case '>' -> escaped.append(">");
@@ -86,7 +86,7 @@ public final class Utils {
* @param xml The {@link #escapeXml(String) xml} flag.
* @throws IOException If an I/O error occurs.
*/
- public static void outWrite(Writer out, String value, String defaultValue, boolean xml)
+ public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
throws IOException {
if (value != null) {
out.write(xml ? escapeXml(value) : value);
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 2bf4018..6d54fe9 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 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@ import net.thauvin.erik.httpstatus.Utils;
import java.io.IOException;
-
/**
* The <hs:cause>
tag returns the cause (if any) for the current HTTP Status Error Code.
*
@@ -48,16 +47,14 @@ import java.io.IOException;
*/
public class CauseTag extends XmlSupport {
/**
- * Prints the cause (if any) for the current HTTP Status Error Code.
- *
- * @throws IOException If an error occurs while writing the output.
+ * {@inheritDoc}
*/
@Override
public void doTag() throws IOException {
- PageContext pageContext = (PageContext) getJspContext();
- JspWriter out = pageContext.getOut();
+ final PageContext pageContext = (PageContext) getJspContext();
+ final JspWriter out = pageContext.getOut();
- Throwable cause = pageContext.getErrorData().getThrowable().getCause();
+ final Throwable cause = pageContext.getErrorData().getThrowable().getCause();
Utils.outWrite(out, getCause(cause), defaultValue, escapeXml);
}
@@ -75,4 +72,4 @@ public class CauseTag extends XmlSupport {
return null;
}
}
-}
+}
\ No newline at end of file
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 f74b016..df9378a 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 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,14 +47,12 @@ import java.io.IOException;
*/
public class CodeTag extends SimpleTagSupport {
/**
- * Writes the HTTP Status Error Code to the current JspWriter.
- *
- * @throws IOException If an I/O error occurs.
+ * {@inheritDoc}
*/
@Override
public void doTag() throws IOException {
- PageContext pageContext = (PageContext) getJspContext();
- JspWriter out = pageContext.getOut();
+ final PageContext pageContext = (PageContext) getJspContext();
+ final 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
index 7674774..f7d2ebc 100644
--- a/src/main/java/net/thauvin/erik/httpstatus/taglibs/MessageTag.java
+++ b/src/main/java/net/thauvin/erik/httpstatus/taglibs/MessageTag.java
@@ -1,7 +1,7 @@
/*
* MessageTag.java
*
- * Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,16 +47,14 @@ import java.io.IOException;
*/
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.
+ * {@inheritDoc}
*/
@Override
public void doTag() throws IOException {
- PageContext pageContext = (PageContext) getJspContext();
- JspWriter out = pageContext.getOut();
+ final PageContext pageContext = (PageContext) getJspContext();
+ final JspWriter out = pageContext.getOut();
- String message = (String) pageContext.getRequest().getAttribute(
+ final 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 16cd818..b80ddfa 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 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,12 +51,12 @@ public class ReasonTag extends XmlSupport {
private int statusCode = -1;
/**
- * Writes the Reason Phrase for the current (or specified) HTTP Status Error Code.
+ * {@inheritDoc}
*/
@Override
public void doTag() {
- PageContext pageContext = (PageContext) getJspContext();
- JspWriter out = pageContext.getOut();
+ final PageContext pageContext = (PageContext) getJspContext();
+ final JspWriter out = pageContext.getOut();
try {
if (statusCode > -1) {
@@ -75,7 +75,7 @@ public class ReasonTag extends XmlSupport {
*
* @param statusCode The status code.
*/
- public void setCode(int statusCode) {
+ public void setCode(final 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 5898da1..5fec8d7 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 2015-2025 Erik C. Thauvin (erik@thauvin.net)
+ * Copyright 2015-2023 Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -58,7 +58,7 @@ public abstract class XmlSupport extends SimpleTagSupport {
* @param defaultValue The default value.
*/
@SuppressWarnings("unused")
- public void setDefault(String defaultValue) {
+ public void setDefault(final 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(boolean escapeXml) {
+ public void setEscapeXml(final 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 eb1a1d5..0766792 100644
--- a/src/main/resources/META-INF/httpstatus.tld
+++ b/src/main/resources/META-INF/httpstatus.tld
@@ -2,7 +2,7 @@