Compare commits
182 commits
Author | SHA1 | Date | |
---|---|---|---|
3e9c9eb106 | |||
018ccd86b4 | |||
312e396052 | |||
ac1209abec | |||
4b82d03234 | |||
08d006af82 | |||
f596469b5b | |||
7ee45b34a4 | |||
96497f7f27 | |||
ec75fc4690 | |||
1bb7167aba | |||
71467db442 | |||
1c4b20e11c | |||
053dcba26b | |||
8c79c0e17a | |||
91e19d325e | |||
2d0167e5e9 | |||
780a5c30c4 | |||
96565dbfe7 | |||
1a0d4eb958 | |||
774eadaac2 | |||
6af9b46df9 | |||
18f5e92261 | |||
d6f6c40d77 | |||
cd68004962 | |||
59c775e33a | |||
e784b5a8f0 | |||
1d6a7824fe | |||
4011fe8024 | |||
477ef6237c | |||
30f8b4c206 | |||
5b47bf704e | |||
b0826267b5 | |||
1fca084fc9 | |||
7b3e4adfc8 | |||
3bedb10705 | |||
d0770a76f6 | |||
55c0cfdce5 | |||
c319102581 | |||
5d911ddca2 | |||
f16eba7bac | |||
0d98e8a602 | |||
a855bb6079 | |||
80e7766206 | |||
eeb861a7c9 | |||
1b46eaff7f | |||
7b27ddbc86 | |||
c80ea7b7d3 | |||
9a2647e7f4 | |||
2ff4128bc9 | |||
917131860f | |||
18aa6ddb59 | |||
2cfbed3291 | |||
32ba057820 | |||
cc50ac9d31 | |||
09e5de99e7 | |||
62c9b665dd | |||
f92cc8561a | |||
f76cee867d | |||
4a5c68cdb5 | |||
1144930002 | |||
8b7d57114b | |||
5d74358523 | |||
d08b4bbeb2 | |||
75d68c941e | |||
9270788386 | |||
92ed30a415 | |||
2c6493c631 | |||
b236998e72 | |||
d41d89b477 | |||
2c0b074a10 | |||
5a1d4eecec | |||
a24eec1f51 | |||
68975a497b | |||
84cfe6098d | |||
1f0a920ca3 | |||
c75ba0b38b | |||
45af218f39 | |||
c4edb4fd1f | |||
8ed5bc951f | |||
3616136f4e | |||
5486074d1e | |||
6344d7a68b | |||
1ab96e5b3a | |||
7dc9a51a7f | |||
e77c8595cb | |||
95f4c9714e | |||
12936688ae | |||
b967f13230 | |||
c3adfb1f07 | |||
8dd40acdfb | |||
8b87ddae42 | |||
f9fcd3a425 | |||
c30a705a85 | |||
0862186633 | |||
31b8c48bad | |||
37789dc633 | |||
6f15433034 | |||
74aaaf26cd | |||
8506460961 | |||
bd47e55869 | |||
d5005f18ea | |||
bc73cb6093 | |||
357d18e393 | |||
d02a8a7a0a | |||
495f9cca31 | |||
bbda52c19e | |||
109e3894ab | |||
74dddbba69 | |||
ab231453a8 | |||
e8e421b159 | |||
a64147959f | |||
589f451927 | |||
41471e31af | |||
3a64bd57d5 | |||
3688384b0d | |||
319878ec1a | |||
9ff860af40 | |||
0dafe87021 | |||
2ca48c0aef | |||
8d2b387c97 | |||
66db0b801f | |||
9d21dd76c0 | |||
4a701e1ee0 | |||
aa8fadd37c | |||
e768496fe6 | |||
54426f834b | |||
b464017501 | |||
8c717b49fa | |||
37fad706ec | |||
398355e0b8 | |||
6a6e800e93 | |||
dff03ed4e8 | |||
cea041703a | |||
56878419bd | |||
cb581bf0d9 | |||
3172b2b39f | |||
4fa2fd2726 | |||
58baccab90 | |||
9a4de2ebc8 | |||
465add5837 | |||
40338c4269 | |||
f6759afd31 | |||
4dbc2bbc08 | |||
14cb07ef0d | |||
709a33e1bd | |||
4d4575ddd9 | |||
4fbc229beb | |||
7245515df1 | |||
f366f9c037 | |||
5d5a8fa6ad | |||
202d5430d0 | |||
7f615ba709 | |||
e0a76ac839 | |||
f416d5ea91 | |||
761e6854c1 | |||
a570848319 | |||
f511db7b98 | |||
dbd17858b5 | |||
d8fa58d9d3 | |||
22819033ea | |||
0f223fd254 | |||
09727b752a | |||
b78bdf73f0 | |||
32a1bf3875 | |||
c707b342aa | |||
b8a387aeb7 | |||
94a5511bd8 | |||
2120576cce | |||
7998e44939 | |||
90dd1dfc5d | |||
26e5afa5d3 | |||
e18fc4a9e9 | |||
b50a026997 | |||
5b56399b26 | |||
d06795e0af | |||
537b2716ad | |||
c062b7f24a | |||
0bd4fdd742 | |||
42f35c10c2 | |||
1539462d1d | |||
439d8e9669 |
59 changed files with 2196 additions and 2249 deletions
42
.circleci/config.yml
Normal file
42
.circleci/config.yml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
version: 2.1
|
||||||
|
|
||||||
|
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_jdk17:
|
||||||
|
docker:
|
||||||
|
- image: cimg/openjdk:17.0
|
||||||
|
steps:
|
||||||
|
- build_and_test
|
||||||
|
|
||||||
|
bld_jdk21:
|
||||||
|
docker:
|
||||||
|
- image: cimg/openjdk:21.0
|
||||||
|
steps:
|
||||||
|
- build_and_test
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
bld:
|
||||||
|
jobs:
|
||||||
|
- bld_jdk17
|
||||||
|
- bld_jdk21
|
||||||
|
|
53
.github/workflows/bld.yml
vendored
Normal file
53
.github/workflows/bld.yml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
name: bld-ci
|
||||||
|
|
||||||
|
on: [ push, pull_request, workflow_dispatch ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-bld-project:
|
||||||
|
env:
|
||||||
|
COVERAGE_JDK: "17"
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
java-version: [ 17, 21, 24 ]
|
||||||
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout source repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up JDK ${{ matrix.java-version }}
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: "zulu"
|
||||||
|
java-version: ${{ matrix.java-version }}
|
||||||
|
|
||||||
|
- name: Download dependencies
|
||||||
|
run: ./bld download
|
||||||
|
|
||||||
|
- name: Compile source
|
||||||
|
run: ./bld compile
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: ./bld jacoco
|
||||||
|
|
||||||
|
- name: Remove pom.xml
|
||||||
|
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.os == 'ubuntu-latest'
|
||||||
|
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'
|
||||||
|
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'
|
||||||
|
env:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
1
.github_changelog_generator
Normal file
1
.github_changelog_generator
Normal file
|
@ -0,0 +1 @@
|
||||||
|
future-release=1.1.2
|
80
.gitignore
vendored
80
.gitignore
vendored
|
@ -1,24 +1,58 @@
|
||||||
**/.idea/dictionaries
|
|
||||||
**/.idea/gradle.xml
|
|
||||||
**/.idea/libraries
|
|
||||||
**/.idea/tasks.xml
|
|
||||||
**/.idea/workspace.xml
|
|
||||||
*.iws
|
|
||||||
.DS_Store
|
|
||||||
.classpath
|
|
||||||
.gradle
|
.gradle
|
||||||
.nb-gradle
|
.DS_Store
|
||||||
.project
|
build
|
||||||
.settings
|
lib/bld/**
|
||||||
/bin
|
!lib/bld/bld-wrapper.properties
|
||||||
/build
|
!lib/bld/bld-wrapper.jar
|
||||||
/deploy
|
lib/compile/
|
||||||
/dist
|
lib/runtime/
|
||||||
/gen
|
lib/standalone/
|
||||||
/local.properties
|
lib/test/
|
||||||
/out
|
|
||||||
/proguard-project.txt
|
# IDEA ignores
|
||||||
/project.properties
|
|
||||||
/test-output
|
# User-specific
|
||||||
Thumbs.db
|
.idea/**/workspace.xml
|
||||||
ehthumbs.db
|
.idea/**/tasks.xml
|
||||||
|
.idea/**/usage.statistics.xml
|
||||||
|
.idea/**/dictionaries
|
||||||
|
.idea/**/shelf
|
||||||
|
|
||||||
|
# AWS User-specific
|
||||||
|
.idea/**/aws.xml
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.idea/**/contentModel.xml
|
||||||
|
|
||||||
|
# Sensitive or high-churn files
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
.idea/**/dbnavigator.xml
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
|
||||||
|
# Mongo Explorer plugin
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# SonarLint plugin
|
||||||
|
.idea/sonarlint/
|
||||||
|
|
||||||
|
# Editor-based Rest Client
|
||||||
|
.idea/httpRequests
|
||||||
|
|
||||||
|
target
|
||||||
|
local.properties
|
||||||
|
|
29
.idea/app.iml
generated
Normal file
29
.idea/app.iml
generated
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<output url="file://$MODULE_DIR$/build/main" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/build/test" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/src/main/resources/templates" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module-library" scope="RUNTIME">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="file://$MODULE_DIR$/src/main/resources/templates" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="library" name="compile" level="project" />
|
||||||
|
<orderEntry type="library" scope="RUNTIME" name="runtime" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="test" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
14
.idea/bld.iml
generated
Normal file
14
.idea/bld.iml
generated
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<output url="file://$MODULE_DIR$/build/bld" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/build/bld" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$/src/bld">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/bld/java" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="bld" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
.idea/bld.xml
generated
Normal file
6
.idea/bld.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="BldConfiguration">
|
||||||
|
<events />
|
||||||
|
</component>
|
||||||
|
</project>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
|
||||||
|
</state>
|
||||||
|
</component>
|
6
.idea/copyright/Erik_s_Copyright.xml
generated
Normal file
6
.idea/copyright/Erik_s_Copyright.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value="&#36;file.fileName Copyright 2015-&#36;today.year 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." />
|
||||||
|
<option name="myName" value="Erik's Copyright Notice" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
3
.idea/copyright/profiles_settings.xml
generated
Normal file
3
.idea/copyright/profiles_settings.xml
generated
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="Erik's Copyright Notice" />
|
||||||
|
</component>
|
8
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
8
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ADDITIONAL_TAGS" value="created" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
18
.idea/libraries/bld.xml
generated
Normal file
18
.idea/libraries/bld.xml
generated
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<component name="libraryTable">
|
||||||
|
<library name="bld">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
|
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES>
|
||||||
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
|
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
||||||
|
</SOURCES>
|
||||||
|
<excluded>
|
||||||
|
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||||
|
</excluded>
|
||||||
|
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
|
||||||
|
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
|
||||||
|
</library>
|
||||||
|
</component>
|
13
.idea/libraries/compile.xml
generated
Normal file
13
.idea/libraries/compile.xml
generated
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<component name="libraryTable">
|
||||||
|
<library name="compile">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="file://$PROJECT_DIR$/lib/compile" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES>
|
||||||
|
<root url="file://$PROJECT_DIR$/lib/compile" />
|
||||||
|
</SOURCES>
|
||||||
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
|
||||||
|
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
|
||||||
|
</library>
|
||||||
|
</component>
|
14
.idea/libraries/runtime.xml
generated
Normal file
14
.idea/libraries/runtime.xml
generated
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<component name="libraryTable">
|
||||||
|
<library name="runtime">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
||||||
|
<root url="file://$PROJECT_DIR$/src/main/resources" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES>
|
||||||
|
<root url="file://$PROJECT_DIR$/lib/runtime" />
|
||||||
|
</SOURCES>
|
||||||
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
|
||||||
|
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
|
||||||
|
</library>
|
||||||
|
</component>
|
14
.idea/libraries/test.xml
generated
Normal file
14
.idea/libraries/test.xml
generated
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<component name="libraryTable">
|
||||||
|
<library name="test">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="file://$PROJECT_DIR$/lib/test" />
|
||||||
|
<root url="file://$PROJECT_DIR$/src/test/resources" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES>
|
||||||
|
<root url="file://$PROJECT_DIR$/lib/test" />
|
||||||
|
</SOURCES>
|
||||||
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
|
||||||
|
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
|
||||||
|
</library>
|
||||||
|
</component>
|
25
.idea/misc.xml
generated
Normal file
25
.idea/misc.xml
generated
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<project version="4">
|
||||||
|
<component name="EntryPointsManager">
|
||||||
|
<pattern value="net.thauvin.erik.httpstatus.HttpStatusBuild" />
|
||||||
|
<pattern value="net.thauvin.erik.httpstatus.HttpStatusBuild" method="pmd" />
|
||||||
|
<pattern value="net.thauvin.erik.httpstatus.HttpStatusBuild" method="jacoco" />
|
||||||
|
<pattern value="net.thauvin.erik.httpstatus.taglibs.ReasonTag" method="setCode" />
|
||||||
|
<pattern value="net.thauvin.erik.httpstatus.HttpStatusBuild" method="pmdCli" />
|
||||||
|
</component>
|
||||||
|
<component name="PDMPlugin">
|
||||||
|
<option name="customRuleSets">
|
||||||
|
<list>
|
||||||
|
<option value="K:\java\semver\config\pmd.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/../bld-pitest/config/pmd.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/../bld-jacoco-report/config/pmd.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/../bld-checkstyle/config/pmd.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/../bld-exec/config/pmd.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/../bld-testng/config/pmd.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="skipTestSources" value="false" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/build" />
|
||||||
|
</component>
|
||||||
|
</project>
|
9
.idea/modules.xml
generated
Normal file
9
.idea/modules.xml
generated
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
9
.idea/runConfigurations/Run Tests.xml
generated
Normal file
9
.idea/runConfigurations/Run Tests.xml
generated
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="net.thauvin.erik.httpstatus.HttpStatusTest" />
|
||||||
|
<module name="app" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
11
.vscode/launch.json
vendored
Normal file
11
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "Run Tests",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "net.thauvin.erik.httpstatus.HttpStatusTest"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
14
.vscode/settings.json
vendored
Normal file
14
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"java.project.sourcePaths": [
|
||||||
|
"src/main/java",
|
||||||
|
"src/main/resources",
|
||||||
|
"src/test/java",
|
||||||
|
"src/bld/java",
|
||||||
|
"src/bld/resources"
|
||||||
|
],
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
|
"java.project.referencedLibraries": [
|
||||||
|
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
||||||
|
"lib/**/*.jar",
|
||||||
|
]
|
||||||
|
}
|
62
CHANGELOG.md
Normal file
62
CHANGELOG.md
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Print status code by response classes [\#8](https://github.com/ethauvin/HttpStatus/issues/8)
|
||||||
|
- Move to Jakarta EE [\#7](https://github.com/ethauvin/HttpStatus/issues/7)
|
||||||
|
- Only use XML character entities in Utils.escapeXml\(\) [\#6](https://github.com/ethauvin/HttpStatus/issues/6)
|
||||||
|
- Implement a StatusCode bean to check the status code. [\#5](https://github.com/ethauvin/HttpStatus/issues/5)
|
||||||
|
|
||||||
|
## [1.0.5](https://github.com/ethauvin/httpstatus/tree/1.0.5) (2021-03-20)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/ethauvin/httpstatus/compare/1.0.4...1.0.5)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Retrieve the error message from the request, if available. [\#4](https://github.com/ethauvin/HttpStatus/issues/4)
|
||||||
|
- Add Unofficial Codes [\#3](https://github.com/ethauvin/HttpStatus/issues/3)
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/ethauvin/httpstatus/tree/1.0.4) (2019-05-08)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/ethauvin/httpstatus/compare/1.0.3...1.0.4)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Implement all INA HTTP status codes [\#1](https://github.com/ethauvin/HttpStatus/issues/1)
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- hs:reason always outputs the default value. [\#2](https://github.com/ethauvin/HttpStatus/issues/2)
|
||||||
|
|
||||||
|
## [1.0.3](https://github.com/ethauvin/httpstatus/tree/1.0.3) (2016-01-22)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/ethauvin/httpstatus/compare/1.0.2...1.0.3)
|
||||||
|
|
||||||
|
## [1.0.2](https://github.com/ethauvin/httpstatus/tree/1.0.2) (2016-01-21)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/ethauvin/httpstatus/compare/1.0.1...1.0.2)
|
||||||
|
|
||||||
|
## [1.0.1](https://github.com/ethauvin/httpstatus/tree/1.0.1) (2015-12-16)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/ethauvin/httpstatus/compare/1.0...1.0.1)
|
||||||
|
|
||||||
|
## [1.0](https://github.com/ethauvin/httpstatus/tree/1.0) (2015-12-04)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/ethauvin/httpstatus/compare/ad982eff1b27c31b54df4abae00ac2d4065543d6...1.0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
229
HttpStatus.iml
229
HttpStatus.iml
|
@ -1,229 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module external.linked.project.id="httpstatus" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="1.0.1" type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
|
||||||
<output url="file://$MODULE_DIR$/build/classes/main" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="Gradle: servletapi:servlet-api:2.4-20040521" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: javax.servlet.jsp:jsp-api:2.2.1-b03" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: javax.servlet:servlet-api:2.4-20040521" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: org.testng:testng:6.9.10" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: com.beust:jcommander:1.48" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Gradle: org.beanshell:bsh:2.0b4" level="project" />
|
|
||||||
</component>
|
|
||||||
<component name="org.twodividedbyzero.idea.findbugs">
|
|
||||||
<option name="_basePreferences">
|
|
||||||
<map>
|
|
||||||
<entry key="property.analysisEffortLevel" value="default" />
|
|
||||||
<entry key="property.analyzeAfterAutoMake" value="false" />
|
|
||||||
<entry key="property.analyzeAfterCompile" value="false" />
|
|
||||||
<entry key="property.annotationGutterIconEnabled" value="true" />
|
|
||||||
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
|
|
||||||
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
|
|
||||||
<entry key="property.exportAsHtml" value="true" />
|
|
||||||
<entry key="property.exportAsXml" value="true" />
|
|
||||||
<entry key="property.exportBaseDir" value="" />
|
|
||||||
<entry key="property.exportCreateArchiveDir" value="false" />
|
|
||||||
<entry key="property.exportOpenBrowser" value="true" />
|
|
||||||
<entry key="property.minPriorityToReport" value="Medium" />
|
|
||||||
<entry key="property.runAnalysisInBackground" value="false" />
|
|
||||||
<entry key="property.showHiddenDetectors" value="false" />
|
|
||||||
<entry key="property.toolWindowToFront" value="true" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="_detectors">
|
|
||||||
<map>
|
|
||||||
<entry key="AppendingToAnObjectOutputStream" value="true" />
|
|
||||||
<entry key="AtomicityProblem" value="true" />
|
|
||||||
<entry key="BadAppletConstructor" value="false" />
|
|
||||||
<entry key="BadResultSetAccess" value="true" />
|
|
||||||
<entry key="BadSyntaxForRegularExpression" value="true" />
|
|
||||||
<entry key="BadUseOfReturnValue" value="true" />
|
|
||||||
<entry key="BadlyOverriddenAdapter" value="true" />
|
|
||||||
<entry key="BooleanReturnNull" value="true" />
|
|
||||||
<entry key="BuildInterproceduralCallGraph" value="false" />
|
|
||||||
<entry key="BuildObligationPolicyDatabase" value="true" />
|
|
||||||
<entry key="BuildStringPassthruGraph" value="true" />
|
|
||||||
<entry key="CallToUnsupportedMethod" value="false" />
|
|
||||||
<entry key="CalledMethods" value="true" />
|
|
||||||
<entry key="CheckCalls" value="false" />
|
|
||||||
<entry key="CheckExpectedWarnings" value="false" />
|
|
||||||
<entry key="CheckImmutableAnnotation" value="true" />
|
|
||||||
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
|
|
||||||
<entry key="CheckTypeQualifiers" value="true" />
|
|
||||||
<entry key="CloneIdiom" value="true" />
|
|
||||||
<entry key="ComparatorIdiom" value="true" />
|
|
||||||
<entry key="ConfusedInheritance" value="true" />
|
|
||||||
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
|
|
||||||
<entry key="CovariantArrayAssignment" value="false" />
|
|
||||||
<entry key="CrossSiteScripting" value="true" />
|
|
||||||
<entry key="DefaultEncodingDetector" value="true" />
|
|
||||||
<entry key="DoInsideDoPrivileged" value="true" />
|
|
||||||
<entry key="DontCatchIllegalMonitorStateException" value="true" />
|
|
||||||
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
|
|
||||||
<entry key="DontUseEnum" value="true" />
|
|
||||||
<entry key="DroppedException" value="true" />
|
|
||||||
<entry key="DumbMethodInvocations" value="true" />
|
|
||||||
<entry key="DumbMethods" value="true" />
|
|
||||||
<entry key="DuplicateBranches" value="true" />
|
|
||||||
<entry key="EmptyZipFileEntry" value="false" />
|
|
||||||
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
|
|
||||||
<entry key="ExplicitSerialization" value="true" />
|
|
||||||
<entry key="FieldItemSummary" value="true" />
|
|
||||||
<entry key="FinalizerNullsFields" value="true" />
|
|
||||||
<entry key="FindBadCast2" value="true" />
|
|
||||||
<entry key="FindBadForLoop" value="true" />
|
|
||||||
<entry key="FindBugsSummaryStats" value="true" />
|
|
||||||
<entry key="FindCircularDependencies" value="false" />
|
|
||||||
<entry key="FindComparatorProblems" value="true" />
|
|
||||||
<entry key="FindDeadLocalStores" value="true" />
|
|
||||||
<entry key="FindDoubleCheck" value="true" />
|
|
||||||
<entry key="FindEmptySynchronizedBlock" value="true" />
|
|
||||||
<entry key="FindFieldSelfAssignment" value="true" />
|
|
||||||
<entry key="FindFinalizeInvocations" value="true" />
|
|
||||||
<entry key="FindFloatEquality" value="true" />
|
|
||||||
<entry key="FindFloatMath" value="false" />
|
|
||||||
<entry key="FindHEmismatch" value="true" />
|
|
||||||
<entry key="FindInconsistentSync2" value="true" />
|
|
||||||
<entry key="FindJSR166LockMonitorenter" value="true" />
|
|
||||||
<entry key="FindLocalSelfAssignment2" value="true" />
|
|
||||||
<entry key="FindMaskedFields" value="true" />
|
|
||||||
<entry key="FindMismatchedWaitOrNotify" value="true" />
|
|
||||||
<entry key="FindNakedNotify" value="true" />
|
|
||||||
<entry key="FindNoSideEffectMethods" value="true" />
|
|
||||||
<entry key="FindNonSerializableStoreIntoSession" value="false" />
|
|
||||||
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
|
|
||||||
<entry key="FindNonShortCircuit" value="true" />
|
|
||||||
<entry key="FindNullDeref" value="true" />
|
|
||||||
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
|
|
||||||
<entry key="FindOpenStream" value="true" />
|
|
||||||
<entry key="FindPuzzlers" value="true" />
|
|
||||||
<entry key="FindRefComparison" value="true" />
|
|
||||||
<entry key="FindReturnRef" value="true" />
|
|
||||||
<entry key="FindRoughConstants" value="true" />
|
|
||||||
<entry key="FindRunInvocations" value="true" />
|
|
||||||
<entry key="FindSelfComparison" value="true" />
|
|
||||||
<entry key="FindSelfComparison2" value="true" />
|
|
||||||
<entry key="FindSleepWithLockHeld" value="true" />
|
|
||||||
<entry key="FindSpinLoop" value="true" />
|
|
||||||
<entry key="FindSqlInjection" value="true" />
|
|
||||||
<entry key="FindTwoLockWait" value="true" />
|
|
||||||
<entry key="FindUncalledPrivateMethods" value="true" />
|
|
||||||
<entry key="FindUnconditionalWait" value="true" />
|
|
||||||
<entry key="FindUninitializedGet" value="true" />
|
|
||||||
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
|
|
||||||
<entry key="FindUnreleasedLock" value="true" />
|
|
||||||
<entry key="FindUnsatisfiedObligation" value="true" />
|
|
||||||
<entry key="FindUnsyncGet" value="true" />
|
|
||||||
<entry key="FindUseOfNonSerializableValue" value="true" />
|
|
||||||
<entry key="FindUselessControlFlow" value="true" />
|
|
||||||
<entry key="FindUselessObjects" value="true" />
|
|
||||||
<entry key="FormatStringChecker" value="true" />
|
|
||||||
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
|
|
||||||
<entry key="HugeSharedStringConstants" value="true" />
|
|
||||||
<entry key="IDivResultCastToDouble" value="true" />
|
|
||||||
<entry key="IncompatMask" value="true" />
|
|
||||||
<entry key="InconsistentAnnotations" value="true" />
|
|
||||||
<entry key="InefficientIndexOf" value="false" />
|
|
||||||
<entry key="InefficientInitializationInsideLoop" value="false" />
|
|
||||||
<entry key="InefficientMemberAccess" value="false" />
|
|
||||||
<entry key="InefficientToArray" value="false" />
|
|
||||||
<entry key="InfiniteLoop" value="true" />
|
|
||||||
<entry key="InfiniteRecursiveLoop" value="true" />
|
|
||||||
<entry key="InheritanceUnsafeGetResource" value="true" />
|
|
||||||
<entry key="InitializationChain" value="true" />
|
|
||||||
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
|
|
||||||
<entry key="InstantiateStaticClass" value="true" />
|
|
||||||
<entry key="IntCast2LongAsInstant" value="true" />
|
|
||||||
<entry key="InvalidJUnitTest" value="true" />
|
|
||||||
<entry key="IteratorIdioms" value="true" />
|
|
||||||
<entry key="LazyInit" value="true" />
|
|
||||||
<entry key="LoadOfKnownNullValue" value="true" />
|
|
||||||
<entry key="LostLoggerDueToWeakReference" value="true" />
|
|
||||||
<entry key="MethodReturnCheck" value="true" />
|
|
||||||
<entry key="Methods" value="true" />
|
|
||||||
<entry key="MultithreadedInstanceAccess" value="true" />
|
|
||||||
<entry key="MutableEnum" value="true" />
|
|
||||||
<entry key="MutableLock" value="true" />
|
|
||||||
<entry key="MutableStaticFields" value="true" />
|
|
||||||
<entry key="Naming" value="true" />
|
|
||||||
<entry key="Noise" value="false" />
|
|
||||||
<entry key="NoiseNullDeref" value="false" />
|
|
||||||
<entry key="NoteAnnotationRetention" value="true" />
|
|
||||||
<entry key="NoteCheckReturnValueAnnotations" value="true" />
|
|
||||||
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
|
|
||||||
<entry key="NoteJCIPAnnotation" value="true" />
|
|
||||||
<entry key="NoteNonNullAnnotations" value="false" />
|
|
||||||
<entry key="NoteNonnullReturnValues" value="false" />
|
|
||||||
<entry key="NoteSuppressedWarnings" value="true" />
|
|
||||||
<entry key="NoteUnconditionalParamDerefs" value="true" />
|
|
||||||
<entry key="NumberConstructor" value="true" />
|
|
||||||
<entry key="OptionalReturnNull" value="true" />
|
|
||||||
<entry key="OverridingEqualsNotSymmetrical" value="true" />
|
|
||||||
<entry key="PreferZeroLengthArrays" value="true" />
|
|
||||||
<entry key="PublicSemaphores" value="false" />
|
|
||||||
<entry key="QuestionableBooleanAssignment" value="true" />
|
|
||||||
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
|
|
||||||
<entry key="ReadReturnShouldBeChecked" value="true" />
|
|
||||||
<entry key="RedundantConditions" value="true" />
|
|
||||||
<entry key="RedundantInterfaces" value="true" />
|
|
||||||
<entry key="ReflectiveClasses" value="true" />
|
|
||||||
<entry key="RepeatedConditionals" value="true" />
|
|
||||||
<entry key="ResolveAllReferences" value="false" />
|
|
||||||
<entry key="RuntimeExceptionCapture" value="true" />
|
|
||||||
<entry key="SerializableIdiom" value="true" />
|
|
||||||
<entry key="StartInConstructor" value="true" />
|
|
||||||
<entry key="StaticCalendarDetector" value="true" />
|
|
||||||
<entry key="StringConcatenation" value="true" />
|
|
||||||
<entry key="SuperfluousInstanceOf" value="true" />
|
|
||||||
<entry key="SuspiciousThreadInterrupted" value="true" />
|
|
||||||
<entry key="SwitchFallthrough" value="true" />
|
|
||||||
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
|
|
||||||
<entry key="SynchronizeAndNullCheckField" value="true" />
|
|
||||||
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
|
|
||||||
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
|
|
||||||
<entry key="TestASM" value="false" />
|
|
||||||
<entry key="TestDataflowAnalysis" value="false" />
|
|
||||||
<entry key="TestingGround" value="false" />
|
|
||||||
<entry key="TestingGround2" value="false" />
|
|
||||||
<entry key="TrainFieldStoreTypes" value="true" />
|
|
||||||
<entry key="TrainLongInstantfParams" value="true" />
|
|
||||||
<entry key="TrainNonNullAnnotations" value="true" />
|
|
||||||
<entry key="TrainUnconditionalDerefParams" value="true" />
|
|
||||||
<entry key="URLProblems" value="true" />
|
|
||||||
<entry key="UncallableMethodOfAnonymousClass" value="true" />
|
|
||||||
<entry key="UnnecessaryMath" value="true" />
|
|
||||||
<entry key="UnreadFields" value="true" />
|
|
||||||
<entry key="UselessSubclassMethod" value="false" />
|
|
||||||
<entry key="VarArgsProblems" value="true" />
|
|
||||||
<entry key="VolatileUsage" value="true" />
|
|
||||||
<entry key="WaitInLoop" value="true" />
|
|
||||||
<entry key="WrongMapIterator" value="true" />
|
|
||||||
<entry key="XMLFactoryBypass" value="true" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="_reportCategories">
|
|
||||||
<map>
|
|
||||||
<entry key="BAD_PRACTICE" value="true" />
|
|
||||||
<entry key="CORRECTNESS" value="true" />
|
|
||||||
<entry key="EXPERIMENTAL" value="true" />
|
|
||||||
<entry key="I18N" value="true" />
|
|
||||||
<entry key="MALICIOUS_CODE" value="true" />
|
|
||||||
<entry key="MT_CORRECTNESS" value="true" />
|
|
||||||
<entry key="PERFORMANCE" value="true" />
|
|
||||||
<entry key="SECURITY" value="true" />
|
|
||||||
<entry key="STYLE" value="true" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</module>
|
|
454
HttpStatus.ipr
454
HttpStatus.ipr
|
@ -1,454 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ClientPropertiesManager">
|
|
||||||
<properties class="javax.swing.AbstractButton">
|
|
||||||
<property name="hideActionText" class="java.lang.Boolean" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.JComponent">
|
|
||||||
<property name="html.disable" class="java.lang.Boolean" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.JEditorPane">
|
|
||||||
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
|
|
||||||
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
|
|
||||||
<property name="charset" class="java.lang.String" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.JList">
|
|
||||||
<property name="List.isFileList" class="java.lang.Boolean" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.JPasswordField">
|
|
||||||
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.JSlider">
|
|
||||||
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
|
|
||||||
<property name="JSlider.isFilled" class="java.lang.Boolean" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.JTable">
|
|
||||||
<property name="Table.isFileList" class="java.lang.Boolean" />
|
|
||||||
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
|
|
||||||
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.JToolBar">
|
|
||||||
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.JTree">
|
|
||||||
<property name="JTree.lineStyle" class="java.lang.String" />
|
|
||||||
</properties>
|
|
||||||
<properties class="javax.swing.text.JTextComponent">
|
|
||||||
<property name="caretAspectRatio" class="java.lang.Double" />
|
|
||||||
<property name="caretWidth" class="java.lang.Integer" />
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
|
||||||
<resourceExtensions />
|
|
||||||
<wildcardResourcePatterns>
|
|
||||||
<entry name="!?*.java" />
|
|
||||||
<entry name="!?*.form" />
|
|
||||||
<entry name="!?*.class" />
|
|
||||||
<entry name="!?*.groovy" />
|
|
||||||
<entry name="!?*.scala" />
|
|
||||||
<entry name="!?*.flex" />
|
|
||||||
<entry name="!?*.kt" />
|
|
||||||
<entry name="!?*.clj" />
|
|
||||||
<entry name="!?*.aj" />
|
|
||||||
</wildcardResourcePatterns>
|
|
||||||
<annotationProcessing>
|
|
||||||
<profile default="true" name="Default" enabled="false">
|
|
||||||
<processorPath useClasspath="true" />
|
|
||||||
</profile>
|
|
||||||
</annotationProcessing>
|
|
||||||
</component>
|
|
||||||
<component name="CopyrightManager" default="">
|
|
||||||
<copyright>
|
|
||||||
<option name="myName" value="Erik's Copyright Notice" />
|
|
||||||
<option name="notice" value="&#36;file.fileName Copyright (c) &#36;today.year, 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 the author 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 OWNER 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." />
|
|
||||||
</copyright>
|
|
||||||
<module2copyright>
|
|
||||||
<element module="Source" copyright="Erik's Copyright Notice" />
|
|
||||||
</module2copyright>
|
|
||||||
<LanguageOptions name="__TEMPLATE__">
|
|
||||||
<option name="addBlankAfter" value="false" />
|
|
||||||
</LanguageOptions>
|
|
||||||
</component>
|
|
||||||
<component name="DependencyValidationManager">
|
|
||||||
<scope name="Source" pattern="file[httpstatus]:src/main/java//*.java" />
|
|
||||||
</component>
|
|
||||||
<component name="Encoding">
|
|
||||||
<file url="PROJECT" charset="UTF-8" />
|
|
||||||
</component>
|
|
||||||
<component name="EntryPointsManager">
|
|
||||||
<entry_points version="2.0" />
|
|
||||||
</component>
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="createEmptyContentRootDirectories" value="true" />
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="gradleHome" value="C:/gradle" />
|
|
||||||
<option name="gradleJvm" value="#JAVA_HOME" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
<option name="useAutoImport" value="true" />
|
|
||||||
<option name="myModules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<option name="myLocal" value="true" />
|
|
||||||
<inspection_tool class="FieldMayBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
|
||||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
|
||||||
<value>
|
|
||||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
|
||||||
<option name="REQUIRED_TAGS" value="" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="INNER_CLASS_OPTIONS">
|
|
||||||
<value>
|
|
||||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
|
||||||
<option name="REQUIRED_TAGS" value="" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="METHOD_OPTIONS">
|
|
||||||
<value>
|
|
||||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
|
||||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="FIELD_OPTIONS">
|
|
||||||
<value>
|
|
||||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
|
||||||
<option name="REQUIRED_TAGS" value="" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="IGNORE_DEPRECATED" value="false" />
|
|
||||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
|
||||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
|
||||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
|
||||||
<option name="myAdditionalJavadocTags" value="created" />
|
|
||||||
</inspection_tool>
|
|
||||||
<inspection_tool class="LocalCanBeFinal" enabled="true" level="WARNING" enabled_by_default="true">
|
|
||||||
<option name="REPORT_VARIABLES" value="true" />
|
|
||||||
<option name="REPORT_PARAMETERS" value="false" />
|
|
||||||
<option name="REPORT_CATCH_PARAMETERS" value="false" />
|
|
||||||
</inspection_tool>
|
|
||||||
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
|
|
||||||
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
|
|
||||||
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
|
|
||||||
</inspection_tool>
|
|
||||||
<inspection_tool class="UnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
||||||
<inspection_tool class="WeakerAccess" enabled="true" level="WARNING" enabled_by_default="true">
|
|
||||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" />
|
|
||||||
<option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="false" />
|
|
||||||
<option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" />
|
|
||||||
</inspection_tool>
|
|
||||||
</profile>
|
|
||||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
||||||
<OptionsSetting value="true" id="Add" />
|
|
||||||
<OptionsSetting value="true" id="Remove" />
|
|
||||||
<OptionsSetting value="true" id="Checkout" />
|
|
||||||
<OptionsSetting value="true" id="Update" />
|
|
||||||
<OptionsSetting value="true" id="Status" />
|
|
||||||
<OptionsSetting value="true" id="Edit" />
|
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/httpstatus.iml" filepath="$PROJECT_DIR$/httpstatus.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.8.x" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
<component name="libraryTable">
|
|
||||||
<library name="Gradle: com.beust:jcommander:1.48">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.beust/jcommander/1.48/bfcb96281ea3b59d626704f74bc6d625ff51cbce/jcommander-1.48.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.beust/jcommander/1.48/6deefcf90f144dfca29d4950c665a592ba029d42/jcommander-1.48-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
<library name="Gradle: javax.servlet.jsp:jsp-api:2.2.1-b03">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/javax.servlet.jsp/jsp-api/2.2.1-b03/c7205b380e9ceb4b96745656755f31f76ae01b74/jsp-api-2.2.1-b03.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/javax.servlet.jsp/jsp-api/2.2.1-b03/5ee3f521021fd5d8c0a89a208a228c1ab10ef854/jsp-api-2.2.1-b03-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
<library name="Gradle: javax.servlet:servlet-api:2.4-20040521">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.4-20040521/d66b0e9c78a90552042ab6f9f2f0afb1d87a268f/servlet-api-2.4-20040521.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
<library name="Gradle: org.beanshell:bsh:2.0b4">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.beanshell/bsh/2.0b4/a05f0a0feefa8d8467ac80e16e7de071489f0d9c/bsh-2.0b4.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
<library name="Gradle: org.testng:testng:6.9.10">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.testng/testng/6.9.10/6feb3e964aeb7097aff30c372aac3ec0f8d87ede/testng-6.9.10.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.testng/testng/6.9.10/11af8613a6b909307c7f2f554249c7b176cb50e6/testng-6.9.10-sources.jar!/" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
<library name="Gradle: servletapi:servlet-api:2.4-20040521">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/servletapi/servlet-api/2.4-20040521/d66b0e9c78a90552042ab6f9f2f0afb1d87a268f/servlet-api-2.4-20040521.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</component>
|
|
||||||
<component name="org.twodividedbyzero.idea.findbugs">
|
|
||||||
<option name="annotationTypeSettings">
|
|
||||||
<map>
|
|
||||||
<entry key="ExpPriority" value="-4473925;-12828863;-8355712;WAVE_UNDERSCORE;0;" />
|
|
||||||
<entry key="HighPriority" value="-39836;-12828863;-39836;WAVE_UNDERSCORE;1;" />
|
|
||||||
<entry key="IgnorePriority" value="-4473925;-12828863;-11978414;WAVE_UNDERSCORE;0;" />
|
|
||||||
<entry key="LowPriority" value="-4473925;-12828863;-10316203;BOXED;0;" />
|
|
||||||
<entry key="NormalPriority" value="-4473925;-12828863;-10461184;WAVE_UNDERSCORE;2;" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="_basePreferences">
|
|
||||||
<map>
|
|
||||||
<entry key="property.analysisEffortLevel" value="default" />
|
|
||||||
<entry key="property.analyzeAfterAutoMake" value="false" />
|
|
||||||
<entry key="property.analyzeAfterCompile" value="false" />
|
|
||||||
<entry key="property.annotationGutterIconEnabled" value="true" />
|
|
||||||
<entry key="property.annotationSuppressWarningsClass" value="edu.umd.cs.findbugs.annotations.SuppressFBWarnings" />
|
|
||||||
<entry key="property.annotationTextRangeMarkupEnabled" value="true" />
|
|
||||||
<entry key="property.exportAsHtml" value="true" />
|
|
||||||
<entry key="property.exportAsXml" value="true" />
|
|
||||||
<entry key="property.exportBaseDir" value="" />
|
|
||||||
<entry key="property.exportCreateArchiveDir" value="false" />
|
|
||||||
<entry key="property.exportOpenBrowser" value="true" />
|
|
||||||
<entry key="property.minPriorityToReport" value="Medium" />
|
|
||||||
<entry key="property.runAnalysisInBackground" value="false" />
|
|
||||||
<entry key="property.showHiddenDetectors" value="false" />
|
|
||||||
<entry key="property.toolWindowToFront" value="true" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="_detectors">
|
|
||||||
<map>
|
|
||||||
<entry key="AppendingToAnObjectOutputStream" value="true" />
|
|
||||||
<entry key="AtomicityProblem" value="true" />
|
|
||||||
<entry key="BadAppletConstructor" value="false" />
|
|
||||||
<entry key="BadResultSetAccess" value="true" />
|
|
||||||
<entry key="BadSyntaxForRegularExpression" value="true" />
|
|
||||||
<entry key="BadUseOfReturnValue" value="true" />
|
|
||||||
<entry key="BadlyOverriddenAdapter" value="true" />
|
|
||||||
<entry key="BooleanReturnNull" value="true" />
|
|
||||||
<entry key="BuildInterproceduralCallGraph" value="false" />
|
|
||||||
<entry key="BuildObligationPolicyDatabase" value="true" />
|
|
||||||
<entry key="BuildStringPassthruGraph" value="true" />
|
|
||||||
<entry key="CallToUnsupportedMethod" value="false" />
|
|
||||||
<entry key="CalledMethods" value="true" />
|
|
||||||
<entry key="CheckCalls" value="false" />
|
|
||||||
<entry key="CheckExpectedWarnings" value="false" />
|
|
||||||
<entry key="CheckImmutableAnnotation" value="true" />
|
|
||||||
<entry key="CheckRelaxingNullnessAnnotation" value="true" />
|
|
||||||
<entry key="CheckTypeQualifiers" value="true" />
|
|
||||||
<entry key="CloneIdiom" value="true" />
|
|
||||||
<entry key="ComparatorIdiom" value="true" />
|
|
||||||
<entry key="ConfusedInheritance" value="true" />
|
|
||||||
<entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
|
|
||||||
<entry key="CovariantArrayAssignment" value="false" />
|
|
||||||
<entry key="CrossSiteScripting" value="true" />
|
|
||||||
<entry key="DefaultEncodingDetector" value="true" />
|
|
||||||
<entry key="DoInsideDoPrivileged" value="true" />
|
|
||||||
<entry key="DontCatchIllegalMonitorStateException" value="true" />
|
|
||||||
<entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
|
|
||||||
<entry key="DontUseEnum" value="true" />
|
|
||||||
<entry key="DroppedException" value="true" />
|
|
||||||
<entry key="DumbMethodInvocations" value="true" />
|
|
||||||
<entry key="DumbMethods" value="true" />
|
|
||||||
<entry key="DuplicateBranches" value="true" />
|
|
||||||
<entry key="EmptyZipFileEntry" value="false" />
|
|
||||||
<entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
|
|
||||||
<entry key="ExplicitSerialization" value="true" />
|
|
||||||
<entry key="FieldItemSummary" value="true" />
|
|
||||||
<entry key="FinalizerNullsFields" value="true" />
|
|
||||||
<entry key="FindBadCast2" value="true" />
|
|
||||||
<entry key="FindBadForLoop" value="true" />
|
|
||||||
<entry key="FindBugsSummaryStats" value="true" />
|
|
||||||
<entry key="FindCircularDependencies" value="false" />
|
|
||||||
<entry key="FindComparatorProblems" value="true" />
|
|
||||||
<entry key="FindDeadLocalStores" value="true" />
|
|
||||||
<entry key="FindDoubleCheck" value="true" />
|
|
||||||
<entry key="FindEmptySynchronizedBlock" value="true" />
|
|
||||||
<entry key="FindFieldSelfAssignment" value="true" />
|
|
||||||
<entry key="FindFinalizeInvocations" value="true" />
|
|
||||||
<entry key="FindFloatEquality" value="true" />
|
|
||||||
<entry key="FindFloatMath" value="false" />
|
|
||||||
<entry key="FindHEmismatch" value="true" />
|
|
||||||
<entry key="FindInconsistentSync2" value="true" />
|
|
||||||
<entry key="FindJSR166LockMonitorenter" value="true" />
|
|
||||||
<entry key="FindLocalSelfAssignment2" value="true" />
|
|
||||||
<entry key="FindMaskedFields" value="true" />
|
|
||||||
<entry key="FindMismatchedWaitOrNotify" value="true" />
|
|
||||||
<entry key="FindNakedNotify" value="true" />
|
|
||||||
<entry key="FindNoSideEffectMethods" value="true" />
|
|
||||||
<entry key="FindNonSerializableStoreIntoSession" value="false" />
|
|
||||||
<entry key="FindNonSerializableValuePassedToWriteObject" value="false" />
|
|
||||||
<entry key="FindNonShortCircuit" value="true" />
|
|
||||||
<entry key="FindNullDeref" value="true" />
|
|
||||||
<entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
|
|
||||||
<entry key="FindOpenStream" value="true" />
|
|
||||||
<entry key="FindPuzzlers" value="true" />
|
|
||||||
<entry key="FindRefComparison" value="true" />
|
|
||||||
<entry key="FindReturnRef" value="true" />
|
|
||||||
<entry key="FindRoughConstants" value="true" />
|
|
||||||
<entry key="FindRunInvocations" value="true" />
|
|
||||||
<entry key="FindSelfComparison" value="true" />
|
|
||||||
<entry key="FindSelfComparison2" value="true" />
|
|
||||||
<entry key="FindSleepWithLockHeld" value="true" />
|
|
||||||
<entry key="FindSpinLoop" value="true" />
|
|
||||||
<entry key="FindSqlInjection" value="true" />
|
|
||||||
<entry key="FindTwoLockWait" value="true" />
|
|
||||||
<entry key="FindUncalledPrivateMethods" value="true" />
|
|
||||||
<entry key="FindUnconditionalWait" value="true" />
|
|
||||||
<entry key="FindUninitializedGet" value="true" />
|
|
||||||
<entry key="FindUnrelatedTypesInGenericContainer" value="true" />
|
|
||||||
<entry key="FindUnreleasedLock" value="true" />
|
|
||||||
<entry key="FindUnsatisfiedObligation" value="true" />
|
|
||||||
<entry key="FindUnsyncGet" value="true" />
|
|
||||||
<entry key="FindUseOfNonSerializableValue" value="true" />
|
|
||||||
<entry key="FindUselessControlFlow" value="true" />
|
|
||||||
<entry key="FindUselessObjects" value="true" />
|
|
||||||
<entry key="FormatStringChecker" value="true" />
|
|
||||||
<entry key="FunctionsThatMightBeMistakenForProcedures" value="true" />
|
|
||||||
<entry key="HugeSharedStringConstants" value="true" />
|
|
||||||
<entry key="IDivResultCastToDouble" value="true" />
|
|
||||||
<entry key="IncompatMask" value="true" />
|
|
||||||
<entry key="InconsistentAnnotations" value="true" />
|
|
||||||
<entry key="InefficientIndexOf" value="false" />
|
|
||||||
<entry key="InefficientInitializationInsideLoop" value="false" />
|
|
||||||
<entry key="InefficientMemberAccess" value="false" />
|
|
||||||
<entry key="InefficientToArray" value="false" />
|
|
||||||
<entry key="InfiniteLoop" value="true" />
|
|
||||||
<entry key="InfiniteRecursiveLoop" value="true" />
|
|
||||||
<entry key="InheritanceUnsafeGetResource" value="true" />
|
|
||||||
<entry key="InitializationChain" value="true" />
|
|
||||||
<entry key="InitializeNonnullFieldsInConstructor" value="true" />
|
|
||||||
<entry key="InstantiateStaticClass" value="true" />
|
|
||||||
<entry key="IntCast2LongAsInstant" value="true" />
|
|
||||||
<entry key="InvalidJUnitTest" value="true" />
|
|
||||||
<entry key="IteratorIdioms" value="true" />
|
|
||||||
<entry key="LazyInit" value="true" />
|
|
||||||
<entry key="LoadOfKnownNullValue" value="true" />
|
|
||||||
<entry key="LostLoggerDueToWeakReference" value="true" />
|
|
||||||
<entry key="MethodReturnCheck" value="true" />
|
|
||||||
<entry key="Methods" value="true" />
|
|
||||||
<entry key="MultithreadedInstanceAccess" value="true" />
|
|
||||||
<entry key="MutableEnum" value="true" />
|
|
||||||
<entry key="MutableLock" value="true" />
|
|
||||||
<entry key="MutableStaticFields" value="true" />
|
|
||||||
<entry key="Naming" value="true" />
|
|
||||||
<entry key="Noise" value="false" />
|
|
||||||
<entry key="NoiseNullDeref" value="false" />
|
|
||||||
<entry key="NoteAnnotationRetention" value="true" />
|
|
||||||
<entry key="NoteCheckReturnValueAnnotations" value="true" />
|
|
||||||
<entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
|
|
||||||
<entry key="NoteJCIPAnnotation" value="true" />
|
|
||||||
<entry key="NoteNonNullAnnotations" value="false" />
|
|
||||||
<entry key="NoteNonnullReturnValues" value="false" />
|
|
||||||
<entry key="NoteSuppressedWarnings" value="true" />
|
|
||||||
<entry key="NoteUnconditionalParamDerefs" value="true" />
|
|
||||||
<entry key="NumberConstructor" value="true" />
|
|
||||||
<entry key="OptionalReturnNull" value="true" />
|
|
||||||
<entry key="OverridingEqualsNotSymmetrical" value="true" />
|
|
||||||
<entry key="PreferZeroLengthArrays" value="true" />
|
|
||||||
<entry key="PublicSemaphores" value="false" />
|
|
||||||
<entry key="QuestionableBooleanAssignment" value="true" />
|
|
||||||
<entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
|
|
||||||
<entry key="ReadReturnShouldBeChecked" value="true" />
|
|
||||||
<entry key="RedundantConditions" value="true" />
|
|
||||||
<entry key="RedundantInterfaces" value="true" />
|
|
||||||
<entry key="ReflectiveClasses" value="true" />
|
|
||||||
<entry key="RepeatedConditionals" value="true" />
|
|
||||||
<entry key="ResolveAllReferences" value="false" />
|
|
||||||
<entry key="RuntimeExceptionCapture" value="true" />
|
|
||||||
<entry key="SerializableIdiom" value="true" />
|
|
||||||
<entry key="StartInConstructor" value="true" />
|
|
||||||
<entry key="StaticCalendarDetector" value="true" />
|
|
||||||
<entry key="StringConcatenation" value="true" />
|
|
||||||
<entry key="SuperfluousInstanceOf" value="true" />
|
|
||||||
<entry key="SuspiciousThreadInterrupted" value="true" />
|
|
||||||
<entry key="SwitchFallthrough" value="true" />
|
|
||||||
<entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
|
|
||||||
<entry key="SynchronizeAndNullCheckField" value="true" />
|
|
||||||
<entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
|
|
||||||
<entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
|
|
||||||
<entry key="TestASM" value="false" />
|
|
||||||
<entry key="TestDataflowAnalysis" value="false" />
|
|
||||||
<entry key="TestingGround" value="false" />
|
|
||||||
<entry key="TestingGround2" value="false" />
|
|
||||||
<entry key="TrainFieldStoreTypes" value="true" />
|
|
||||||
<entry key="TrainLongInstantfParams" value="true" />
|
|
||||||
<entry key="TrainNonNullAnnotations" value="true" />
|
|
||||||
<entry key="TrainUnconditionalDerefParams" value="true" />
|
|
||||||
<entry key="URLProblems" value="true" />
|
|
||||||
<entry key="UncallableMethodOfAnonymousClass" value="true" />
|
|
||||||
<entry key="UnnecessaryMath" value="true" />
|
|
||||||
<entry key="UnreadFields" value="true" />
|
|
||||||
<entry key="UselessSubclassMethod" value="false" />
|
|
||||||
<entry key="VarArgsProblems" value="true" />
|
|
||||||
<entry key="VolatileUsage" value="true" />
|
|
||||||
<entry key="WaitInLoop" value="true" />
|
|
||||||
<entry key="WrongMapIterator" value="true" />
|
|
||||||
<entry key="XMLFactoryBypass" value="true" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="_reportCategories">
|
|
||||||
<map>
|
|
||||||
<entry key="BAD_PRACTICE" value="true" />
|
|
||||||
<entry key="CORRECTNESS" value="true" />
|
|
||||||
<entry key="EXPERIMENTAL" value="true" />
|
|
||||||
<entry key="I18N" value="true" />
|
|
||||||
<entry key="MALICIOUS_CODE" value="true" />
|
|
||||||
<entry key="MT_CORRECTNESS" value="true" />
|
|
||||||
<entry key="PERFORMANCE" value="true" />
|
|
||||||
<entry key="SECURITY" value="true" />
|
|
||||||
<entry key="STYLE" value="true" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="_annotationTypeSettings">
|
|
||||||
<map>
|
|
||||||
<entry key="ExpPriority" value="-4473925;-12828863;-8355712;WAVE_UNDERSCORE;0;" />
|
|
||||||
<entry key="HighPriority" value="-39836;-12828863;-39836;WAVE_UNDERSCORE;1;" />
|
|
||||||
<entry key="IgnorePriority" value="-4473925;-12828863;-11978414;WAVE_UNDERSCORE;0;" />
|
|
||||||
<entry key="LowPriority" value="-4473925;-12828863;-10316203;BOXED;0;" />
|
|
||||||
<entry key="NormalPriority" value="-4473925;-12828863;-10461184;WAVE_UNDERSCORE;2;" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
27
LICENSE.txt
Normal file
27
LICENSE.txt
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Copyright (c) 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.
|
450
README.html
450
README.html
|
@ -1,450 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="generator" content="pandoc">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
|
||||||
<title></title>
|
|
||||||
<style type="text/css">code{white-space: pre;}</style>
|
|
||||||
<style type="text/css">
|
|
||||||
div.sourceCode { overflow-x: auto; }
|
|
||||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
|
|
||||||
margin: 0; padding: 0; vertical-align: baseline; border: none; }
|
|
||||||
table.sourceCode { width: 100%; line-height: 100%; }
|
|
||||||
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
|
|
||||||
td.sourceCode { padding-left: 5px; }
|
|
||||||
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
|
|
||||||
code > span.dt { color: #902000; } /* DataType */
|
|
||||||
code > span.dv { color: #40a070; } /* DecVal */
|
|
||||||
code > span.bn { color: #40a070; } /* BaseN */
|
|
||||||
code > span.fl { color: #40a070; } /* Float */
|
|
||||||
code > span.ch { color: #4070a0; } /* Char */
|
|
||||||
code > span.st { color: #4070a0; } /* String */
|
|
||||||
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
|
|
||||||
code > span.ot { color: #007020; } /* Other */
|
|
||||||
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
|
|
||||||
code > span.fu { color: #06287e; } /* Function */
|
|
||||||
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
|
|
||||||
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
|
|
||||||
code > span.cn { color: #880000; } /* Constant */
|
|
||||||
code > span.sc { color: #4070a0; } /* SpecialChar */
|
|
||||||
code > span.vs { color: #4070a0; } /* VerbatimString */
|
|
||||||
code > span.ss { color: #bb6688; } /* SpecialString */
|
|
||||||
code > span.im { } /* Import */
|
|
||||||
code > span.va { color: #19177c; } /* Variable */
|
|
||||||
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
|
|
||||||
code > span.op { color: #666666; } /* Operator */
|
|
||||||
code > span.bu { } /* BuiltIn */
|
|
||||||
code > span.ex { } /* Extension */
|
|
||||||
code > span.pp { color: #bc7a00; } /* Preprocessor */
|
|
||||||
code > span.at { color: #7d9029; } /* Attribute */
|
|
||||||
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
|
|
||||||
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
|
|
||||||
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
|
|
||||||
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
|
|
||||||
</style>
|
|
||||||
<!--[if lt IE 9]>
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1 id="httpstatus-jsp-tag-library">HttpStatus JSP Tag Library</h1>
|
|
||||||
<p>A simple <a href="http://www.oracle.com/technetwork/java/javaee/jsp/index.html">JSP</a> Tag Library to display the <a href="#hscode">code</a>, <a href="#hsreason">reason</a> and/or <a href="#hscode">cause</a> for <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP status codes</a> in JSP error pages.</p>
|
|
||||||
<hr />
|
|
||||||
<p>For example:</p>
|
|
||||||
<div class="sourceCode"><pre class="sourceCode jsp"><code class="sourceCode jsp"><%@ page<span class="ot"> isErrorPage</span>=<span class="st">"true"</span><span class="ot"> </span>%>
|
|
||||||
<%@ taglib<span class="ot"> prefix</span>=<span class="st">"hs"</span><span class="ot"> uri</span>=<span class="st">"http://erik.thauvin.net/taglibs/httpstatus"</span><span class="ot"> </span>%>
|
|
||||||
<html><head>
|
|
||||||
<title><span class="kw"><hs:code/></span> <span class="kw"><hs:reason</span><span class="ot"> default</span>=<span class="dt">"Server Error"</span><span class="kw">/></span></title>
|
|
||||||
</head>
|
|
||||||
<h1><span class="kw"><hs:reason</span><span class="ot"> default</span>=<span class="dt">"Server Error"</span><span class="kw">/></span></h1>
|
|
||||||
Cause: <pre><span class="kw"><hs:cause</span><span class="ot"> default</span>=<span class="dt">"Unable to complete your request."</span><span class="kw">/></span></pre>
|
|
||||||
...</code></pre></div>
|
|
||||||
<p>or</p>
|
|
||||||
<div class="sourceCode"><pre class="sourceCode jsp"><code class="sourceCode jsp"><%@ page<span class="ot"> isErrorPage</span>=<span class="st">"true"</span><span class="ot"> import</span>=<span class="st">"net.thauvin.erik.httpstatus.Reasons"</span><span class="ot"> </span>%>
|
|
||||||
<%= Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()) %></code></pre></div>
|
|
||||||
<p>would display on a <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.2">501 status code</a>:</p>
|
|
||||||
<pre><code>Not Implemented</code></pre>
|
|
||||||
<hr />
|
|
||||||
<h2 id="hscause">hs:cause</h2>
|
|
||||||
<p>The <code><hs:cause/></code> tag displays the cause of current HTTP status code, if any. A shorthand for:</p>
|
|
||||||
<div class="sourceCode"><pre class="sourceCode jsp"><code class="sourceCode jsp"><%= pageContext.getErrorData().getThrowable().getCause().getLocalizedMessage() %></code></pre></div>
|
|
||||||
<p>Optional attributes are:</p>
|
|
||||||
<table style="width:144%;">
|
|
||||||
<colgroup>
|
|
||||||
<col style="width: 16%" />
|
|
||||||
<col style="width: 127%" />
|
|
||||||
</colgroup>
|
|
||||||
<thead>
|
|
||||||
<tr class="header">
|
|
||||||
<th style="text-align: left;">Attribute</th>
|
|
||||||
<th style="text-align: left;">Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>default</code></td>
|
|
||||||
<td style="text-align: left;">The fallback value to output, if no cause is available.</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>escapeXml</code></td>
|
|
||||||
<td style="text-align: left;">Converts <, >, &, ', " to their corresponding <a href="http://dev.w3.org/html5/html-author/charref">entity codes</a>. Value is <code>true</code> by default.</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<h2 id="hscode">hs:code</h2>
|
|
||||||
<p>The <code><hs:code/></code> tag displays the current HTTP status code, if any. A shorthand for:</p>
|
|
||||||
<div class="sourceCode"><pre class="sourceCode jsp"><code class="sourceCode jsp"><%= pageContext.getErrorData().getStatusCode() %></code></pre></div>
|
|
||||||
<h2 id="hsreason">hs:reason</h2>
|
|
||||||
<p>The <code><hs:reason/></code> tag displays the reason for a HTTP status code, if any. Optional attributes are:</p>
|
|
||||||
<table style="width:144%;">
|
|
||||||
<colgroup>
|
|
||||||
<col style="width: 16%" />
|
|
||||||
<col style="width: 127%" />
|
|
||||||
</colgroup>
|
|
||||||
<thead>
|
|
||||||
<tr class="header">
|
|
||||||
<th style="text-align: left;">Attribute</th>
|
|
||||||
<th style="text-align: left;">Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>code</code></td>
|
|
||||||
<td style="text-align: left;">The HTTP status error code. If not specified the current status code is used.</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>default</code></td>
|
|
||||||
<td style="text-align: left;">The fallback value to output, if no reason is available.</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>escapeXml</code></td>
|
|
||||||
<td style="text-align: left;">Converts <, >, &, ', " to their corresponding <a href="http://dev.w3.org/html5/html-author/charref">entity codes</a>. Value is <code>true</code> by default.</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<p>The reasons are defined in a <a href="http://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html">ResourceBundle</a> properties as follows:</p>
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr class="header">
|
|
||||||
<th style="text-align: left;">Status Code</th>
|
|
||||||
<th style="text-align: left;">Reason</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>100</code></td>
|
|
||||||
<td style="text-align: left;">Continue</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>101</code></td>
|
|
||||||
<td style="text-align: left;">Switching Protocols</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>102</code></td>
|
|
||||||
<td style="text-align: left;">Processing</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>200</code></td>
|
|
||||||
<td style="text-align: left;">OK</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>201</code></td>
|
|
||||||
<td style="text-align: left;">Created</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>202</code></td>
|
|
||||||
<td style="text-align: left;">Accepted</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>203</code></td>
|
|
||||||
<td style="text-align: left;">Non-Authoritative Information</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>204</code></td>
|
|
||||||
<td style="text-align: left;">No Content</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>205</code></td>
|
|
||||||
<td style="text-align: left;">Reset Content</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>206</code></td>
|
|
||||||
<td style="text-align: left;">Partial Content</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>207</code></td>
|
|
||||||
<td style="text-align: left;">Multi-Status</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>208</code></td>
|
|
||||||
<td style="text-align: left;">Already Reported</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>226</code></td>
|
|
||||||
<td style="text-align: left;">IM Used</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>300</code></td>
|
|
||||||
<td style="text-align: left;">Multiple Choices</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>301</code></td>
|
|
||||||
<td style="text-align: left;">Moved Permanently</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>302</code></td>
|
|
||||||
<td style="text-align: left;">Moved Temporarily</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>303</code></td>
|
|
||||||
<td style="text-align: left;">See Other</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>304</code></td>
|
|
||||||
<td style="text-align: left;">Not Modified</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>305</code></td>
|
|
||||||
<td style="text-align: left;">Use Proxy</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>306</code></td>
|
|
||||||
<td style="text-align: left;">Switch Proxy</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>307</code></td>
|
|
||||||
<td style="text-align: left;">Temporary Redirect</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>308</code></td>
|
|
||||||
<td style="text-align: left;">Permanent Redirect</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>400</code></td>
|
|
||||||
<td style="text-align: left;">Bad Request</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>401</code></td>
|
|
||||||
<td style="text-align: left;">Unauthorized</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>402</code></td>
|
|
||||||
<td style="text-align: left;">Payment Required</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>403</code></td>
|
|
||||||
<td style="text-align: left;">Forbidden</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>404</code></td>
|
|
||||||
<td style="text-align: left;">Not Found</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>405</code></td>
|
|
||||||
<td style="text-align: left;">Method Not Allowed</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>406</code></td>
|
|
||||||
<td style="text-align: left;">Not Acceptable</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>407</code></td>
|
|
||||||
<td style="text-align: left;">Proxy Authentication Required</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>408</code></td>
|
|
||||||
<td style="text-align: left;">Request Timeout</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>409</code></td>
|
|
||||||
<td style="text-align: left;">Conflict</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>410</code></td>
|
|
||||||
<td style="text-align: left;">Gone</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>411</code></td>
|
|
||||||
<td style="text-align: left;">Length Required</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>412</code></td>
|
|
||||||
<td style="text-align: left;">Precondition Failed</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>413</code></td>
|
|
||||||
<td style="text-align: left;">Request Entity Too Large</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>414</code></td>
|
|
||||||
<td style="text-align: left;">Request-URI Too Long</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>415</code></td>
|
|
||||||
<td style="text-align: left;">Unsupported Media Type</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>416</code></td>
|
|
||||||
<td style="text-align: left;">Requested Range Not Satisfiable</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>417</code></td>
|
|
||||||
<td style="text-align: left;">Expectation Failed</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>418</code></td>
|
|
||||||
<td style="text-align: left;">I'm A Teapot</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>419</code></td>
|
|
||||||
<td style="text-align: left;">Insufficient Space on Resource</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>420</code></td>
|
|
||||||
<td style="text-align: left;">Method Failure</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>421</code></td>
|
|
||||||
<td style="text-align: left;">Misdirected Request</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>422</code></td>
|
|
||||||
<td style="text-align: left;">Unprocessable Entity</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>423</code></td>
|
|
||||||
<td style="text-align: left;">Locked</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>424</code></td>
|
|
||||||
<td style="text-align: left;">Failed Dependency</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>426</code></td>
|
|
||||||
<td style="text-align: left;">Upgrade Required</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>428</code></td>
|
|
||||||
<td style="text-align: left;">Precondition Required</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>429</code></td>
|
|
||||||
<td style="text-align: left;">Too Many Requests</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>431</code></td>
|
|
||||||
<td style="text-align: left;">Request Header Fields Too Large</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>440</code></td>
|
|
||||||
<td style="text-align: left;">Login Timeout</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>444</code></td>
|
|
||||||
<td style="text-align: left;">No Response</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>449</code></td>
|
|
||||||
<td style="text-align: left;">Retry With</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>450</code></td>
|
|
||||||
<td style="text-align: left;">Blocked by Windows Parental Controls</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>451</code></td>
|
|
||||||
<td style="text-align: left;">Unavailable For Legal Reasons</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>494</code></td>
|
|
||||||
<td style="text-align: left;">Request Header Too Large</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>495</code></td>
|
|
||||||
<td style="text-align: left;">Cert Error</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>496</code></td>
|
|
||||||
<td style="text-align: left;">No Cert</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>497</code></td>
|
|
||||||
<td style="text-align: left;">HTTP to HTTPS</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>498</code></td>
|
|
||||||
<td style="text-align: left;">Token Expired/Invalid</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>499</code></td>
|
|
||||||
<td style="text-align: left;">Client Closed Request</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>500</code></td>
|
|
||||||
<td style="text-align: left;">Internal Server Error</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>501</code></td>
|
|
||||||
<td style="text-align: left;">Not Implemented</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>502</code></td>
|
|
||||||
<td style="text-align: left;">Bad Gateway</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>503</code></td>
|
|
||||||
<td style="text-align: left;">Service Unavailable</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>504</code></td>
|
|
||||||
<td style="text-align: left;">Gateway Timeout</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>505</code></td>
|
|
||||||
<td style="text-align: left;">HTTP Version Not Supported</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>506</code></td>
|
|
||||||
<td style="text-align: left;">Variant Also Negotiates</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>507</code></td>
|
|
||||||
<td style="text-align: left;">Insufficient Storage</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>508</code></td>
|
|
||||||
<td style="text-align: left;">Loop Detected</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>509</code></td>
|
|
||||||
<td style="text-align: left;">Bandwidth Limit Exceeded</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>510</code></td>
|
|
||||||
<td style="text-align: left;">Not Extended</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>511</code></td>
|
|
||||||
<td style="text-align: left;">Network Authentication Required</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>520</code></td>
|
|
||||||
<td style="text-align: left;">Unknown Error</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>522</code></td>
|
|
||||||
<td style="text-align: left;">Origin Connection Time-out</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="odd">
|
|
||||||
<td style="text-align: left;"><code>598</code></td>
|
|
||||||
<td style="text-align: left;">Network Read Timeout Error</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="even">
|
|
||||||
<td style="text-align: left;"><code>599</code></td>
|
|
||||||
<td style="text-align: left;">Network Connect Timeout Error</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
425
README.md
425
README.md
|
@ -1,8 +1,37 @@
|
||||||
# HttpStatus JSP Tag Library
|
# HttpStatus JSP Tag Library
|
||||||
|
|
||||||
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.
|
[](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), [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:
|
For example:
|
||||||
|
|
||||||
|
@ -14,6 +43,7 @@ For example:
|
||||||
</head>
|
</head>
|
||||||
<h1><hs:reason default="Server Error"/></h1>
|
<h1><hs:reason default="Server Error"/></h1>
|
||||||
Cause: <pre><hs:cause default="Unable to complete your request."/></pre>
|
Cause: <pre><hs:cause default="Unable to complete your request."/></pre>
|
||||||
|
Message: <pre><hs:message default="A server error has occured."/></pre>
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -24,13 +54,53 @@ or
|
||||||
<%= Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()) %>
|
<%= 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
|
||||||
|
```
|
||||||
|
|
||||||
----
|
## Usage
|
||||||
|
|
||||||
## hs:cause
|
### [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
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.thauvin.erik.httpstatus</groupId>
|
||||||
|
<artifactId>httpstatus</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
## JSP Tags
|
||||||
|
|
||||||
|
### hs:cause
|
||||||
|
|
||||||
The `<hs:cause/>` tag displays the cause of current HTTP status code, if any. A shorthand for:
|
The `<hs:cause/>` tag displays the cause of current HTTP status code, if any. A shorthand for:
|
||||||
|
|
||||||
|
@ -40,107 +110,262 @@ The `<hs:cause/>` tag displays the cause of current HTTP status code, if any. A
|
||||||
|
|
||||||
Optional attributes are:
|
Optional attributes are:
|
||||||
|
|
||||||
Attribute | Description
|
| Attribute | Description |
|
||||||
----------- | -------------------------------------------------------------------------------------------
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
`default` | The fallback value to output, if no cause is available.
|
| `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.
|
| `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 `<hs:code/>` tag displays the current HTTP status code, if any. A shorthand for:
|
The `<hs:code/>` tag displays the current HTTP status code, if any. A shorthand for:
|
||||||
|
|
||||||
```jsp
|
```jsp
|
||||||
<%= pageContext.getErrorData().getStatusCode() %>
|
<%= pageContext.getErrorData().getStatusCode() %>
|
||||||
```
|
```
|
||||||
|
|
||||||
## hs:reason
|
### hs:message
|
||||||
|
|
||||||
The `<hs:reason/>` tag displays the reason for a HTTP status code, if any. Optional attributes are:
|
The `<hs:message/>` tag displays the current error message, if any. A shorthand for:
|
||||||
|
|
||||||
Attribute | Description
|
```jsp
|
||||||
----------- | -------------------------------------------------------------------------------------------
|
<%= request.getAttribute("javax.servlet.error.message") %>
|
||||||
`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.
|
|
||||||
|
|
||||||
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
|
| Attribute | Description |
|
||||||
----------- | -------------------------------
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
`100` | Continue
|
| `default` | The fallback value to output, if no error message is available. |
|
||||||
`101` | Switching Protocols
|
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
|
||||||
`102` | Processing
|
|
||||||
`200` | OK
|
### hs:reason
|
||||||
`201` | Created
|
|
||||||
`202` | Accepted
|
The `<hs:reason/>` tag displays the reason for an HTTP status code, if any. Optional attributes are:
|
||||||
`203` | Non-Authoritative Information
|
|
||||||
`204` | No Content
|
| Attribute | Description |
|
||||||
`205` | Reset Content
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
`206` | Partial Content
|
| `default` | The fallback value to output, if no reason is available. |
|
||||||
`207` | Multi-Status
|
| `code` | The HTTP status error code. If not specified the current status code is used. |
|
||||||
`208` | Already Reported
|
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
|
||||||
`226` | IM Used
|
|
||||||
`300` | Multiple Choices
|
## StatusCode Bean
|
||||||
`301` | Moved Permanently
|
|
||||||
`302` | Moved Temporarily
|
The `StatusCode` bean can be used to check the class of the status code error. For example, using the JSTL:
|
||||||
`303` | See Other
|
|
||||||
`304` | Not Modified
|
```jsp
|
||||||
`305` | Use Proxy
|
<%@ taglib prefix="hs" uri="http://erik.thauvin.net/taglibs/httpstatus" %>
|
||||||
`306` | Switch Proxy
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
`307` | Temporary Redirect
|
|
||||||
`308` | Permanent Redirect
|
<jsp:useBean id="statusCode" class="net.thauvin.erik.httpstatus.StatusCode"/>
|
||||||
`400` | Bad Request
|
<c:set target="${statusCode}" property="code"><hs:code/></c:set>
|
||||||
`401` | Unauthorized
|
<c:choose>
|
||||||
`402` | Payment Required
|
<c:when test="${statusCode.isClientError()}">
|
||||||
`403` | Forbidden
|
An error occurred on your side. (<hs:reason/>)
|
||||||
`404` | Not Found
|
</c:when>
|
||||||
`405` | Method Not Allowed
|
<c:otherwise>
|
||||||
`406` | Not Acceptable
|
An error occurred on our side. (<hs:message/>)
|
||||||
`407` | Proxy Authentication Required
|
</c:otherwise>
|
||||||
`408` | Request Timeout
|
</c:choose>
|
||||||
`409` | Conflict
|
```
|
||||||
`410` | Gone
|
|
||||||
`411` | Length Required
|
or in a Servlet:
|
||||||
`412` | Precondition Failed
|
|
||||||
`413` | Request Entity Too Large
|
```java
|
||||||
`414` | Request-URI Too Long
|
import net.thauvin.erik.httpstatus.StatusCode;
|
||||||
`415` | Unsupported Media Type
|
|
||||||
`416` | Requested Range Not Satisfiable
|
public class ExampleServlet extends HttpServlet {
|
||||||
`417` | Expectation Failed
|
public void doGet(HttpServletRequest request, HttpServletResponse response) {
|
||||||
`418` | I'm A Teapot
|
var statusCode = new StatusCode(
|
||||||
`419` | Insufficient Space on Resource
|
(Integer) request.getAttribute("javax.servlet.error.status_code"));
|
||||||
`420` | Method Failure
|
if (statusCode.isError()) {
|
||||||
`421` | Misdirected Request
|
if (statusCode.isServerError()) {
|
||||||
`422` | Unprocessable Entity
|
var reason = statusCode.getReason();
|
||||||
`423` | Locked
|
} else {
|
||||||
`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
|
The `StatusCode` bean methods are:
|
||||||
`450` | Blocked by Windows Parental Controls
|
|
||||||
`451` | Unavailable For Legal Reasons
|
| Method | Description |
|
||||||
`494` | Request Header Too Large
|
| --------------- | -------------------------------------------------------------------- |
|
||||||
`495` | Cert Error
|
| `getReason` | Returns the reason for the status code (eg: `Internal Server Error`) |
|
||||||
`496` | No Cert
|
| `isClientError` | Checks if the status code is a client error. |
|
||||||
`497` | HTTP to HTTPS
|
| `isError` | Checks if the status code is a server or client error. |
|
||||||
`498` | Token Expired/Invalid
|
| `isInfo` | Checks if the status code is informational. |
|
||||||
`499` | Client Closed Request
|
| `isRedirect` | Checks if the status code is a redirect. |
|
||||||
`500` | Internal Server Error
|
| `isServerError` | Checks if the status code is a server error. |
|
||||||
`501` | Not Implemented
|
| `isSuccess` | Checks if the status code is a success. (`OK`) |
|
||||||
`502` | Bad Gateway
|
| `isValid` | Checks if the status code is valid. |
|
||||||
`503` | Service Unavailable
|
|
||||||
`504` | Gateway Timeout
|
## Reasons
|
||||||
`505` | HTTP Version Not Supported
|
|
||||||
`506` | Variant Also Negotiates
|
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:
|
||||||
`507` | Insufficient Storage
|
|
||||||
`508` | Loop Detected
|
| Status Code | Reason |
|
||||||
`509` | Bandwidth Limit Exceeded
|
| ----------- | ---------------------------------------------------------- |
|
||||||
`510` | Not Extended
|
| `100` | Continue |
|
||||||
`511` | Network Authentication Required
|
| `101` | Switching Protocols |
|
||||||
`520` | Unknown Error
|
| `102` | Processing |
|
||||||
`522` | Origin Connection Time-out
|
| `103` | Early Hints |
|
||||||
`598` | Network Read Timeout Error
|
| `110` | Response is Stale |
|
||||||
`599` | Network Connect Timeout Error
|
| `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:
|
||||||
|
|
||||||
|
```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:
|
||||||
|
|
||||||
|
```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
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
2
bld
Executable file
2
bld
Executable file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.httpstatus.HttpStatusBuild "$@"
|
4
bld.bat
Normal file
4
bld.bat
Normal file
|
@ -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 %*
|
187
build.gradle
187
build.gradle
|
@ -1,187 +0,0 @@
|
||||||
plugins {
|
|
||||||
id "com.jfrog.bintray" version "1.5"
|
|
||||||
}
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
apply plugin: 'application'
|
|
||||||
apply plugin: 'maven'
|
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
|
|
||||||
import org.apache.tools.ant.taskdefs.condition.Os
|
|
||||||
|
|
||||||
defaultTasks 'deploy'
|
|
||||||
|
|
||||||
def deployDir = 'deploy'
|
|
||||||
def localProps = 'local.properties'
|
|
||||||
def isRelease = 'release' in gradle.startParameter.taskNames
|
|
||||||
def mavenGroupId = 'net.thauvin.erik.httpstatus'
|
|
||||||
|
|
||||||
def getVersion(isIncrement = false)
|
|
||||||
{
|
|
||||||
def propsFile = 'version.properties'
|
|
||||||
def majorKey = 'version.major'
|
|
||||||
def minorKey = 'version.minor'
|
|
||||||
def patchKey = 'version.patch'
|
|
||||||
def metaKey = 'version.buildmeta'
|
|
||||||
def preKey = 'version.prerelease'
|
|
||||||
if (isIncrement)
|
|
||||||
{
|
|
||||||
ant.propertyfile(file: propsFile) {
|
|
||||||
entry(key: patchKey,
|
|
||||||
type: 'int',
|
|
||||||
default: '-1',
|
|
||||||
operation: '+')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
def p = new Properties()
|
|
||||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
|
||||||
def metadata = p.getProperty(metaKey, '')
|
|
||||||
def prerelease = p.getProperty(preKey, '')
|
|
||||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
|
||||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
|
||||||
}
|
|
||||||
|
|
||||||
version = getVersion();
|
|
||||||
|
|
||||||
mainClassName = 'net.thauvin.erik.httpstatus.Reasons'
|
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile 'servletapi:servlet-api:+'
|
|
||||||
compile 'javax.servlet.jsp:jsp-api:+'
|
|
||||||
|
|
||||||
testCompile 'org.testng:testng:+'
|
|
||||||
}
|
|
||||||
|
|
||||||
bintray {
|
|
||||||
def p = new Properties()
|
|
||||||
file(localProps).withInputStream { stream -> p.load(stream) }
|
|
||||||
user = p.getProperty('bintrayUser');
|
|
||||||
key = p.getProperty('bintrayApiKey');
|
|
||||||
publications = ['MyPublication']
|
|
||||||
pkg {
|
|
||||||
repo = 'maven'
|
|
||||||
name = 'HttpStatus'
|
|
||||||
licenses = ['BSD 3-Clause']
|
|
||||||
desc = 'HttpStatus JSP Tag Library'
|
|
||||||
websiteUrl = 'https://github.com/ethauvin/HttpStatus'
|
|
||||||
issueTrackerUrl = 'https://github.com/ethauvin/HttpStatus/issues'
|
|
||||||
vcsUrl = 'https://github.com/ethauvin/HttpStatus.git'
|
|
||||||
labels = ['jsp', 'tag library', 'http', 'status code', 'java']
|
|
||||||
publicDownloadNumbers = true
|
|
||||||
version {
|
|
||||||
name = project.version
|
|
||||||
desc = 'Version ' + project.version
|
|
||||||
vcsTag = project.version
|
|
||||||
gpg {
|
|
||||||
sign = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
MyPublication(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
artifact sourcesJar
|
|
||||||
artifact javadocJar
|
|
||||||
groupId mavenGroupId
|
|
||||||
artifactId rootProject.name
|
|
||||||
version project.version
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
||||||
group = 'Build'
|
|
||||||
description = 'Builds an archive of the javadoc docs.'
|
|
||||||
classifier = 'javadoc'
|
|
||||||
from javadoc.destinationDir
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
|
||||||
group = 'Build'
|
|
||||||
description = 'Builds an archive of the source code.'
|
|
||||||
classifier = 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives javadocJar
|
|
||||||
archives sourcesJar
|
|
||||||
}
|
|
||||||
|
|
||||||
javadoc {
|
|
||||||
options.tags = ['created']
|
|
||||||
options.author = true
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava {
|
|
||||||
doFirst {
|
|
||||||
project.version = getVersion(isRelease)
|
|
||||||
}
|
|
||||||
//options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest.attributes('Main-Class': mainClassName)
|
|
||||||
}
|
|
||||||
|
|
||||||
clean {
|
|
||||||
delete deployDir
|
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
useTestNG()
|
|
||||||
}
|
|
||||||
|
|
||||||
task wrapper(type: Wrapper) {
|
|
||||||
gradleVersion = gradle.gradleVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
task copyToDeploy(type: Copy) {
|
|
||||||
from(configurations.runtime) {
|
|
||||||
exclude 'servlet-api-*.jar'
|
|
||||||
exclude 'jsp-api-*.jar'
|
|
||||||
}
|
|
||||||
from jar
|
|
||||||
into deployDir
|
|
||||||
}
|
|
||||||
|
|
||||||
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
|
||||||
description = "Copies all needed files to the ${deployDir} directory."
|
|
||||||
group = "Publishing"
|
|
||||||
outputs.dir deployDir
|
|
||||||
inputs.files copyToDeploy
|
|
||||||
mustRunAfter clean
|
|
||||||
}
|
|
||||||
|
|
||||||
task release(dependsOn: ['deploy', 'wrapper']) << {
|
|
||||||
group = "Publishing"
|
|
||||||
description = "Releases new version."
|
|
||||||
isRelease = true
|
|
||||||
}
|
|
||||||
|
|
||||||
task pandoc(type: Exec) {
|
|
||||||
group = "Documentation"
|
|
||||||
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-o', 'README.html', 'README.md']
|
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS))
|
|
||||||
{
|
|
||||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
executable '/usr/local/bin/pandoc'
|
|
||||||
args pandoc_args
|
|
||||||
}
|
|
||||||
standardOutput = new ByteArrayOutputStream()
|
|
||||||
ext.output = {
|
|
||||||
return standardOutput.toString()
|
|
||||||
}
|
|
||||||
}
|
|
109
config/pmd.xml
Normal file
109
config/pmd.xml
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="erik"
|
||||||
|
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||||
|
<description>Erik's Ruleset</description>
|
||||||
|
<!-- BEST PRACTICES -->
|
||||||
|
<rule ref="category/java/bestpractices.xml">
|
||||||
|
<exclude name="AvoidPrintStackTrace"/>
|
||||||
|
<exclude name="GuardLogStatement"/>
|
||||||
|
<exclude name="UnitTestContainsTooManyAsserts"/>
|
||||||
|
<exclude name="UnitTestShouldUseTestAnnotation"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
||||||
|
<properties>
|
||||||
|
<property name="violationSuppressXPath"
|
||||||
|
value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- CODE STYLE -->
|
||||||
|
<rule ref="category/java/codestyle.xml">
|
||||||
|
<exclude name="AtLeastOneConstructor"/>
|
||||||
|
<exclude name="ClassNamingConventions"/>
|
||||||
|
<exclude name="CommentDefaultAccessModifier"/>
|
||||||
|
<exclude name="ConfusingTernary"/>
|
||||||
|
<exclude name="FieldNamingConventions"/>
|
||||||
|
<exclude name="LocalVariableCouldBeFinal"/>
|
||||||
|
<exclude name="LongVariable"/>
|
||||||
|
<exclude name="MethodArgumentCouldBeFinal"/>
|
||||||
|
<exclude name="OnlyOneReturn"/>
|
||||||
|
<exclude name="PackageCase"/>
|
||||||
|
<exclude name="ShortClassName"/>
|
||||||
|
<exclude name="ShortMethodName"/>
|
||||||
|
<exclude name="ShortVariable"/>
|
||||||
|
<exclude name="UseExplicitTypes"/>
|
||||||
|
<exclude name="UseUnderscoresInNumericLiterals"/>
|
||||||
|
<exclude name="UselessParentheses"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="category/java/codestyle.xml/UnnecessaryImport">
|
||||||
|
<properties>
|
||||||
|
<property name="violationSuppressRegex" value="Unused (static|.*\.\*).*"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- DESIGN -->
|
||||||
|
<rule ref="category/java/design.xml">
|
||||||
|
<exclude name="AvoidCatchingGenericException"/>
|
||||||
|
<exclude name="AvoidDeeplyNestedIfStmts"/>
|
||||||
|
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
||||||
|
<exclude name="CognitiveComplexity"/>
|
||||||
|
<exclude name="CyclomaticComplexity"/>
|
||||||
|
<exclude name="ExcessiveParameterList"/>
|
||||||
|
<exclude name="ExcessivePublicCount"/>
|
||||||
|
<exclude name="GodClass"/>
|
||||||
|
<exclude name="LawOfDemeter"/>
|
||||||
|
<exclude name="LoosePackageCoupling"/>
|
||||||
|
<exclude name="NPathComplexity"/>
|
||||||
|
<exclude name="NcssCount"/>
|
||||||
|
<exclude name="TooManyFields"/>
|
||||||
|
<exclude name="TooManyMethods"/>
|
||||||
|
<exclude name="UseObjectForClearerAPI"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- DOCUMENTATION -->
|
||||||
|
<rule ref="category/java/documentation.xml">
|
||||||
|
<exclude name="CommentRequired"/>
|
||||||
|
<exclude name="CommentSize"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- ERROR PRONE -->
|
||||||
|
<rule ref="category/java/errorprone.xml">
|
||||||
|
<exclude name="AssignmentInOperand"/>
|
||||||
|
<exclude name="AvoidCatchingNPE"/>
|
||||||
|
<exclude name="AvoidDuplicateLiterals"/>
|
||||||
|
<exclude name="AvoidFieldNameMatchingMethodName"/>
|
||||||
|
<exclude name="AvoidFieldNameMatchingTypeName"/>
|
||||||
|
<exclude name="AvoidLiteralsInIfCondition"/>
|
||||||
|
<exclude name="NullAssignment"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
|
||||||
|
<properties>
|
||||||
|
<property name="allowWhile" value="true"/>
|
||||||
|
<property name="allowFor" value="true"/>
|
||||||
|
<property name="allowIf" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
|
||||||
|
<properties>
|
||||||
|
<property name="skipAnnotations" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- MULTITHREADING -->
|
||||||
|
<rule ref="category/java/multithreading.xml">
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- PERFORMANCE -->
|
||||||
|
<rule ref="category/java/performance.xml">
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- SECURITY -->
|
||||||
|
<rule ref="category/java/security.xml">
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +0,0 @@
|
||||||
#Thu Jan 21 15:05:39 PST 2016
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip
|
|
160
gradlew
vendored
160
gradlew
vendored
|
@ -1,160 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
##
|
|
||||||
## Gradle start up script for UN*X
|
|
||||||
##
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# 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
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
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" ] ; 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
|
|
||||||
|
|
||||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
|
||||||
function splitJvmOpts() {
|
|
||||||
JVM_OPTS=("$@")
|
|
||||||
}
|
|
||||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
|
||||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
|
||||||
|
|
||||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
|
90
gradlew.bat
vendored
90
gradlew.bat
vendored
|
@ -1,90 +0,0 @@
|
||||||
@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
|
|
||||||
|
|
||||||
@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=
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
|
||||||
set APP_HOME=%DIRNAME%
|
|
||||||
|
|
||||||
@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 Windowz variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
if "%@eval[2+2]" == "4" goto 4NT_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=%*
|
|
||||||
goto execute
|
|
||||||
|
|
||||||
:4NT_args
|
|
||||||
@rem Get arguments from the 4NT Shell from JP Software
|
|
||||||
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
|
|
BIN
lib/bld/bld-wrapper.jar
Normal file
BIN
lib/bld/bld-wrapper.jar
Normal file
Binary file not shown.
7
lib/bld/bld-wrapper.properties
Normal file
7
lib/bld/bld-wrapper.properties
Normal file
|
@ -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
|
50
pom.xml
Normal file
50
pom.xml
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>net.thauvin.erik.httpstatus</groupId>
|
||||||
|
<artifactId>httpstatus</artifactId>
|
||||||
|
<version>1.1.2-SNAPSHOT</version>
|
||||||
|
<name>HttpStatus</name>
|
||||||
|
<description>Tag library to display the code, reason, cause and/or message for HTTP status codes in JSP error pages</description>
|
||||||
|
<url>https://github.com/ethauvin/HttpStatus</url>
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>The BSD 3-Clause License</name>
|
||||||
|
<url>https://opensource.org/licenses/BSD-3-Clause</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.servlet</groupId>
|
||||||
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
|
<version>6.1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.servlet.jsp</groupId>
|
||||||
|
<artifactId>jakarta.servlet.jsp-api</artifactId>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.el</groupId>
|
||||||
|
<artifactId>jakarta.el-api</artifactId>
|
||||||
|
<version>6.0.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<id>ethauvin</id>
|
||||||
|
<name>Erik C. Thauvin</name>
|
||||||
|
<email>erik@thauvin.net</email>
|
||||||
|
<url>https://erik.thauvin.net/</url>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:https://github.com/ethauvin/HttpStatus.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:ethauvin/HttpStatus.git</developerConnection>
|
||||||
|
<url>https://github.com/ethauvin/HttpStatus</url>
|
||||||
|
</scm>
|
||||||
|
</project>
|
|
@ -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'
|
|
7
sonar-project.properties
Normal file
7
sonar-project.properties
Normal file
|
@ -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
|
157
src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java
Normal file
157
src/bld/java/net/thauvin/erik/httpstatus/HttpStatusBuild.java
Normal file
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,41 +1,41 @@
|
||||||
/*
|
/*
|
||||||
* Reasons.java
|
* Reasons.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
* this list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of the author nor the names of its contributors may be
|
* 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
|
* used to endorse or promote products derived from this software without
|
||||||
* specific prior written permission.
|
* specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.thauvin.erik.httpstatus;
|
package net.thauvin.erik.httpstatus;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeSet;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the {@link #REASON_PHRASES reason phrases} map from {@link #BUNDLE_BASENAME bundle properties}, and
|
* Populates the {@link #REASON_PHRASES reason phrases} map from {@link #BUNDLE_BASENAME bundle properties}, and
|
||||||
|
@ -45,66 +45,78 @@ import java.util.TreeMap;
|
||||||
* @created 2015-12-02
|
* @created 2015-12-02
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class Reasons
|
public final class Reasons {
|
||||||
{
|
/**
|
||||||
/**
|
* The resource bundle base name.
|
||||||
* The resource bundle base name.
|
*/
|
||||||
*/
|
static final String BUNDLE_BASENAME = "net.thauvin.erik.httpstatus.reasons";
|
||||||
public static final String BUNDLE_BASENAME = "net.thauvin.erik.httpstatus.reasons";
|
/**
|
||||||
|
* The reason phrases map.
|
||||||
|
*/
|
||||||
|
private static final Map<String, String> REASON_PHRASES = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
// Initializes the reason phrases map.
|
||||||
* The reason phrases map.
|
static {
|
||||||
*/
|
var bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
|
||||||
private static final Map<String, String> REASON_PHRASES = new TreeMap<String, String>();
|
for (var key : bundle.keySet()) {
|
||||||
|
REASON_PHRASES.put(key, bundle.getString(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the reason phrase for the specified status code.
|
* Disables the default constructor.
|
||||||
*
|
*/
|
||||||
* @param statusCode The status code.
|
private Reasons() {
|
||||||
*
|
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||||
* @return The reason phrase, or <code>null</code>.
|
}
|
||||||
*/
|
|
||||||
public static String getReasonPhrase(final int statusCode)
|
|
||||||
{
|
|
||||||
return getReasonPhrase(Integer.toString(statusCode));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the reason phrase for the specified status code.
|
* Returns the reason phrase for the specified status code.
|
||||||
*
|
*
|
||||||
* @param statusCode The status code.
|
* @param statusCode The status code.
|
||||||
*
|
* @return The reason phrase, or <code>null</code>.
|
||||||
* @return The reason phrase, or <code>null</code>.
|
*/
|
||||||
*/
|
public static String getReasonPhrase(int statusCode) {
|
||||||
public static String getReasonPhrase(final String statusCode)
|
return getReasonPhrase(Integer.toString(statusCode));
|
||||||
{
|
}
|
||||||
return REASON_PHRASES.get(statusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the status codes and reason phrases.
|
* Returns the reason phrase for the specified status code.
|
||||||
*
|
*
|
||||||
* @param args The command line arguments.
|
* @param statusCode The status code.
|
||||||
*/
|
* @return The reason phrase, or <code>null</code>.
|
||||||
public static void main(final String... args)
|
*/
|
||||||
{
|
public static String getReasonPhrase(String statusCode) {
|
||||||
for (final Map.Entry<String, String> entry : REASON_PHRASES.entrySet())
|
return REASON_PHRASES.get(statusCode);
|
||||||
{
|
}
|
||||||
System.out.println(entry.getKey() + ": " + entry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Total: " + REASON_PHRASES.entrySet().size());
|
/**
|
||||||
}
|
* Prints the reason phrase for the given status code(s).
|
||||||
|
*
|
||||||
/**
|
* @param args The status code(s) or response class(es), prints all if none.
|
||||||
* Initializes the reason phrases map.
|
*/
|
||||||
*/
|
@SuppressWarnings("PMD.SystemPrintln")
|
||||||
static
|
public static void main(String... args) {
|
||||||
{
|
var keys = new TreeSet<>(REASON_PHRASES.keySet());
|
||||||
final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
|
if (args.length >= 1) {
|
||||||
for (final String key : bundle.keySet())
|
for (var arg : args) {
|
||||||
{
|
if (arg.endsWith("xx")) { // e.g.: 2xx
|
||||||
REASON_PHRASES.put(key, bundle.getString(key));
|
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 { // Print all
|
||||||
|
keys.forEach(k -> System.out.println(k + ": " + REASON_PHRASES.get(k)));
|
||||||
|
System.out.println("Total: " + REASON_PHRASES.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
153
src/main/java/net/thauvin/erik/httpstatus/StatusCode.java
Normal file
153
src/main/java/net/thauvin/erik/httpstatus/StatusCode.java
Normal file
|
@ -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 <code>StatusCode</code> bean implements methods to check the class of an HTTP status code.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||||
|
* @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 <code>null</code>.
|
||||||
|
* @see Reasons#getReasonPhrase(int)
|
||||||
|
*/
|
||||||
|
public String getReason() {
|
||||||
|
return Reasons.getReasonPhrase(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the status code is a client error. (eg: <code>Internal Server Error</code>)
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the status code is a client error, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isClientError() {
|
||||||
|
return code >= 400 && code < 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the status code is a client or server error.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the status code is an error, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isError() {
|
||||||
|
return code >= 400 && code < 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the status code is informational.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the status code is informational, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isInfo() {
|
||||||
|
return code >= 100 && code < 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the status code is a redirect.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the status code is a redirect, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isRedirect() {
|
||||||
|
return code >= 300 && code < 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the status code is a server error.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the status code is a server error, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isServerError() {
|
||||||
|
return code >= 500 && code < 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the status code is a (<code>OK</code>) success.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the status code is a success, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return code >= 200 && code < 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the status code is valid.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the status code is valid, <code>false</code> 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,137 +1,97 @@
|
||||||
/*
|
/*
|
||||||
* Utils.java
|
* Utils.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
* this list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of the author nor the names of its contributors may be
|
* 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
|
* used to endorse or promote products derived from this software without
|
||||||
* specific prior written permission.
|
* specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.thauvin.erik.httpstatus;
|
package net.thauvin.erik.httpstatus;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code>Utils</code> class.
|
* The <code>Utils</code> class implements a collection of utility methods used throughout this project.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||||
* @created 2015-12-03
|
* @created 2015-12-03
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public final class Utils
|
public final class Utils {
|
||||||
{
|
/**
|
||||||
|
* Disables the default constructor.
|
||||||
|
*
|
||||||
|
* @throws UnsupportedOperationException If the constructor is called.
|
||||||
|
*/
|
||||||
|
private Utils() {
|
||||||
|
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the default constructor.
|
* Converts <code><</code>, <code>></code>, <code>&</code>, <code>'</code>, <code>"</code>
|
||||||
*
|
* to their corresponding entity codes.
|
||||||
* @throws UnsupportedOperationException If the constructor is called.
|
*
|
||||||
*/
|
* @param value The string value to convert.
|
||||||
private Utils()
|
* @return The converted string value.
|
||||||
throws UnsupportedOperationException
|
*/
|
||||||
{
|
public static String escapeXml(String value) {
|
||||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
var escaped = new StringBuilder();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
for (var i = 0; i < value.length(); i++) {
|
||||||
* Writes a string value to the specified writer. The default value is used when the actual value is null.
|
var c = value.charAt(i);
|
||||||
*
|
switch (c) {
|
||||||
* @param out The writer to output the value to.
|
case '<' -> escaped.append("<");
|
||||||
* @param value The string value.
|
case '>' -> escaped.append(">");
|
||||||
* @param defaultValue The default value.
|
case '&' -> escaped.append("&");
|
||||||
* @param xml The {@link #escapeXml(String) xml} flag.
|
case '\'' -> escaped.append("'");
|
||||||
*
|
case '"' -> escaped.append(""");
|
||||||
* @throws IOException f an I/O error occurs.
|
default -> escaped.append(c);
|
||||||
*/
|
}
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return escaped.toString();
|
||||||
* Converts <code><</code>, <code>></code>, <code>&</code>, <code>'</code>, <code>"</code>
|
}
|
||||||
* to their corresponding entity codes.
|
|
||||||
*
|
|
||||||
* @param value The string value to convert.
|
|
||||||
*
|
|
||||||
* @return The converted string value.
|
|
||||||
*/
|
|
||||||
public static String escapeXml(final String value)
|
|
||||||
{
|
|
||||||
final StringBuilder escaped = new StringBuilder();
|
|
||||||
|
|
||||||
for (int i = 0; i < value.length(); i++)
|
/**
|
||||||
{
|
* Writes a string value to the specified writer. The default value is used when the actual value is null.
|
||||||
final char c = value.charAt(i);
|
*
|
||||||
switch (c)
|
* @param out The writer to output the value to.
|
||||||
{
|
* @param value The string value.
|
||||||
case '<':
|
* @param defaultValue The default value.
|
||||||
escaped.append("<");
|
* @param xml The {@link #escapeXml(String) xml} flag.
|
||||||
break;
|
* @throws IOException If an I/O error occurs.
|
||||||
case '>':
|
*/
|
||||||
escaped.append(">");
|
public static void outWrite(Writer out, String value, String defaultValue, boolean xml)
|
||||||
break;
|
throws IOException {
|
||||||
case '&':
|
if (value != null) {
|
||||||
escaped.append("&");
|
out.write(xml ? escapeXml(value) : value);
|
||||||
break;
|
} else if (defaultValue != null) {
|
||||||
case '\'':
|
out.write(xml ? escapeXml(defaultValue) : defaultValue);
|
||||||
escaped.append("'");
|
}
|
||||||
break;
|
}
|
||||||
case '"':
|
}
|
||||||
escaped.append(""");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
escaped.append(c);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return escaped.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
11
src/main/java/net/thauvin/erik/httpstatus/package.html
Normal file
11
src/main/java/net/thauvin/erik/httpstatus/package.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
|
<HTML LANG="en">
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>HttpStatus JSP Tag Library</TITLE>
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
A simple JSP Tag Library to display the code, reason and/or cause for HTTP status codes in JSP error pages.
|
||||||
|
|
||||||
|
@since 1.0
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
|
@ -1,45 +1,44 @@
|
||||||
/*
|
/*
|
||||||
* CauseTag.java
|
* CauseTag.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
* this list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of the author nor the names of its contributors may be
|
* 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
|
* used to endorse or promote products derived from this software without
|
||||||
* specific prior written permission.
|
* specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.thauvin.erik.httpstatus.taglibs;
|
package net.thauvin.erik.httpstatus.taglibs;
|
||||||
|
|
||||||
|
import jakarta.servlet.jsp.JspWriter;
|
||||||
|
import jakarta.servlet.jsp.PageContext;
|
||||||
import net.thauvin.erik.httpstatus.Utils;
|
import net.thauvin.erik.httpstatus.Utils;
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
|
||||||
import javax.servlet.jsp.JspWriter;
|
|
||||||
import javax.servlet.jsp.PageContext;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code><hs:cause></code> tag returns the cause (if any) for the current HTTP Status Error Code.
|
* The <code><hs:cause></code> tag returns the cause (if any) for the current HTTP Status Error Code.
|
||||||
*
|
*
|
||||||
|
@ -47,26 +46,33 @@ import java.io.IOException;
|
||||||
* @created 2015-12-03
|
* @created 2015-12-03
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class CauseTag extends XmlSupport
|
public class CauseTag extends XmlSupport {
|
||||||
{
|
/**
|
||||||
@Override
|
* Prints the cause (if any) for the current HTTP Status Error Code.
|
||||||
public void doTag()
|
*
|
||||||
throws JspException, IOException
|
* @throws IOException If an error occurs while writing the output.
|
||||||
{
|
*/
|
||||||
final PageContext pageContext = (PageContext) getJspContext();
|
@Override
|
||||||
final JspWriter out = pageContext.getOut();
|
public void doTag() throws IOException {
|
||||||
|
PageContext pageContext = (PageContext) getJspContext();
|
||||||
|
JspWriter out = pageContext.getOut();
|
||||||
|
|
||||||
String cause;
|
Throwable cause = pageContext.getErrorData().getThrowable().getCause();
|
||||||
|
|
||||||
try
|
Utils.outWrite(out, getCause(cause), defaultValue, escapeXml);
|
||||||
{
|
}
|
||||||
cause = pageContext.getErrorData().getThrowable().getCause().getLocalizedMessage();
|
|
||||||
}
|
|
||||||
catch (NullPointerException ignore)
|
|
||||||
{
|
|
||||||
cause = defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils.outWrite(out, cause, defaultValue, escapeXml);
|
/**
|
||||||
}
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,42 +1,41 @@
|
||||||
/*
|
/*
|
||||||
* CodeTag.java
|
* CodeTag.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
* this list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of the author nor the names of its contributors may be
|
* 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
|
* used to endorse or promote products derived from this software without
|
||||||
* specific prior written permission.
|
* specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.thauvin.erik.httpstatus.taglibs;
|
package net.thauvin.erik.httpstatus.taglibs;
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
import jakarta.servlet.jsp.JspWriter;
|
||||||
import javax.servlet.jsp.JspWriter;
|
import jakarta.servlet.jsp.PageContext;
|
||||||
import javax.servlet.jsp.PageContext;
|
import jakarta.servlet.jsp.tagext.SimpleTagSupport;
|
||||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,15 +45,17 @@ import java.io.IOException;
|
||||||
* @created 2015-12-03
|
* @created 2015-12-03
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class CodeTag extends SimpleTagSupport
|
public class CodeTag extends SimpleTagSupport {
|
||||||
{
|
/**
|
||||||
@Override
|
* Writes the HTTP Status Error Code to the current JspWriter.
|
||||||
public void doTag()
|
*
|
||||||
throws JspException, IOException
|
* @throws IOException If an I/O error occurs.
|
||||||
{
|
*/
|
||||||
final PageContext pageContext = (PageContext) getJspContext();
|
@Override
|
||||||
final JspWriter out = pageContext.getOut();
|
public void doTag() throws IOException {
|
||||||
|
PageContext pageContext = (PageContext) getJspContext();
|
||||||
|
JspWriter out = pageContext.getOut();
|
||||||
|
|
||||||
out.write(String.valueOf(pageContext.getErrorData().getStatusCode()));
|
out.write(String.valueOf(pageContext.getErrorData().getStatusCode()));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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 <code><hs:message></code> tag returns the message (if any) for the current error.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,44 +1,42 @@
|
||||||
/*
|
/*
|
||||||
* ReasonTag.java
|
* ReasonTag.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
* this list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of the author nor the names of its contributors may be
|
* 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
|
* used to endorse or promote products derived from this software without
|
||||||
* specific prior written permission.
|
* specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.thauvin.erik.httpstatus.taglibs;
|
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.Reasons;
|
||||||
import net.thauvin.erik.httpstatus.Utils;
|
import net.thauvin.erik.httpstatus.Utils;
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
|
||||||
import javax.servlet.jsp.JspWriter;
|
|
||||||
import javax.servlet.jsp.PageContext;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,47 +47,35 @@ import java.io.IOException;
|
||||||
* @created 2015-12-02
|
* @created 2015-12-02
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class ReasonTag extends XmlSupport
|
public class ReasonTag extends XmlSupport {
|
||||||
{
|
private int statusCode = -1;
|
||||||
private int statusCode;
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void doTag()
|
* Writes the Reason Phrase for the current (or specified) HTTP Status Error Code.
|
||||||
throws JspException, IOException
|
*/
|
||||||
{
|
@Override
|
||||||
final PageContext pageContext = (PageContext) getJspContext();
|
public void doTag() {
|
||||||
final JspWriter out = pageContext.getOut();
|
PageContext pageContext = (PageContext) getJspContext();
|
||||||
|
JspWriter out = pageContext.getOut();
|
||||||
try
|
|
||||||
{
|
|
||||||
if (statusCode >= 0)
|
|
||||||
{
|
|
||||||
Utils.outWrite(out, Reasons.getReasonPhrase(statusCode), defaultValue, escapeXml);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.outWrite(out,
|
|
||||||
Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()),
|
|
||||||
defaultValue,
|
|
||||||
escapeXml);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException ignore)
|
|
||||||
{
|
|
||||||
// Ignore.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the status code.
|
|
||||||
*
|
|
||||||
* @param statusCode The status code.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public void setCode(final int statusCode)
|
|
||||||
{
|
|
||||||
this.statusCode = statusCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (statusCode > -1) {
|
||||||
|
Utils.outWrite(out, Reasons.getReasonPhrase(statusCode), defaultValue, escapeXml);
|
||||||
|
} else {
|
||||||
|
Utils.outWrite(out, Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()), defaultValue,
|
||||||
|
escapeXml);
|
||||||
|
}
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
// Ignore.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the status code.
|
||||||
|
*
|
||||||
|
* @param statusCode The status code.
|
||||||
|
*/
|
||||||
|
public void setCode(int statusCode) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,38 @@
|
||||||
/*
|
/*
|
||||||
* XmlSupport.java
|
* XmlSupport.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
* this list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of the author nor the names of its contributors may be
|
* 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
|
* used to endorse or promote products derived from this software without
|
||||||
* specific prior written permission.
|
* specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.thauvin.erik.httpstatus.taglibs;
|
package net.thauvin.erik.httpstatus.taglibs;
|
||||||
|
|
||||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
import jakarta.servlet.jsp.tagext.SimpleTagSupport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds support for the <code>default</code> and <code>escapeXml</code> tag attributes.
|
* Adds support for the <code>default</code> and <code>escapeXml</code> tag attributes.
|
||||||
|
@ -42,37 +41,34 @@ import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||||
* @created 2015-12-03
|
* @created 2015-12-03
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public abstract class XmlSupport extends SimpleTagSupport
|
public abstract class XmlSupport extends SimpleTagSupport {
|
||||||
{
|
/**
|
||||||
/**
|
* Default value string.
|
||||||
* Default value string.
|
*/
|
||||||
*/
|
String defaultValue;
|
||||||
protected String defaultValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escape XML flag.
|
* Escape XML flag.
|
||||||
*/
|
*/
|
||||||
protected boolean escapeXml = true;
|
boolean escapeXml = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default value.
|
* Sets the default value.
|
||||||
*
|
*
|
||||||
* @param defaultValue The default value.
|
* @param defaultValue The default value.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void setDefault(final String defaultValue)
|
public void setDefault(String defaultValue) {
|
||||||
{
|
this.defaultValue = defaultValue;
|
||||||
this.defaultValue = defaultValue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link net.thauvin.erik.httpstatus.Utils#escapeXml(String) xml} flag.
|
* Sets the {@link net.thauvin.erik.httpstatus.Utils#escapeXml(String) xml} flag.
|
||||||
*
|
*
|
||||||
* @param escapeXml <code>true</code> or <code>false</code>
|
* @param escapeXml <code>true</code> or <code>false</code>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public void setEscapeXml(final boolean escapeXml)
|
public void setEscapeXml(boolean escapeXml) {
|
||||||
{
|
this.escapeXml = escapeXml;
|
||||||
this.escapeXml = escapeXml;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
|
<HTML LANG="en">
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>HttpStatus JSP Tag Library</TITLE>
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
This package contains the JSP tags used to display the code, reason and/or cause for HTTP status codes.
|
||||||
|
|
||||||
|
@since 1.0
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
|
@ -1,45 +1,43 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!--
|
<!--
|
||||||
httpstatus.tld
|
~ httpstatus.tld
|
||||||
|
~
|
||||||
Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
~ Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
All rights reserved.
|
~ All rights reserved.
|
||||||
|
~
|
||||||
Redistribution and use in source and binary forms, with or without
|
~ Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
~ modification, are permitted provided that the following conditions are met:
|
||||||
met:
|
~
|
||||||
|
~ Redistributions of source code must retain the above copyright notice, this
|
||||||
Redistributions of source code must retain the above copyright notice,
|
~ list of conditions and the following disclaimer.
|
||||||
this list of conditions and the following disclaimer.
|
~
|
||||||
|
~ Redistributions in binary form must reproduce the above copyright notice,
|
||||||
Redistributions in binary form must reproduce the above copyright notice,
|
~ this list of conditions and the following disclaimer in the documentation
|
||||||
this list of conditions and the following disclaimer in the documentation
|
~ and/or other materials provided with the distribution.
|
||||||
and/or other materials provided with the distribution.
|
~
|
||||||
|
~ Neither the name of this project nor the names of its contributors may be
|
||||||
Neither the name of the author nor the names of its contributors may be
|
~ used to endorse or promote products derived from this software without
|
||||||
used to endorse or promote products derived from this software without
|
~ specific prior written permission.
|
||||||
specific prior written permission.
|
~
|
||||||
|
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
~ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
~ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
~ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
~ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
~ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
~ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
~ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
~ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
-->
|
-->
|
||||||
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
|
<taglib xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
|
||||||
version="2.1">
|
version="2.1">
|
||||||
|
|
||||||
<description>HttpStatus JSP Tag Library</description>
|
<description>HttpStatus JSP Tag Library</description>
|
||||||
<display-name>HttpStatus JSP Tags</display-name>
|
<display-name>HttpStatus JSP Tags</display-name>
|
||||||
<tlib-version>1.0</tlib-version>
|
<tlib-version>1.1.1</tlib-version>
|
||||||
<short-name>hs</short-name>
|
<short-name>hs</short-name>
|
||||||
<uri>http://erik.thauvin.net/taglibs/httpstatus</uri>
|
<uri>http://erik.thauvin.net/taglibs/httpstatus</uri>
|
||||||
|
|
||||||
|
@ -77,6 +75,31 @@
|
||||||
<body-content>empty</body-content>
|
<body-content>empty</body-content>
|
||||||
</tag>
|
</tag>
|
||||||
|
|
||||||
|
<tag>
|
||||||
|
<description>
|
||||||
|
Returns the message (if any) for the current error.
|
||||||
|
</description>
|
||||||
|
<name>message</name>
|
||||||
|
<tag-class>net.thauvin.erik.httpstatus.taglibs.MessageTag</tag-class>
|
||||||
|
<body-content>empty</body-content>
|
||||||
|
<attribute>
|
||||||
|
<description>
|
||||||
|
Default value if the resulting error message is null.
|
||||||
|
</description>
|
||||||
|
<name>default</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
<attribute>
|
||||||
|
<description>
|
||||||
|
Converts <, > ,& ,' ," to their corresponding entity codes. Value is true by default.
|
||||||
|
</description>
|
||||||
|
<name>escapeXml</name>
|
||||||
|
<required>false</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
</tag>
|
||||||
|
|
||||||
<tag>
|
<tag>
|
||||||
<description>
|
<description>
|
||||||
Returns the Reason Phrase for the current (or specified) HTTP Status Error Code.
|
Returns the Reason Phrase for the current (or specified) HTTP Status Error Code.
|
||||||
|
@ -109,5 +132,4 @@
|
||||||
<rtexprvalue>true</rtexprvalue>
|
<rtexprvalue>true</rtexprvalue>
|
||||||
</attribute>
|
</attribute>
|
||||||
</tag>
|
</tag>
|
||||||
|
|
||||||
</taglib>
|
</taglib>
|
||||||
|
|
|
@ -1,6 +1,44 @@
|
||||||
|
#
|
||||||
|
# reasons.properties
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
100=Continue
|
100=Continue
|
||||||
101=Switching Protocols
|
101=Switching Protocols
|
||||||
102=Processing
|
102=Processing
|
||||||
|
103=Early Hints
|
||||||
|
110=Response is Stale
|
||||||
|
111=Revalidation Failed
|
||||||
|
112=Disconnected Operation
|
||||||
|
113=Heuristic Expiration
|
||||||
|
199=Miscellaneous Warning
|
||||||
200=OK
|
200=OK
|
||||||
201=Created
|
201=Created
|
||||||
202=Accepted
|
202=Accepted
|
||||||
|
@ -10,14 +48,17 @@
|
||||||
206=Partial Content
|
206=Partial Content
|
||||||
207=Multi-Status
|
207=Multi-Status
|
||||||
208=Already Reported
|
208=Already Reported
|
||||||
|
214=Transformation Applied
|
||||||
|
218=This is fine
|
||||||
226=IM Used
|
226=IM Used
|
||||||
|
299=Miscellaneous Persistent Warning
|
||||||
300=Multiple Choices
|
300=Multiple Choices
|
||||||
301=Moved Permanently
|
301=Moved Permanently
|
||||||
302=Moved Temporarily
|
302=Found/Moved Temporarily
|
||||||
303=See Other
|
303=See Other
|
||||||
304=Not Modified
|
304=Not Modified
|
||||||
305=Use Proxy
|
305=Use Proxy
|
||||||
306=Switch Proxy
|
306=Unused
|
||||||
307=Temporary Redirect
|
307=Temporary Redirect
|
||||||
308=Permanent Redirect
|
308=Permanent Redirect
|
||||||
400=Bad Request
|
400=Bad Request
|
||||||
|
@ -33,31 +74,35 @@
|
||||||
410=Gone
|
410=Gone
|
||||||
411=Length Required
|
411=Length Required
|
||||||
412=Precondition Failed
|
412=Precondition Failed
|
||||||
413=Request Entity Too Large
|
413=Payload Too Large
|
||||||
414=Request-URI Too Long
|
414=URI Too Long
|
||||||
415=Unsupported Media Type
|
415=Unsupported Media Type
|
||||||
416=Requested Range Not Satisfiable
|
416=Range Not Satisfiable
|
||||||
417=Expectation Failed
|
417=Expectation Failed
|
||||||
418=I'm A Teapot
|
418=I'm A Teapot
|
||||||
419=Insufficient Space on Resource
|
419=Insufficient Space on Resource
|
||||||
420=Method Failure
|
420=Method Failure
|
||||||
421=Misdirected Request
|
421=Misdirected Request
|
||||||
422=Unprocessable Entity
|
422=Unprocessable Content
|
||||||
423=Locked
|
423=Locked
|
||||||
424=Failed Dependency
|
424=Failed Dependency
|
||||||
|
425=Too Early
|
||||||
426=Upgrade Required
|
426=Upgrade Required
|
||||||
428=Precondition Required
|
428=Precondition Required
|
||||||
429=Too Many Requests
|
429=Too Many Requests
|
||||||
|
430=Request Header Fields Too Large
|
||||||
431=Request Header Fields Too Large
|
431=Request Header Fields Too Large
|
||||||
440=Login Timeout
|
440=Login Timeout
|
||||||
444=No Response
|
444=No Response
|
||||||
449=Retry With
|
449=Retry With
|
||||||
450=Blocked by Windows Parental Controls
|
450=Blocked by Windows Parental Controls
|
||||||
451=Unavailable For Legal Reasons
|
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
|
494=Request Header Too Large
|
||||||
495=Cert Error
|
495=SSL Certificate Error
|
||||||
496=No Cert
|
496=SSL Certificate Required
|
||||||
497=HTTP to HTTPS
|
497=HTTP Request Sent to HTTPS Port
|
||||||
498=Token Expired/Invalid
|
498=Token Expired/Invalid
|
||||||
499=Client Closed Request
|
499=Client Closed Request
|
||||||
500=Internal Server Error
|
500=Internal Server Error
|
||||||
|
@ -73,6 +118,17 @@
|
||||||
510=Not Extended
|
510=Not Extended
|
||||||
511=Network Authentication Required
|
511=Network Authentication Required
|
||||||
520=Unknown Error
|
520=Unknown Error
|
||||||
522=Origin Connection Time-out
|
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
|
598=Network Read Timeout Error
|
||||||
599=Network Connect Timeout Error
|
599=Network Connect Timeout Error
|
||||||
|
783=Unexpected Token
|
||||||
|
|
58
src/test/java/net/thauvin/erik/httpstatus/CauseTagTest.java
Normal file
58
src/test/java/net/thauvin/erik/httpstatus/CauseTagTest.java
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* CauseTagTest.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 net.thauvin.erik.httpstatus.taglibs.CauseTag;
|
||||||
|
import org.assertj.core.api.AutoCloseableSoftAssertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the CauseTagTest class.
|
||||||
|
*
|
||||||
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
|
* @since 1.1.0
|
||||||
|
*/
|
||||||
|
class CauseTagTest {
|
||||||
|
@Test
|
||||||
|
void causeTest() {
|
||||||
|
var message = "This is the cause";
|
||||||
|
var tag = new CauseTag();
|
||||||
|
|
||||||
|
try (var softly = new AutoCloseableSoftAssertions()) {
|
||||||
|
softly.assertThat(tag.getCause(new Exception(message))).as("has cause").isEqualTo(message);
|
||||||
|
softly.assertThat(tag.getCause(new Exception())).as("no cause").isNull();
|
||||||
|
softly.assertThat(tag.getCause(null)).as("null").isNull();
|
||||||
|
softly.assertThat(tag.getCause(new Exception(""))).as("empty").isEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
104
src/test/java/net/thauvin/erik/httpstatus/ReasonsMainTest.java
Normal file
104
src/test/java/net/thauvin/erik/httpstatus/ReasonsMainTest.java
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
/*
|
||||||
|
* ReasonsMainTest.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 org.junit.jupiter.api.AfterAll;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main Class Tests.
|
||||||
|
*
|
||||||
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
|
* @created 2019-05-06
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
class ReasonsMainTest {
|
||||||
|
private static final ByteArrayOutputStream OUTPUT_STREAM = new ByteArrayOutputStream();
|
||||||
|
private static final PrintStream SYSTEM_OUT = System.out;
|
||||||
|
|
||||||
|
@AfterAll
|
||||||
|
public static void restoreStreams() {
|
||||||
|
System.setOut(SYSTEM_OUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
public static void setUpStreams() {
|
||||||
|
System.setOut(new PrintStream(OUTPUT_STREAM));
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void resetStreams() {
|
||||||
|
OUTPUT_STREAM.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMain() {
|
||||||
|
Reasons.main("401");
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).contains(Reasons.getReasonPhrase("401")).as("401");
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).doesNotContain("500").as("401 no 500");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMainAll() {
|
||||||
|
Reasons.main();
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).contains(Reasons.getReasonPhrase(301)).as("301");
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).contains(Reasons.getReasonPhrase(404)).as("404");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMainArgs() {
|
||||||
|
Reasons.main("500", "302");
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).contains(Reasons.getReasonPhrase("500")).as("500 (302)");
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).contains(Reasons.getReasonPhrase("302")).as("(500) 302");
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).doesNotContain("404").as("500/302 not 404");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMainArgsClass() {
|
||||||
|
Reasons.main("2xx");
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).contains(Reasons.getReasonPhrase("200")).as("2xx");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testMainInvalid() {
|
||||||
|
Reasons.main("aaa");
|
||||||
|
assertThat(OUTPUT_STREAM.toString()).as("invalid argument: aaa").isEmpty();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,73 +1,59 @@
|
||||||
/*
|
/*
|
||||||
* ReasonsTest.java
|
* ReasonsTest.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
* this list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of the author nor the names of its contributors may be
|
* 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
|
* used to endorse or promote products derived from this software without
|
||||||
* specific prior written permission.
|
* specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.thauvin.erik.httpstatus;
|
package net.thauvin.erik.httpstatus;
|
||||||
|
|
||||||
import org.testng.Assert;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.testng.annotations.DataProvider;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code>ReasonsTest</code> class.
|
* Reasons Tests.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||||
* @created 2015-12-03
|
* @created 2015-12-03
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
class ReasonsTest {
|
||||||
public class ReasonsTest
|
@Test
|
||||||
{
|
void testGetReasonPhrase() {
|
||||||
@DataProvider(name = "reasons")
|
var bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
|
||||||
public Object[][] reasons()
|
for (var key : bundle.keySet()) {
|
||||||
{
|
assertThat(Reasons.getReasonPhrase(key)).as("getReasonPhrase(%s)", key).isEqualTo(bundle.getString(key));
|
||||||
final ResourceBundle bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
|
assertThat(Reasons.getReasonPhrase(Integer.parseInt(key))).as("getReasonPhrase(%s)", key)
|
||||||
final Object[][] reasons = new String[bundle.keySet().size()][2];
|
.isEqualTo(bundle.getString(key));
|
||||||
int i = 0;
|
}
|
||||||
for (final String key : bundle.keySet())
|
|
||||||
{
|
|
||||||
reasons[i][0] = key;
|
|
||||||
reasons[i][1] = bundle.getString(key);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return reasons;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(dataProvider = "reasons")
|
}
|
||||||
public void testGetReasonPhrase(String code, String reason)
|
}
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
Assert.assertEquals(reason, Reasons.getReasonPhrase(code));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* StatusCodeTest.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 org.assertj.core.api.AutoCloseableSoftAssertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* StatusCode Tests.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||||
|
* @since 1.1.0
|
||||||
|
*/
|
||||||
|
class StatusCodeTest {
|
||||||
|
@Test
|
||||||
|
void testStatusCode() {
|
||||||
|
var bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
|
||||||
|
var statusCode = new StatusCode();
|
||||||
|
|
||||||
|
try (var softly = new AutoCloseableSoftAssertions()) {
|
||||||
|
for (var key : bundle.keySet()) {
|
||||||
|
int code = Integer.parseInt(key);
|
||||||
|
|
||||||
|
statusCode.setCode(code);
|
||||||
|
softly.assertThat(statusCode.getCode()).as("is not %s", code).isEqualTo(code);
|
||||||
|
softly.assertThat(statusCode.isInfo()).as("%s is info", code).isEqualTo(code >= 100 && code < 200);
|
||||||
|
softly.assertThat(statusCode.isSuccess()).as("%s is ok", code).isEqualTo(code >= 200 && code < 300);
|
||||||
|
softly.assertThat(statusCode.isRedirect()).as("%s is redirect", code)
|
||||||
|
.isEqualTo(code >= 300 && code < 400);
|
||||||
|
softly.assertThat(statusCode.isClientError()).as("%s is client error", code)
|
||||||
|
.isEqualTo(code >= 400 && code < 500);
|
||||||
|
softly.assertThat(statusCode.isServerError()).as("%s is server error", code)
|
||||||
|
.isEqualTo(code >= 500 && code < 600);
|
||||||
|
softly.assertThat(statusCode.isError()).as("%s is error", code).isEqualTo(code >= 400 && code < 600);
|
||||||
|
softly.assertThat(statusCode.isValid()).as("%s is valid", code).isTrue();
|
||||||
|
|
||||||
|
softly.assertThat(statusCode.getReason()).as("%s reason phrase is not valid", code)
|
||||||
|
.isEqualTo(Reasons.getReasonPhrase(code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try (var softly = new AutoCloseableSoftAssertions()) {
|
||||||
|
int[] unknowns = {0, 99, 600};
|
||||||
|
|
||||||
|
for (var code : unknowns) {
|
||||||
|
statusCode.setCode(code);
|
||||||
|
softly.assertThat(statusCode.getCode()).as("is not %s", code).isEqualTo(code);
|
||||||
|
softly.assertThat(statusCode.isInfo()).as("%s is info", code).isFalse();
|
||||||
|
softly.assertThat(statusCode.isSuccess()).as("%s is ok", code).isFalse();
|
||||||
|
softly.assertThat(statusCode.isRedirect()).as("%s is redirect", code).isFalse();
|
||||||
|
softly.assertThat(statusCode.isClientError()).as("%s is client error", code).isFalse();
|
||||||
|
softly.assertThat(statusCode.isServerError()).as("%s is server error", code).isFalse();
|
||||||
|
softly.assertThat(statusCode.isError()).as("%s is error", code).isFalse();
|
||||||
|
softly.assertThat(statusCode.isValid()).as("%s is invalid", code).isFalse();
|
||||||
|
softly.assertThat(statusCode.getReason()).as("%s reason phrase is not null.", code).isNull();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
statusCode = new StatusCode(900);
|
||||||
|
assertThat(statusCode.getCode()).as("is not %s", statusCode.getCode()).isEqualTo(900);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,58 +1,100 @@
|
||||||
/*
|
/*
|
||||||
* UtilsTest.java
|
* UtilsTest.java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
* Copyright 2015-2025 Erik C. Thauvin (erik@thauvin.net)
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* met:
|
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
* this list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of the author nor the names of its contributors may be
|
* 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
|
* used to endorse or promote products derived from this software without
|
||||||
* specific prior written permission.
|
* specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.thauvin.erik.httpstatus;
|
package net.thauvin.erik.httpstatus;
|
||||||
|
|
||||||
import org.testng.Assert;
|
import org.assertj.core.api.AutoCloseableSoftAssertions;
|
||||||
import org.testng.annotations.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <code>UtilsTest</code> class.
|
* Utils Tests.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||||
* @created 2015-12-03
|
* @created 2015-12-03
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
class UtilsTest {
|
||||||
public class UtilsTest
|
@Test
|
||||||
{
|
void testEscapeXml() {
|
||||||
@Test
|
assertThat(Utils.escapeXml(
|
||||||
public void testEscapeXml()
|
"This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" "
|
||||||
throws Exception
|
+ "parameter & value."))
|
||||||
{
|
.isEqualTo("This is a test. We wan't to make sure that everything is <encoded> " +
|
||||||
Assert.assertEquals(
|
"according the "encoding" parameter & value.");
|
||||||
"This is a test. We wan't to make sure that everything is <encoded> according the "encoding" parameter & value.",
|
}
|
||||||
Utils.escapeXml(
|
|
||||||
"This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" parameter & value."));
|
@Test
|
||||||
}
|
void testOutWrite() throws IOException {
|
||||||
}
|
try (var sw = new StringWriter(); var softly = new AutoCloseableSoftAssertions()) {
|
||||||
|
var defaultValue = "default";
|
||||||
|
Utils.outWrite(sw, null, defaultValue, false);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(default)").isEqualTo(defaultValue);
|
||||||
|
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
|
Utils.outWrite(sw, "", defaultValue, false);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(value empty)").isEmpty();
|
||||||
|
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
|
Utils.outWrite(sw, null, null, true);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(null)").isEmpty();
|
||||||
|
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
|
Utils.outWrite(sw, "value", defaultValue, false);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(value)").isEqualTo("value");
|
||||||
|
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
|
Utils.outWrite(sw, "wan't", defaultValue, true);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(wan't)").isEqualTo("wan't");
|
||||||
|
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
|
Utils.outWrite(sw, null, "1 & 1", true);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(1 & 1)").isEqualTo("1 & 1");
|
||||||
|
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
|
Utils.outWrite(sw, "", defaultValue, true);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(value empty).as(xml)").isEmpty();
|
||||||
|
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
|
Utils.outWrite(sw, null, "", true);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(default empty)").isEmpty();
|
||||||
|
|
||||||
|
sw.getBuffer().setLength(0);
|
||||||
|
Utils.outWrite(sw, null, null, true);
|
||||||
|
softly.assertThat(sw.toString()).as("outWrite(null).as(xml)").isEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#Thu, 21 Jan 2016 15:05:31 -0800
|
|
||||||
version.major=1
|
|
||||||
version.minor=0
|
|
||||||
version.patch=2
|
|
||||||
version.buildmeta=
|
|
||||||
version.prerelease=
|
|
Loading…
Add table
Add a link
Reference in a new issue