Moved from Gradle to bld

This commit is contained in:
Erik C. Thauvin 2023-05-10 00:21:31 -07:00
parent 84cfe6098d
commit 68975a497b
58 changed files with 632 additions and 2393 deletions

View file

@ -6,50 +6,38 @@ defaults: &defaults
TERM: dumb
CI_NAME: "CircleCI"
defaults_gradle: &defaults_gradle
defaults_gradle: &defaults_bld
steps:
- checkout
- restore_cache:
keys:
- gradle-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- gradle-dependencies-
- run:
name: Gradle Dependencies
command: ./gradlew dependencies
- save_cache:
paths:
- ~/.m2
key: gradle-dependencies-{{ checksum "build.gradle" }}
- name: Grant execute permission for bld
command: chmod +x bld
- run:
name: Run All Checks
command: ./gradlew check
- store_artifacts:
path: build/reports/
destination: reports
- store_test_results:
path: build/reports/
- name: Download the dependencies
command: ./bld download
- run:
- name: Run tests with bld
command: ./bld c
jobs:
build_gradle_jdk18:
bld_jdk17:
<<: *defaults
docker:
- image: cimg/openjdk:18.0
- image: cimg/openjdk:17.0
<<: *defaults_gradle
<<: *defaults_bld
build_gradle_jdk11:
bld_jdk11:
<<: *defaults
docker:
- image: cimg/openjdk:11.0
<<: *defaults_gradle
<<: *defaults_bld
workflows:
version: 2
gradle:
jobs:
- build_gradle_jdk11
- build_gradle_jdk18
- bld_jdk11
- bld_gradle_jdk17

32
.github/workflows/bld.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: bld-ci
on: [ push, pull_request, workflow_dispatch ]
jobs:
build-bld-project:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17, 19, 20 ]
steps:
- name: Checkout source repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Grant execute permission for bld
run: chmod +x bld
- name: Download the dependencies
run: ./bld download
- name: Run tests with bld
run: ./bld compile test

View file

@ -1,61 +0,0 @@
name: gradle-ci
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m"
SONAR_JDK: "11"
strategy:
matrix:
java-version: [ 11, 18 ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache SonarCloud packages
if: matrix.java-version == env.SONAR_JDK
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-${{ matrix.java-version }}-
- name: Test with Gradle
run: ./gradlew build check --stacktrace
- name: SonarCloud
if: success() && matrix.java-version == env.SONAR_JDK
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube
- name: Cleanup Gradle Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties

80
.gitignore vendored
View file

@ -1,25 +1,57 @@
**/.idea/dictionaries
**/.idea/gradle.xml
**/.idea/libraries
**/.idea/tasks.xml
**/.idea/workspace.xml
*.iws
.DS_Store
.classpath
.gradle
.nb-gradle
.project
.settings
/bin
/build
/deploy
/dist
/gen
/gradle.properties
/local.properties
/out
/proguard-project.txt
/project.properties
/test-output
Thumbs.db
ehthumbs.db
.DS_Store
build
lib/bld/**
!lib/bld/bld-wrapper.properties
!lib/bld/bld-wrapper.jar
lib/compile/
lib/runtime/
lib/standalone/
lib/test/
# IDEA ignores
# User-specific
.idea/**/workspace.xml
.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
local.properties

1
.idea/.name generated
View file

@ -1 +0,0 @@
httpstatus

29
.idea/app.iml generated Normal file
View 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
View 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>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Erik's Code Style" />
</state>
</component>

6
.idea/compiler.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

13
.idea/copyright/Erik_s_Copyright.xml generated Normal file
View file

@ -0,0 +1,13 @@
<component name="CopyrightManager" default="">
<copyright>
<option name="myName" value="Erik's Copyright Notice" />
<option name="notice" value="&amp;#36;file.fileName&#10;&#10;Copyright &amp;#36;today.year sErik C. Thauvin (erik@thauvin.net)&#10;All rights reserved.&#10;&#10;Redistribution and use in source and binary forms, with or without&#10;modification, are permitted provided that the following conditions are met:&#10;&#10; Redistributions of source code must retain the above copyright notice, this&#10; list of conditions and the following disclaimer.&#10;&#10; Redistributions in binary form must reproduce the above copyright notice,&#10; this list of conditions and the following disclaimer in the documentation&#10; and/or other materials provided with the distribution.&#10;&#10; Neither the name of this project nor the names of its contributors may be&#10; used to endorse or promote products derived from this software without&#10; specific prior written permission.&#10;&#10;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;&#10;AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&#10;IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE&#10;DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE&#10;FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL&#10;DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR&#10;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER&#10;CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,&#10;OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE&#10;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="JAVA">
<option name="fileTypeOverride" value="3" />
<option name="addBlankAfter" value="false" />
</LanguageOptions>
</component>

3
.idea/copyright/profiles_settings.xml generated Normal file
View file

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="Erik's Copyright Notice" />
</component>

View file

@ -1,72 +1,8 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<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="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="created" />
</inspection_tool>
<inspection_tool class="MissingJavadoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="PACKAGE_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="MODULE_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="TOP_LEVEL_CLASS_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="INNER_CLASS_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="METHOD_SETTINGS">
<Options>
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
<option name="ENABLED" value="false" />
</Options>
</option>
<option name="FIELD_SETTINGS">
<Options>
<option name="ENABLED" value="false" />
</Options>
</option>
</inspection_tool>
</profile>
</component>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
</remote-repository>
</component>
</project>

17
.idea/libraries/bld.xml generated Normal file
View file

@ -0,0 +1,17 @@
<component name="libraryTable">
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.6.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.rife2/dist/rife2-1.6.3-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
View 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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
</library>
</component>

14
.idea/libraries/runtime.xml generated Normal file
View 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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

14
.idea/libraries/test.xml generated Normal file
View 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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
</library>
</component>

18
.idea/misc.xml generated
View file

@ -1,8 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
<component name="EntryPointsManager">
<pattern value="net.thauvin.erik.httpstatus.HttpStatusBuild" />
<pattern value="net.thauvin.erik.httpstatus.HttpStatusBuild" method="pmd" />
</component>
<component name="PDMPlugin">
<option name="customRuleSets">
<list>
<option value="K:\java\semver\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>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="18" project-jdk-type="JavaSDK" />
</project>

9
.idea/modules.xml generated Normal file
View 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
View 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>

11
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "net.thauvin.erik.httpstatus.HttpStatusTest"
}
]
}

15
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"java.project.sourcePaths": [
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.rife2/dist/rife2-1.6.3.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

View file

@ -1,4 +1,4 @@
Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
Copyright (c) 2015-2023, Erik C. Thauvin (erik@thauvin.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,8 +1,14 @@
# HttpStatus JSP Tag Library
[![Release](https://img.shields.io/github/release/ethauvin/httpstatus.svg)](https://github.com/ethauvin/httpstatus/releases/latest) [![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik.httpstatus/httpstatus.svg?label=maven%20central)](https://search.maven.org/search?q=g:%22net.thauvin.erik.httpstatus%22%20AND%20a:%22httpstatus%22)
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/httpstatus/badge.svg?targetFile=build.gradle)](https://snyk.io/test/github/ethauvin/httpstatus?targetFile=build.gradle) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_HttpStatus&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_HttpStatus)
[![GitHub CI](https://github.com/ethauvin/httpstatus/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/httpstatus/actions/workflows/gradle.yml) [![Build status](https://ci.appveyor.com/api/projects/status/w5j4kul3w2rkigxb?svg=true)](https://ci.appveyor.com/project/ethauvin/httpstatus) [![CircleCI](https://circleci.com/gh/ethauvin/HttpStatus/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/HttpStatus/tree/master)
[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
[![Release](https://img.shields.io/github/release/ethauvin/httpstatus.svg)](https://github.com/ethauvin/httpstatus/releases/latest)
[![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik.httpstatus/httpstatus.svg?label=maven%20central)](https://search.maven.org/search?q=g:%22net.thauvin.erik.httpstatus%22%20AND%20a:%22httpstatus%22)
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/net.thauvin.erik.httpstatus/httpstatus?server=https%3A%2F%2Foss.sonatype.org)
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause)
[![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/httpstatus/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/ethauvin/httpstatus?targetFile=pom.xml)
[![GitHub CI](https://github.com/ethauvin/httpstatus/actions/workflows/bld.yml/badge.svg)](https://github.com/ethauvin/httpstatus/actions/workflows/bld.yml)
[![Build status](https://ci.appveyor.com/api/projects/status/w5j4kul3w2rkigxb?svg=true)](https://ci.appveyor.com/project/ethauvin/httpstatus)
[![CircleCI](https://circleci.com/gh/ethauvin/HttpStatus/tree/master.svg?style=shield)](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.
@ -36,6 +42,10 @@ would display on a [501 status code](http://www.w3.org/Protocols/rfc2616/rfc2616
Include the following in your `build.gradle` file:
```gradle
repositories {
mavenCentral()
}
dependencies {
implementation 'net.thauvin.erik.httpstatus:httpstatus:1.1.0'
}
@ -150,7 +160,7 @@ Method | Description
## Reasons
The reasons are defined in a [ResourceBundle](http://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html) properties as follows:
The reasons are defined in a [ResourceBundle](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ResourceBundle.html) properties as follows:
Status Code | Reason
----------- | -----------------------------------

View file

@ -7,11 +7,11 @@ skip_tags: true
build:
verbosity: detailed
build_script:
- gradlew.bat assemble --info --no-daemon
download_script:
- bld.bat download
test_script:
- gradlew.bat check --info --no-daemon
- bld.bat compile test
branches:
only:

2
bld Executable file
View 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
View 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 %*

View file

@ -1,247 +0,0 @@
plugins {
id 'java'
id 'jacoco'
id 'idea'
id 'application'
id 'maven-publish'
id 'signing'
id 'pmd'
id 'com.github.ben-manes.versions' version '0.42.0'
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
id 'com.github.spotbugs' version '5.0.10'
id 'org.sonarqube' version '3.4.0.2513'
}
import com.github.spotbugs.snom.SpotBugsTask
import org.apache.tools.ant.taskdefs.condition.Os
defaultTasks 'deploy'
final def deployDir = 'deploy'
final def mavenName = 'HttpStatus'
final def mavenDescription = 'HttpStatus JSP Tag Library'
final def mavenUrl = 'https://github.com/ethauvin/HttpStatus'
final def mavenLicense = 'The BSD 3-Clause License'
final def mavenLicenseUrl = 'http://opensource.org/licenses/BSD-3-Clause'
final def mavenScmCon = 'https://github.com/ethauvin/HttpStatus.git'
final def mavenScmDevCon = 'git@github.com:ethauvin/HttpStatus.git'
group = 'net.thauvin.erik.httpstatus'
mainClassName = 'net.thauvin.erik.httpstatus.Reasons'
ext {
versions = [
pmd : '6.47.0',
spotbugs: '4.7.1'
]
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
// compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
// compileOnly 'javax.servlet.jsp:jsp-api:2.2.1-b03'
// compileOnly 'javax.el:javax.el-api:3.0.1-b06'
compileOnly 'jakarta.servlet:jakarta.servlet-api:6.0.0'
compileOnly 'jakarta.servlet.jsp:jakarta.servlet.jsp-api:3.1.0'
compileOnly 'jakarta.el:jakarta.el-api:5.0.1'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0'
spotbugsPlugins 'com.mebigfatguy.sb-contrib:sb-contrib:7.4.7'
compileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
testCompileOnly "com.github.spotbugs:spotbugs-annotations:$versions.spotbugs"
testImplementation 'org.testng:testng:7.6.1'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withJavadocJar()
withSourcesJar()
}
javadoc {
doFirst {
title = mavenDescription + ' ' + project.version
}
options.source = 8
options.tags = ['created']
options.author = true
options.links('https://docs.oracle.com/javase/8/docs/api/')
options.addStringOption('Xdoclint:none', '-quiet')
}
jar {
manifest.attributes('Main-Class': mainClassName)
}
clean {
doLast {
project.delete(fileTree(deployDir))
}
}
test {
testLogging {
exceptionFormat = 'full'
events('passed', 'skipped', 'failed')
}
useTestNG()
}
spotbugs {
toolVersion = versions.spotbugs
excludeFilter = file("$projectDir/config/spotbugs/excludeFilter.xml")
}
pmd {
toolVersion = versions.pmd
ignoreFailures = true
ruleSets = []
ruleSetFiles = files("${projectDir}/config/pmd.xml")
consoleOutput = true
}
tasks.withType(SpotBugsTask) {
reports {
xml.required = false
html.required = true
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId = project.group
artifactId = rootProject.name
pom {
name = mavenName
description = mavenDescription
url = mavenUrl
licenses {
license {
name = mavenLicense
url = mavenLicenseUrl
}
}
developers {
developer {
id = 'ethauvin'
name = 'Erik C. Thauvin'
email = 'erik@thauvin.net'
url = 'https://erik.thauvin.net/'
}
}
scm {
connection = 'scm:git:' + mavenScmCon
developerConnection = 'scm:git:' + mavenScmDevCon
url = mavenUrl
}
}
}
}
repositories {
maven {
name = 'ossrh'
project.afterEvaluate {
url = project.version.contains('SNAPSHOT')
? 'https://oss.sonatype.org/content/repositories/snapshots/'
: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
}
credentials(PasswordCredentials)
}
}
}
signing {
useGpgCmd()
sign publishing.publications.mavenJava
}
task copyToDeploy(type: Copy) {
from(configurations.runtimeClasspath) {
exclude('javax.servlet-api-*.jar',
'jsp-api-*.jar',
'jakarta.servlet-*.jar',
'jakarta-servlet.*.jar',
'jakarta.el-api*.jar')
}
from jar
into deployDir
}
task deploy {
description = "Copies all needed files to the ${deployDir} directory."
group = 'Publishing'
dependsOn(clean, build, 'copyToDeploy')
outputs.dir deployDir
inputs.files copyToDeploy
mustRunAfter clean
}
task release {
group = 'Publishing'
description = 'Releases new version.'
dependsOn(wrapper, 'deploy', 'pandoc', publishToMavenLocal)
}
task pandoc(type: Exec) {
group = 'Documentation'
final def pandoc_args = ['--from', 'gfm',
'--to', 'html5',
'--metadata', "pagetitle=$mavenDescription",
'-s',
'-c', 'github-pandoc.css',
'-o', 'docs/README.html',
'README.md']
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
} else {
executable = 'pandoc'
args(pandoc_args)
}
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
}
jacoco {
toolVersion = '0.8.9-SNAPSHOT'
}
jacocoTestReport {
reports {
xml.required = true
}
}
sonarqube {
properties {
property('sonar.organization', 'ethauvin-github')
property('sonar.projectKey', 'ethauvin_HttpStatus')
property('sonar.host.url', 'https://sonarcloud.io')
property('sonar.sourceEncoding', 'UTF-8')
}
}
tasks.sonarqube {
dependsOn 'jacocoTestReport'
}

View file

@ -1,277 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Google coding conventions from Google Java Style
that can be found at https://google.github.io/styleguide/javaguide.html.
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
To completely disable a check, just comment it out or delete it from the file.
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
-->
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="SuppressWarningsFilter"/>
<module name="SuppressWithPlainTextCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_ON"/>
<property name="checkFormat"
value="^((?!(FileTabCharacterCheck)).)*$"/>
</module>
<module name="TreeWalker">
<module name="SuppressWarningsHolder"/>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE_OFF: ALMOST_ALL"/>
<property name="onCommentFormat" value="CHECKSTYLE_ON: ALMOST_ALL"/>
<property name="checkFormat" value="^((?!(EqualsHashCode)).)*$"/>
</module>
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="LeftCurly"/>
<module name="RightCurly">
<property name="id" value="RightCurlySame"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
LITERAL_DO"/>
</module>
<module name="RightCurly">
<property name="id" value="RightCurlyAlone"/>
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="MissingSwitchDefault"/>
<module name="FallThrough"/>
<module name="UpperEll"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapComma"/>
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
<property name="id" value="SeparatorWrapEllipsis"/>
<property name="tokens" value="ELLIPSIS"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
<property name="id" value="SeparatorWrapArrayDeclarator"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="option" value="EOL"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapMethodRef"/>
<property name="tokens" value="METHOD_REF"/>
<property name="option" value="nl"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LambdaParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CatchParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
<module name="CustomImportOrder">
<property name="customImportOrderRules"
value="THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE###STATIC"/>
<property name="specialImportsRegExp" value="^javax\."/>
<property name="standardPackageRegExp" value="^java\."/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="false"/>
</module>
<module name="MethodParamPad"/>
<module name="NoWhitespaceBefore">
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="ParenPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationVariables"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowedAnnotations" value="Override, Test"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>
</module>
<!-- <module name="CommentsIndentation"/> -->
</module>
</module>

View file

@ -9,6 +9,7 @@
<exclude name="AvoidPrintStackTrace"/>
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
<exclude name="JUnitTestContainsTooManyAsserts"/>
<exclude name="GuardLogStatement"/>
</rule>
<rule ref="category/java/bestpractices.xml/MissingOverride">
@ -25,9 +26,10 @@
<exclude name="ClassNamingConventions"/>
<exclude name="ConfusingTernary"/>
<exclude name="CommentDefaultAccessModifier"/>
<exclude name="DefaultPackage"/>
<exclude name="FieldNamingConventions"/>
<exclude name="LocalVariableCouldBeFinal"/>
<exclude name="LongVariable"/>
<exclude name="MethodArgumentCouldBeFinal"/>
<exclude name="OnlyOneReturn"/>
<exclude name="PackageCase"/>
<exclude name="ShortClassName"/>
@ -37,6 +39,12 @@
<exclude name="UseUnderscoresInNumericLiterals"/>
</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"/>
@ -72,8 +80,6 @@
<exclude name="AvoidFieldNameMatchingMethodName"/>
<exclude name="AvoidFieldNameMatchingTypeName"/>
<exclude name="AvoidLiteralsInIfCondition"/>
<exclude name="BeanMembersShouldSerialize"/>
<exclude name="EmptyCatchBlock"/>
<exclude name="NullAssignment"/>
</rule>
@ -89,13 +95,6 @@
<property name="skipAnnotations" value="true"/>
</properties>
</rule>
<rule ref="category/java/errorprone.xml/EmptyCatchBlock">
<properties>
<property name="allowExceptionNameRegex">
<value>^ignore$</value>
</property>
</properties>
</rule>
<!-- MULTITHREADING -->
<rule ref="category/java/multithreading.xml">

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter
xmlns="https://github.com/spotbugs/filter/3.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
<!-- <Match>
<Package name="com.foobar.*"/>
<Class name="com.foobar.MyClass"/>
<Or>
<Method name="someMethod"/>
<Method name="someOtherMethod"/>
</Or>
<Bug pattern="DLS_DEAD_LOCAL_STORE"/>
<Confidence value="2"/>
</Match>-->
</FindBugsFilter>

0
deploy.sh Normal file → Executable file
View file

View file

@ -1,716 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<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>HttpStatus JSP Tag Library</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
<link rel="stylesheet" href="github-pandoc.css" />
<!--[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 href="https://github.com/ethauvin/httpstatus/releases/latest"><img
src="https://img.shields.io/github/release/ethauvin/httpstatus.svg"
alt="Release" /></a> <a
href="https://search.maven.org/search?q=g:%22net.thauvin.erik.httpstatus%22%20AND%20a:%22httpstatus%22"><img
src="https://img.shields.io/maven-central/v/net.thauvin.erik.httpstatus/httpstatus.svg?label=maven%20central"
alt="Maven Central" /></a><br />
<a href="http://opensource.org/licenses/BSD-3-Clause"><img
src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square"
alt="License (3-Clause BSD)" /></a> <a
href="https://snyk.io/test/github/ethauvin/httpstatus?targetFile=build.gradle"><img
src="https://snyk.io/test/github/ethauvin/httpstatus/badge.svg?targetFile=build.gradle"
alt="Known Vulnerabilities" /></a> <a
href="https://sonarcloud.io/dashboard?id=ethauvin_HttpStatus"><img
src="https://sonarcloud.io/api/project_badges/measure?project=ethauvin_HttpStatus&amp;metric=alert_status"
alt="Quality Gate Status" /></a><br />
<a
href="https://github.com/ethauvin/httpstatus/actions/workflows/gradle.yml"><img
src="https://github.com/ethauvin/httpstatus/actions/workflows/gradle.yml/badge.svg"
alt="GitHub CI" /></a> <a
href="https://ci.appveyor.com/project/ethauvin/httpstatus"><img
src="https://ci.appveyor.com/api/projects/status/w5j4kul3w2rkigxb?svg=true"
alt="Build status" /></a> <a
href="https://circleci.com/gh/ethauvin/HttpStatus/tree/master"><img
src="https://circleci.com/gh/ethauvin/HttpStatus/tree/master.svg?style=shield"
alt="CircleCI" /></a></p>
<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>, <a href="#hscode">cause</a> and/or <a
href="#hsmessage">message</a> for <a
href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP
status codes</a> in JSP error pages.</p>
<p>For example:</p>
<div class="sourceCode" id="cb1"><pre
class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="bu">&lt;%@ page</span><span class="ot"> isErrorPage</span>=<span class="st">&quot;true&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="bu">&lt;%@ taglib</span><span class="ot"> prefix</span>=<span class="st">&quot;hs&quot;</span><span class="ot"> uri</span>=<span class="st">&quot;http://erik.thauvin.net/taglibs/httpstatus&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>&lt;html&gt;&lt;head&gt;</span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a>&lt;title&gt;<span class="kw">&lt;hs:code/&gt;</span> <span class="kw">&lt;hs:reason</span><span class="ot"> default</span>=<span class="dt">&quot;Server Error&quot;</span><span class="kw">/&gt;</span>&lt;/title&gt;</span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a>&lt;/head&gt;</span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a>&lt;h1&gt;<span class="kw">&lt;hs:reason</span><span class="ot"> default</span>=<span class="dt">&quot;Server Error&quot;</span><span class="kw">/&gt;</span>&lt;/h1&gt;</span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a>Cause: &lt;pre&gt;<span class="kw">&lt;hs:cause</span><span class="ot"> default</span>=<span class="dt">&quot;Unable to complete your request.&quot;</span><span class="kw">/&gt;</span>&lt;/pre&gt;</span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>Message: &lt;pre&gt;<span class="kw">&lt;hs:message</span><span class="ot"> default</span>=<span class="dt">&quot;A server error has occured.&quot;</span><span class="kw">/&gt;</span>&lt;/pre&gt;</span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a>...</span></code></pre></div>
<p>or</p>
<div class="sourceCode" id="cb2"><pre
class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="bu">&lt;%@ page</span><span class="ot"> isErrorPage</span>=<span class="st">&quot;true&quot;</span><span class="ot"> import</span>=<span class="st">&quot;net.thauvin.erik.httpstatus.Reasons&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="pp">&lt;%=</span> Reasons<span class="op">.</span><span class="fu">getReasonPhrase</span><span class="op">(</span>pageContext<span class="op">.</span><span class="fu">getErrorData</span><span class="op">().</span><span class="fu">getStatusCode</span><span class="op">())</span> <span class="pp">%&gt;</span></span></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>
<h2 id="usage-with-gradle-or-maven">Usage with <a
href="https://gradle.org/">Gradle</a> or <a
href="http://maven.apache.org/">Maven</a></h2>
<p>Include the following in your <code>build.gradle</code> file:</p>
<div class="sourceCode" id="cb4"><pre
class="sourceCode gradle"><code class="sourceCode groovy"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>dependencies <span class="op">{</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> implementation <span class="st">&#39;net.thauvin.erik.httpstatus:httpstatus:1.1.0&#39;</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>or as a Maven artifact:</p>
<div class="sourceCode" id="cb5"><pre
class="sourceCode xml"><code class="sourceCode xml"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>&lt;<span class="kw">dependency</span>&gt;</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">groupId</span>&gt;net.thauvin.erik.httpstatus&lt;/<span class="kw">groupId</span>&gt;</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">artifactId</span>&gt;httpstatus&lt;/<span class="kw">artifactId</span>&gt;</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">version</span>&gt;1.1.0&lt;/<span class="kw">version</span>&gt;</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a>&lt;/<span class="kw">dependency</span>&gt;</span></code></pre></div>
<h2 id="hscause">hs:cause</h2>
<p>The <code>&lt;hs:cause/&gt;</code> tag displays the cause of current
HTTP status code, if any. A shorthand for:</p>
<div class="sourceCode" id="cb6"><pre
class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="pp">&lt;%=</span> pageContext<span class="op">.</span><span class="fu">getErrorData</span><span class="op">().</span><span class="fu">getThrowable</span><span class="op">().</span><span class="fu">getCause</span><span class="op">().</span><span class="fu">getLocalizedMessage</span><span class="op">()</span> <span class="pp">%&gt;</span></span></code></pre></div>
<p>Optional attributes are:</p>
<table>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>default</code></td>
<td>The fallback value to output, if no cause is available.</td>
</tr>
<tr class="even">
<td><code>escapeXml</code></td>
<td>Converts &lt;, &gt;, &amp;, ', " 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>&lt;hs:code/&gt;</code> tag displays the current HTTP
status code, if any. A shorthand for:</p>
<div class="sourceCode" id="cb7"><pre
class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="pp">&lt;%=</span> pageContext<span class="op">.</span><span class="fu">getErrorData</span><span class="op">().</span><span class="fu">getStatusCode</span><span class="op">()</span> <span class="pp">%&gt;</span></span></code></pre></div>
<h2 id="hsmessage">hs:message</h2>
<p>The <code>&lt;hs:message/&gt;</code> tag displays the current error
message, if any. A shorthand for:</p>
<div class="sourceCode" id="cb8"><pre
class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="pp">&lt;%=</span> request<span class="op">.</span><span class="fu">getAttribute</span><span class="op">(</span><span class="st">&quot;javax.servlet.error.message&quot;</span><span class="op">)</span> <span class="pp">%&gt;</span></span></code></pre></div>
<p>Optional attributes are:</p>
<table>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>default</code></td>
<td>The fallback value to output, if no error message is available.</td>
</tr>
<tr class="even">
<td><code>escapeXml</code></td>
<td>Converts &lt;, &gt;, &amp;, ', " 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="hsreason">hs:reason</h2>
<p>The <code>&lt;hs:reason/&gt;</code> tag displays the reason for a
HTTP status code, if any. Optional attributes are:</p>
<table>
<thead>
<tr class="header">
<th>Attribute</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>code</code></td>
<td>The HTTP status error code. If not specified the current status code
is used.</td>
</tr>
<tr class="even">
<td><code>default</code></td>
<td>The fallback value to output, if no reason is available.</td>
</tr>
<tr class="odd">
<td><code>escapeXml</code></td>
<td>Converts &lt;, &gt;, &amp;, ', " 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="statuscode-bean">StatusCode Bean</h2>
<p>The <code>StatusCode</code> bean can be used to check the class of
the status code error. For example, using the JSTL:</p>
<div class="sourceCode" id="cb9"><pre
class="sourceCode jsp"><code class="sourceCode jsp"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="bu">&lt;%@ taglib</span><span class="ot"> prefix</span>=<span class="st">&quot;hs&quot;</span><span class="ot"> uri</span>=<span class="st">&quot;http://erik.thauvin.net/taglibs/httpstatus&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="bu">&lt;%@ taglib</span><span class="ot"> prefix</span>=<span class="st">&quot;c&quot;</span><span class="ot"> uri</span>=<span class="st">&quot;http://java.sun.com/jsp/jstl/core&quot;</span><span class="ot"> </span><span class="bu">%&gt;</span></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a><span class="bu">&lt;jsp:useBean</span><span class="ot"> id</span>=<span class="st">&quot;statusCode&quot;</span><span class="ot"> class</span>=<span class="st">&quot;net.thauvin.erik.httpstatus.StatusCode&quot;</span><span class="bu">/&gt;</span></span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true" tabindex="-1"></a><span class="kw">&lt;c:set</span><span class="ot"> target</span>=<span class="dt">&quot;</span><span class="pp">${</span>statusCode<span class="pp">}</span><span class="dt">&quot;</span><span class="ot"> property</span>=<span class="dt">&quot;code&quot;</span><span class="kw">&gt;&lt;hs:code/&gt;&lt;/c:set&gt;</span></span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true" tabindex="-1"></a><span class="kw">&lt;c:choose&gt;</span></span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true" tabindex="-1"></a> <span class="kw">&lt;c:when</span><span class="ot"> test</span>=<span class="dt">&quot;</span><span class="pp">${</span>statusCode<span class="op">.</span><span class="fu">isClientError</span><span class="op">()</span><span class="pp">}</span><span class="dt">&quot;</span><span class="kw">&gt;</span></span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true" tabindex="-1"></a> An error occurred on your side. (<span class="kw">&lt;hs:reason/&gt;</span>)</span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true" tabindex="-1"></a> <span class="kw">&lt;/c:when&gt;</span></span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true" tabindex="-1"></a> <span class="kw">&lt;c:otherwise&gt;</span></span>
<span id="cb9-11"><a href="#cb9-11" aria-hidden="true" tabindex="-1"></a> An error occurred on our side. (<span class="kw">&lt;hs:message/&gt;</span>)</span>
<span id="cb9-12"><a href="#cb9-12" aria-hidden="true" tabindex="-1"></a> <span class="kw">&lt;/c:otherwise&gt;</span></span>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true" tabindex="-1"></a><span class="kw">&lt;/c:choose&gt;</span></span></code></pre></div>
<p>or in a Servlet:</p>
<div class="sourceCode" id="cb10"><pre
class="sourceCode java"><code class="sourceCode java"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> <span class="im">net</span><span class="op">.</span><span class="im">thauvin</span><span class="op">.</span><span class="im">erik</span><span class="op">.</span><span class="im">httpstatus</span><span class="op">.</span><span class="im">StatusCode</span><span class="op">;</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="co">// ---</span></span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a>StatusCode statusCode <span class="op">=</span> <span class="kw">new</span> <span class="fu">StatusCode</span><span class="op">((</span><span class="bu">Integer</span><span class="op">)</span> request<span class="op">.</span><span class="fu">getAttribute</span><span class="op">(</span><span class="st">&quot;javax.servlet.error.status_code&quot;</span><span class="op">));</span></span>
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="op">(</span>statusCode<span class="op">.</span><span class="fu">isError</span><span class="op">())</span> <span class="op">{</span></span>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> <span class="op">(</span>statusCode<span class="op">.</span><span class="fu">isServerError</span><span class="op">())</span> <span class="op">{</span></span>
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a> <span class="bu">String</span> reason <span class="op">=</span> statusCode<span class="op">.</span><span class="fu">getReason</span><span class="op">();</span></span>
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span> <span class="cf">else</span> <span class="op">{</span></span>
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb10-12"><a href="#cb10-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>The <code>StatusCode</code> bean methods are:</p>
<table>
<thead>
<tr class="header">
<th>Method</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>getReason</code></td>
<td>Returns the reason for the status code (eg:
<code>Internal Server Error</code>)</td>
</tr>
<tr class="even">
<td><code>isClientError</code></td>
<td>Checks if the status code is a client error.</td>
</tr>
<tr class="odd">
<td><code>isError</code></td>
<td>Checks if the status code is a server or client error.</td>
</tr>
<tr class="even">
<td><code>isInfo</code></td>
<td>Checks if the status code is informational.</td>
</tr>
<tr class="odd">
<td><code>isRedirect</code></td>
<td>Checks if the status code is a redirect.</td>
</tr>
<tr class="even">
<td><code>isServerError</code></td>
<td>Checks if the status code is a server error.</td>
</tr>
<tr class="odd">
<td><code>isSuccess</code></td>
<td>Checks if the status code is a success. (<code>OK</code>)</td>
</tr>
<tr class="even">
<td><code>isValid</code></td>
<td>Checks if the status code is valid.</td>
</tr>
</tbody>
</table>
<h2 id="reasons">Reasons</h2>
<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>Status Code</th>
<th>Reason</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>100</code></td>
<td>Continue</td>
</tr>
<tr class="even">
<td><code>101</code></td>
<td>Switching Protocols</td>
</tr>
<tr class="odd">
<td><code>102</code></td>
<td>Processing</td>
</tr>
<tr class="even">
<td><code>103</code></td>
<td>Early Hints</td>
</tr>
<tr class="odd">
<td><code>200</code></td>
<td>OK</td>
</tr>
<tr class="even">
<td><code>201</code></td>
<td>Created</td>
</tr>
<tr class="odd">
<td><code>202</code></td>
<td>Accepted</td>
</tr>
<tr class="even">
<td><code>203</code></td>
<td>Non-Authoritative Information</td>
</tr>
<tr class="odd">
<td><code>204</code></td>
<td>No Content</td>
</tr>
<tr class="even">
<td><code>205</code></td>
<td>Reset Content</td>
</tr>
<tr class="odd">
<td><code>206</code></td>
<td>Partial Content</td>
</tr>
<tr class="even">
<td><code>207</code></td>
<td>Multi-Status</td>
</tr>
<tr class="odd">
<td><code>208</code></td>
<td>Already Reported</td>
</tr>
<tr class="even">
<td><code>218</code></td>
<td>This is fine</td>
</tr>
<tr class="odd">
<td><code>226</code></td>
<td>IM Used</td>
</tr>
<tr class="even">
<td><code>300</code></td>
<td>Multiple Choices</td>
</tr>
<tr class="odd">
<td><code>301</code></td>
<td>Moved Permanently</td>
</tr>
<tr class="even">
<td><code>302</code></td>
<td>Found/Moved Temporarily</td>
</tr>
<tr class="odd">
<td><code>303</code></td>
<td>See Other</td>
</tr>
<tr class="even">
<td><code>304</code></td>
<td>Not Modified</td>
</tr>
<tr class="odd">
<td><code>305</code></td>
<td>Use Proxy</td>
</tr>
<tr class="even">
<td><code>306</code></td>
<td>Switch Proxy</td>
</tr>
<tr class="odd">
<td><code>307</code></td>
<td>Temporary Redirect</td>
</tr>
<tr class="even">
<td><code>308</code></td>
<td>Permanent Redirect</td>
</tr>
<tr class="odd">
<td><code>400</code></td>
<td>Bad Request</td>
</tr>
<tr class="even">
<td><code>401</code></td>
<td>Unauthorized</td>
</tr>
<tr class="odd">
<td><code>402</code></td>
<td>Payment Required</td>
</tr>
<tr class="even">
<td><code>403</code></td>
<td>Forbidden</td>
</tr>
<tr class="odd">
<td><code>404</code></td>
<td>Not Found</td>
</tr>
<tr class="even">
<td><code>405</code></td>
<td>Method Not Allowed</td>
</tr>
<tr class="odd">
<td><code>406</code></td>
<td>Not Acceptable</td>
</tr>
<tr class="even">
<td><code>407</code></td>
<td>Proxy Authentication Required</td>
</tr>
<tr class="odd">
<td><code>408</code></td>
<td>Request Timeout</td>
</tr>
<tr class="even">
<td><code>409</code></td>
<td>Conflict</td>
</tr>
<tr class="odd">
<td><code>410</code></td>
<td>Gone</td>
</tr>
<tr class="even">
<td><code>411</code></td>
<td>Length Required</td>
</tr>
<tr class="odd">
<td><code>412</code></td>
<td>Precondition Failed</td>
</tr>
<tr class="even">
<td><code>413</code></td>
<td>Request Entity/Payload Too Large</td>
</tr>
<tr class="odd">
<td><code>414</code></td>
<td>Request-URI Too Long</td>
</tr>
<tr class="even">
<td><code>415</code></td>
<td>Unsupported Media Type</td>
</tr>
<tr class="odd">
<td><code>416</code></td>
<td>Requested Range Not Satisfiable</td>
</tr>
<tr class="even">
<td><code>417</code></td>
<td>Expectation Failed</td>
</tr>
<tr class="odd">
<td><code>418</code></td>
<td>I'm A Teapot</td>
</tr>
<tr class="even">
<td><code>419</code></td>
<td>Insufficient Space on Resource</td>
</tr>
<tr class="odd">
<td><code>420</code></td>
<td>Method Failure</td>
</tr>
<tr class="even">
<td><code>421</code></td>
<td>Misdirected Request</td>
</tr>
<tr class="odd">
<td><code>422</code></td>
<td>Unprocessable Entity</td>
</tr>
<tr class="even">
<td><code>423</code></td>
<td>Locked</td>
</tr>
<tr class="odd">
<td><code>424</code></td>
<td>Failed Dependency</td>
</tr>
<tr class="even">
<td><code>426</code></td>
<td>Upgrade Required</td>
</tr>
<tr class="odd">
<td><code>428</code></td>
<td>Precondition Required</td>
</tr>
<tr class="even">
<td><code>429</code></td>
<td>Too Many Requests</td>
</tr>
<tr class="odd">
<td><code>430</code></td>
<td>Request Header Fields Too Large</td>
</tr>
<tr class="even">
<td><code>431</code></td>
<td>Request Header Fields Too Large</td>
</tr>
<tr class="odd">
<td><code>440</code></td>
<td>Login Timeout</td>
</tr>
<tr class="even">
<td><code>444</code></td>
<td>No Response</td>
</tr>
<tr class="odd">
<td><code>449</code></td>
<td>Retry With</td>
</tr>
<tr class="even">
<td><code>450</code></td>
<td>Blocked by Windows Parental Controls</td>
</tr>
<tr class="odd">
<td><code>451</code></td>
<td>Unavailable For Legal Reasons</td>
</tr>
<tr class="even">
<td><code>460</code></td>
<td>Client Closed Connection Before Load Balancer Idle Timeout</td>
</tr>
<tr class="odd">
<td><code>463</code></td>
<td>X-Forwarded-For Header with More than 30 IP Addresses</td>
</tr>
<tr class="even">
<td><code>494</code></td>
<td>Request Header Too Large</td>
</tr>
<tr class="odd">
<td><code>495</code></td>
<td>SSL Certificate Error</td>
</tr>
<tr class="even">
<td><code>496</code></td>
<td>No SSL Certificate</td>
</tr>
<tr class="odd">
<td><code>497</code></td>
<td>HTTP Request Sent to HTTPS Port</td>
</tr>
<tr class="even">
<td><code>498</code></td>
<td>Token Expired/Invalid</td>
</tr>
<tr class="odd">
<td><code>499</code></td>
<td>Client Closed Request</td>
</tr>
<tr class="even">
<td><code>500</code></td>
<td>Internal Server Error</td>
</tr>
<tr class="odd">
<td><code>501</code></td>
<td>Not Implemented</td>
</tr>
<tr class="even">
<td><code>502</code></td>
<td>Bad Gateway</td>
</tr>
<tr class="odd">
<td><code>503</code></td>
<td>Service Unavailable</td>
</tr>
<tr class="even">
<td><code>504</code></td>
<td>Gateway Timeout</td>
</tr>
<tr class="odd">
<td><code>505</code></td>
<td>HTTP Version Not Supported</td>
</tr>
<tr class="even">
<td><code>506</code></td>
<td>Variant Also Negotiates</td>
</tr>
<tr class="odd">
<td><code>507</code></td>
<td>Insufficient Storage</td>
</tr>
<tr class="even">
<td><code>508</code></td>
<td>Loop Detected</td>
</tr>
<tr class="odd">
<td><code>509</code></td>
<td>Bandwidth Limit Exceeded</td>
</tr>
<tr class="even">
<td><code>510</code></td>
<td>Not Extended</td>
</tr>
<tr class="odd">
<td><code>511</code></td>
<td>Network Authentication Required</td>
</tr>
<tr class="even">
<td><code>520</code></td>
<td>Unknown Error</td>
</tr>
<tr class="odd">
<td><code>521</code></td>
<td>Web Server Is Down</td>
</tr>
<tr class="even">
<td><code>522</code></td>
<td>Origin Connection Time-out</td>
</tr>
<tr class="odd">
<td><code>523</code></td>
<td>Origin Is Unreachable</td>
</tr>
<tr class="even">
<td><code>524</code></td>
<td>A Timeout Occurred</td>
</tr>
<tr class="odd">
<td><code>525</code></td>
<td>SSL Handshake Failed</td>
</tr>
<tr class="even">
<td><code>526</code></td>
<td>Invalid SSL Certificate</td>
</tr>
<tr class="odd">
<td><code>527</code></td>
<td>Railgun Error</td>
</tr>
<tr class="even">
<td><code>529</code></td>
<td>Site is overloaded</td>
</tr>
<tr class="odd">
<td><code>530</code></td>
<td>Site is frozen</td>
</tr>
<tr class="even">
<td><code>598</code></td>
<td>Network Read Timeout Error</td>
</tr>
<tr class="odd">
<td><code>599</code></td>
<td>Network Connect Timeout Error</td>
</tr>
</tbody>
</table>
<h2 id="command-line-usage">Command Line Usage</h2>
<p>You can query the reason phrase for status codes as follows:</p>
<div class="sourceCode" id="cb11"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> java <span class="at">-jar</span> httpstatus-1.1.0.jar 404 500</span>
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="ex">404:</span> Not Found</span>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="ex">500:</span> Internal Server Error</span></code></pre></div>
<p>If no status code is specified, all will be printed:</p>
<div class="sourceCode" id="cb12"><pre
class="sourceCode sh"><code class="sourceCode bash"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> java <span class="at">-jar</span> httpstatus-1.1.0.jar</span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="ex">100:</span> Continue</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a><span class="ex">101:</span> Switching Protocols</span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a><span class="ex">102:</span> Processing</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true" tabindex="-1"></a><span class="ex">103:</span> Early Hints</span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true" tabindex="-1"></a><span class="ex">200:</span> OK</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true" tabindex="-1"></a><span class="ex">201:</span> Created</span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true" tabindex="-1"></a><span class="ex">202:</span> Accepted</span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true" tabindex="-1"></a><span class="ex">203:</span> Non-Authoritative Information</span>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true" tabindex="-1"></a><span class="ex">204:</span> No Content</span>
<span id="cb12-11"><a href="#cb12-11" aria-hidden="true" tabindex="-1"></a><span class="ex">205:</span> Reset Content</span>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true" tabindex="-1"></a><span class="ex">206:</span> Partial Content</span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true" tabindex="-1"></a><span class="ex">207:</span> Multi-Status</span>
<span id="cb12-14"><a href="#cb12-14" aria-hidden="true" tabindex="-1"></a><span class="ex">208:</span> Already Reported</span>
<span id="cb12-15"><a href="#cb12-15" aria-hidden="true" tabindex="-1"></a><span class="ex">226:</span> IM Used</span>
<span id="cb12-16"><a href="#cb12-16" aria-hidden="true" tabindex="-1"></a><span class="ex">...</span></span></code></pre></div>
</body>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

240
gradlew vendored
View file

@ -1,240 +0,0 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

91
gradlew.bat vendored
View file

@ -1,91 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
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 execute
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
: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 %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 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!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

BIN
lib/bld/bld-wrapper.jar Normal file

Binary file not shown.

View file

@ -0,0 +1,6 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.1
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
rife2.downloadLocation=
rife2.version=1.6.3

50
pom.xml Normal file
View 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.0-SNAPSHOT</version>
<name>HttpStatus</name>
<description>HttpStatus JSP Tag Library</description>
<url>https://github.com/ethauvin/HttpStatus</url>
<licenses>
<license>
<name>The BSD 3-Clause License</name>
<url>http://opensource.org/licenses/BSD-3-Clause</url>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<version>3.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
<version>5.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>

View file

@ -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'

View file

@ -0,0 +1,128 @@
/*
* HttpStatusBuild.java
*
* Copyright 2023 sErik 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.dependencies.Dependency;
import rife.bld.extension.PmdOperation;
import rife.bld.publish.PublishDeveloper;
import rife.bld.publish.PublishInfo;
import rife.bld.publish.PublishLicense;
import rife.bld.publish.PublishScm;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.List;
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 {
public HttpStatusBuild() {
pkg = "net.thauvin.erik.httpstatus";
name = "HttpStatus";
version = version(1, 1, 0, "SNAPSHOT");
var description = "HttpStatus JSP Tag Library";
var url = "https://github.com/ethauvin/HttpStatus";
mainClass = "net.thauvin.erik.httpstatus.Reasons";
javaRelease = 17;
downloadSources = true;
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
scope(compile)
.include(dependency("jakarta.servlet", "jakarta.servlet-api", version(6, 0, 0)))
.include(dependency("jakarta.servlet.jsp", "jakarta.servlet.jsp-api", version(3, 1, 1)))
.include(dependency("jakarta.el", "jakarta.el-api", version(5, 0, 1)));
scope(test)
.include(dependency("org.assertj", "assertj-joda-time", version(2, 2, 0)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 3)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 3)));
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.location())
.withCredentials(property("sonatype.user"), property("sonatype.password")))
.repository(MAVEN_LOCAL)
.info(new PublishInfo()
.groupId(pkg)
.artifactId(name.toLowerCase())
.name(name)
.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("http://opensource.org/licenses/BSD-3-Clause"))
.scm(new PublishScm().connection("scm:git:" + url + ".git")
.developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git")
.url(url))
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase")));
}
public static void main(String[] args) {
new HttpStatusBuild().start(args);
}
@Override
public void publish() throws Exception {
super.publish();
var pomPath = Path.of(MAVEN_LOCAL.getArtifactLocation(new Dependency(pkg, name.toLowerCase(), version)),
version.toString(),
name.toLowerCase() + '-' + version + ".pom");
Files.copy(pomPath, Path.of(workDirectory.getAbsolutePath(), "pom.xml"), StandardCopyOption.REPLACE_EXISTING);
}
@BuildCommand(summary = "Runs PMD analysis")
public void pmd() throws Exception {
new PmdOperation()
.fromProject(this)
.failOnViolation(true)
.ruleSets("config/pmd.xml")
.execute();
}
}

View file

@ -1,7 +1,7 @@
/*
* Reasons.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* StatusCode.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,6 +32,7 @@
package net.thauvin.erik.httpstatus;
import java.io.Serial;
import java.io.Serializable;
/**
@ -40,6 +41,7 @@ import java.io.Serializable;
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
*/
public class StatusCode implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private int code;

View file

@ -1,7 +1,7 @@
/*
* Utils.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -66,24 +66,12 @@ public final class Utils {
for (int i = 0; i < value.length(); i++) {
final char c = value.charAt(i);
switch (c) {
case '<':
escaped.append("&lt;");
break;
case '>':
escaped.append("&gt;");
break;
case '&':
escaped.append("&amp;");
break;
case '\'':
escaped.append("&apos;");
break;
case '"':
escaped.append("&quot;");
break;
default:
escaped.append(c);
break;
case '<' -> escaped.append("&lt;");
case '>' -> escaped.append("&gt;");
case '&' -> escaped.append("&amp;");
case '\'' -> escaped.append("&apos;");
case '"' -> escaped.append("&quot;");
default -> escaped.append(c);
}
}

View file

@ -1,7 +1,7 @@
/*
* CauseTag.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* CodeTag.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* CauseTag.java
* MessageTag.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/*
* ReasonTag.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -65,7 +65,7 @@ public class ReasonTag extends XmlSupport {
Utils.outWrite(out, Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()), defaultValue,
escapeXml);
}
} catch (IOException ignore) {
} catch (IOException ignored) {
// Ignore.
}
}

View file

@ -1,7 +1,7 @@
/*
* XmlSupport.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View file

@ -2,7 +2,7 @@
<!--
~ httpstatus.tld
~
~ Copyright (c) 2015-2020, Erik C. Thauvin (erik@thauvin.net)
~ Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
~ All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without

View file

@ -1,3 +1,35 @@
#
# reasons.properties
#
# Copyright 2023 sErik 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
101=Switching Protocols
102=Processing

View file

@ -1,7 +1,7 @@
/*
* ReasonsMainTest.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,17 +32,15 @@
package net.thauvin.erik.httpstatus;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
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.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Main Class Tests.
@ -51,51 +49,50 @@ import static org.testng.Assert.assertTrue;
* @created 2019-05-06
* @since 1.0
*/
@SuppressFBWarnings({"DM_DEFAULT_ENCODING", "ITU_INAPPROPRIATE_TOSTRING_USE"})
public class ReasonsMainTest {
private final PrintStream originalOut = System.out;
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
class ReasonsMainTest {
private final static PrintStream originalOut = System.out;
private final static ByteArrayOutputStream outContent = new ByteArrayOutputStream();
@AfterTest
public void restoreStreams() {
@AfterAll
public static void restoreStreams() {
System.setOut(originalOut);
}
@BeforeTest
public void setUpStreams() {
@BeforeAll
public static void setUpStreams() {
System.setOut(new PrintStream(outContent));
}
@BeforeMethod
@BeforeEach
public void resetStreams() {
outContent.reset();
}
@Test
public void testMain() {
void testMain() {
Reasons.main("401");
assertTrue(outContent.toString().contains(Reasons.getReasonPhrase("401")), "401");
assertFalse(outContent.toString().contains("500"), "401 no 500");
assertThat(outContent.toString().contains(Reasons.getReasonPhrase("401"))).as("401").isTrue();
assertThat(outContent.toString().contains("500")).as("401 no 500").isFalse();
}
@Test
public void testMainAll() {
void testMainAll() {
Reasons.main();
assertTrue(outContent.toString().contains(Reasons.getReasonPhrase(301)), "301");
assertTrue(outContent.toString().contains(Reasons.getReasonPhrase(404)), "404");
assertThat(outContent.toString().contains(Reasons.getReasonPhrase(301))).as("301").isTrue();
assertThat(outContent.toString().contains(Reasons.getReasonPhrase(404))).as("404").isTrue();
}
@Test
public void testMainArgs() {
void testMainArgs() {
Reasons.main("500", "302");
assertTrue(outContent.toString().contains(Reasons.getReasonPhrase("500")), "500 (302)");
assertTrue(outContent.toString().contains(Reasons.getReasonPhrase("302")), "(500) 302");
assertFalse(outContent.toString().contains("404"), "500/302 not 404");
assertThat(outContent.toString().contains(Reasons.getReasonPhrase("500"))).as("500 (302)").isTrue();
assertThat(outContent.toString().contains(Reasons.getReasonPhrase("302"))).as("(500) 302").isTrue();
assertThat(outContent.toString().contains("404")).as("500/302 not 404").isFalse();
}
@Test
public void testMainInvalid() {
void testMainInvalid() {
Reasons.main("aaa");
assertTrue(outContent.toString().isEmpty(), "invalid argument: aaa");
assertThat(outContent.toString().isEmpty()).as("invalid argument: aaa").isTrue();
}
}

View file

@ -1,7 +1,7 @@
/*
* ReasonsTest.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,11 +32,12 @@
package net.thauvin.erik.httpstatus;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;
import java.util.ResourceBundle;
import static org.testng.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Reasons Tests.
@ -45,14 +46,14 @@ import static org.testng.Assert.assertEquals;
* @created 2015-12-03
* @since 1.0
*/
public class ReasonsTest {
class ReasonsTest {
@Test
public void testGetReasonPhrase() {
void testGetReasonPhrase() {
final ResourceBundle bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
for (final String key : bundle.keySet()) {
assertEquals(bundle.getString(key), Reasons.getReasonPhrase(key), "getReasonPhrase(" + key + ')');
assertEquals(bundle.getString(key), Reasons.getReasonPhrase(Integer.parseInt(key)),
"getReasonPhrase(int: " + key + ')');
assertThat(Reasons.getReasonPhrase(key)).as("getReasonPhrase(" + key + ')').isEqualTo(bundle.getString(key));
assertThat(Reasons.getReasonPhrase(Integer.parseInt(key)))
.as("getReasonPhrase(int: " + key + ')').isEqualTo(bundle.getString(key));
}
}

View file

@ -1,7 +1,7 @@
/*
* StatusCodeTest.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,20 +32,18 @@
package net.thauvin.erik.httpstatus;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;
import java.util.ResourceBundle;
import static org.testng.Assert.*;
import static org.assertj.core.api.Assertions.assertThat;
/**
* StatusCode Tests.
*
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
*/
@SuppressFBWarnings("CE_CLASS_ENVY")
public class StatusCodeTest {
class StatusCodeTest {
@Test
void testStatusCode() {
final ResourceBundle bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
@ -53,33 +51,34 @@ public class StatusCodeTest {
for (final String key : bundle.keySet()) {
final int code = Integer.parseInt(key);
statusCode.setCode(code);
assertEquals(statusCode.getCode(), code, "is not " + code);
assertEquals(statusCode.isInfo(), code >= 100 && code < 200, code + " is info");
assertEquals(statusCode.isSuccess(), code >= 200 && code < 300, code + " is ok");
assertEquals(statusCode.isRedirect(), code >= 300 && code < 400, code + " is redirect");
assertEquals(statusCode.isClientError(), code >= 400 && code < 500, code + " is client error");
assertEquals(statusCode.isServerError(), code >= 500 && code < 600, code + " is server error");
assertEquals(statusCode.isError(), code >= 400 && code < 600, code + " is error");
assertTrue(statusCode.isValid(), code + "is valid");
assertThat(statusCode.getCode()).as("is not " + code).isEqualTo(code);
assertThat(statusCode.isInfo()).as(code + " is info").isEqualTo(code >= 100 && code < 200);
assertThat(statusCode.isSuccess()).as(code + " is ok").isEqualTo(code >= 200 && code < 300);
assertThat(statusCode.isRedirect()).as(code + " is redirect").isEqualTo(code >= 300 && code < 400);
assertThat(statusCode.isClientError()).as(code + " is client error").isEqualTo(code >= 400 && code < 500);
assertThat(statusCode.isServerError()).as(code + " is server error").isEqualTo(code >= 500 && code < 600);
assertThat(statusCode.isError()).as(code + " is error").isEqualTo(code >= 400 && code < 600);
assertThat(statusCode.isValid()).as(code + "is valid").isTrue();
assertEquals(statusCode.getReason(), Reasons.getReasonPhrase(code), code + "reason phrase is not valid");
assertThat(statusCode.getReason()).as(code + "reason phrase is not valid")
.isEqualTo(Reasons.getReasonPhrase(code));
}
final int[] unknowns = {0, 99, 600};
for (final int code : unknowns) {
statusCode.setCode(code);
assertEquals(statusCode.getCode(), code, "is not " + code);
assertFalse(statusCode.isInfo(), code + " is info");
assertFalse(statusCode.isSuccess(), code + " is ok");
assertFalse(statusCode.isRedirect(), code + " is redirect");
assertFalse(statusCode.isClientError(), code + " is client error");
assertFalse(statusCode.isServerError(), code + " is server error");
assertFalse(statusCode.isError(), code + " is error");
assertFalse(statusCode.isValid(), "600 is invalid");
assertNull(statusCode.getReason(), code + "reason phrase is not null.");
assertThat(statusCode.getCode()).as("is not " + code).isEqualTo(code);
assertThat(statusCode.isInfo()).as(code + " is info").isFalse();
assertThat(statusCode.isSuccess()).as(code + " is ok").isFalse();
assertThat(statusCode.isRedirect()).as(code + " is redirect").isFalse();
assertThat(statusCode.isClientError()).as(code + " is client error").isFalse();
assertThat(statusCode.isServerError()).as(code + " is server error").isFalse();
assertThat(statusCode.isError()).as(code + " is error").isFalse();
assertThat(statusCode.isValid()).as("600 is invalid").isFalse();
assertThat(statusCode.getReason()).as(code + "reason phrase is not null.").isNull();
}
statusCode = new StatusCode(900);
assertEquals(statusCode.getCode(), 900, "is not 900");
assertThat(statusCode.getCode()).as("is not 900").isEqualTo(900);
}
}

View file

@ -1,7 +1,7 @@
/*
* UtilsTest.java
*
* Copyright (c) 2015-2022, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2023 sErik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -32,13 +32,13 @@
package net.thauvin.erik.httpstatus;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.StringWriter;
import static org.testng.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Utils Tests.
@ -47,55 +47,54 @@ import static org.testng.Assert.assertEquals;
* @created 2015-12-03
* @since 1.0
*/
public class UtilsTest {
class UtilsTest {
@Test
public void testEscapeXml() {
assertEquals(Utils.escapeXml(
void testEscapeXml() {
assertThat(Utils.escapeXml(
"This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" "
+ "parameter & value."),
"This is a test. We wan&apos;t to make sure that everything is &lt;encoded&gt; according the "
+ "&quot;encoding&quot; parameter &amp; value.");
+ "parameter & value."))
.isEqualTo("This is a test. We wan&apos;t to make sure that everything is &lt;encoded&gt; " +
"according the &quot;encoding&quot; parameter &amp; value.");
}
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
@SuppressFBWarnings("CE_CLASS_ENVY")
@Test
public void testOutWrite() throws IOException {
void testOutWrite() throws IOException {
try (StringWriter sw = new StringWriter()) {
Utils.outWrite(sw, null, "default", false);
assertEquals(sw.toString(), "default", "outWrite(default)");
assertThat(sw.toString()).isEqualTo("default").as("outWrite(default)");
sw.getBuffer().setLength(0);
Utils.outWrite(sw, "", "default", false);
assertEquals(sw.toString(), "", "outWrite(value empty)");
assertThat(sw.toString()).isEqualTo("").as("outWrite(value empty)");
sw.getBuffer().setLength(0);
Utils.outWrite(sw, null, null, true);
assertEquals(sw.toString(), "", "outWrite(null)");
assertThat(sw.toString()).isEqualTo("").as("outWrite(null)");
sw.getBuffer().setLength(0);
Utils.outWrite(sw, "value", "default", false);
assertEquals(sw.toString(), "value", "outWrite(value)");
assertThat(sw.toString()).isEqualTo("value").as("outWrite(value)");
sw.getBuffer().setLength(0);
Utils.outWrite(sw, "wan't", "default", true);
assertEquals(sw.toString(), "wan&apos;t", "outWrite(wan't)");
assertThat(sw.toString()).isEqualTo("wan&apos;t").as("outWrite(wan't)");
sw.getBuffer().setLength(0);
Utils.outWrite(sw, null, "1 & 1", true);
assertEquals(sw.toString(), "1 &amp; 1", "outWrite(1 & 1)");
assertThat(sw.toString()).isEqualTo("1 &amp; 1").as("outWrite(1 & 1)");
sw.getBuffer().setLength(0);
Utils.outWrite(sw, "", "default", true);
assertEquals(sw.toString(), "", "outWrite(value empty, xml)");
assertThat(sw.toString()).isEqualTo("").as("outWrite(value empty).as(xml)");
sw.getBuffer().setLength(0);
Utils.outWrite(sw, null, "", true);
assertEquals(sw.toString(), "", "outWrite(default empty)");
assertThat(sw.toString()).isEqualTo("").as("outWrite(default empty)");
sw.getBuffer().setLength(0);
Utils.outWrite(sw, null, null, true);
assertEquals(sw.toString(), "", "outWrite(null, xml)");
assertThat(sw.toString()).isEqualTo("").as("outWrite(null).as(xml)");
}
}
}

View file

@ -1,8 +0,0 @@
#Generated by the Semver Plugin for Gradle
#Sun May 02 22:01:06 PDT 2021
version.buildmeta=
version.major=1
version.minor=1
version.patch=0
version.prerelease=SNAPSHOT
version.semver=1.1.0-SNAPSHOT