{"id":27876894,"url":"https://github.com/ethauvin/httpstatus","last_synced_at":"2025-05-05T02:53:36.231Z","repository":{"id":57737833,"uuid":"47380792","full_name":"ethauvin/HttpStatus","owner":"ethauvin","description":"Tag library to display the code, reason, cause and/or message for HTTP status codes in JSP error pages","archived":false,"fork":false,"pushed_at":"2025-04-26T02:38:24.000Z","size":701,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-26T03:39:31.122Z","etag":null,"topics":["301","404","bean","code","codes","http","jsp","library","rfc2616","rfc7231","status","tag"],"latest_commit_sha":null,"homepage":"https://erik.thauvin.net/blog/posts/5728/httpstatus-jsp-tag-library","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethauvin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-12-04T04:20:49.000Z","updated_at":"2025-04-26T02:38:27.000Z","dependencies_parsed_at":"2023-09-29T08:21:42.880Z","dependency_job_id":"0ae7295c-c560-4777-890c-6145f1ad01a4","html_url":"https://github.com/ethauvin/HttpStatus","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2FHttpStatus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2FHttpStatus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2FHttpStatus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethauvin%2FHttpStatus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethauvin","download_url":"https://codeload.github.com/ethauvin/HttpStatus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252429954,"owners_count":21746571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["301","404","bean","code","codes","http","jsp","library","rfc2616","rfc7231","status","tag"],"created_at":"2025-05-05T02:53:35.475Z","updated_at":"2025-05-05T02:53:36.216Z","avatar_url":"https://github.com/ethauvin.png","language":"Java","readme":"# HttpStatus JSP Tag Library\n\n[![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)\n[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)\n[![bld](https://img.shields.io/badge/2.2.1-FA9052?label=bld\u0026labelColor=2392FF)](https://rife2.com/bld)\n[![Release](https://img.shields.io/github/release/ethauvin/httpstatus.svg)](https://github.com/ethauvin/httpstatus/releases/latest)\n[![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/net.thauvin.erik.httpstatus/httpstatus.svg?label=sanpshot\u0026server=https%3A%2F%2Foss.sonatype.org)](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/httpstatus/httpstatus/)\n[![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik.httpstatus/httpstatus.svg?color=blue)](https://central.sonatype.com/artifact/net.thauvin.erik.httpstatus/httpstatus)\n\n[![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/httpstatus/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/ethauvin/httpstatus?targetFile=pom.xml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_HttpStatus\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ethauvin_HttpStatus)\n[![GitHub CI](https://github.com/ethauvin/httpstatus/actions/workflows/bld.yml/badge.svg)](https://github.com/ethauvin/httpstatus/actions/workflows/bld.yml)\n[![CircleCI](https://circleci.com/gh/ethauvin/HttpStatus/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/HttpStatus/tree/master)\n\nA 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.\n\n## Table of Contents\n\n- [Examples](#examples)\n- [Usage](#usage)\n  - [Gradle](#gradle)\n  - [bld](#bld)\n  - [Maven](#maven)\n- [JSP Tags](#jsp-tags)\n  - [hs:cause](#hscause)\n  - [hs:code](#hscode)\n  - [hs:message](#hsmessage)\n  - [hs:reason](#hsreason)\n- [StatusCode Bean](#statuscode-bean)\n- [Reasons](#reasons)\n- [Command Line Usage](#command-line-usage)\n- [Contributing](#contributing)\n\n## Examples\n\nFor example:\n\n```jsp\n\u003c%@ page isErrorPage=\"true\" %\u003e\n\u003c%@ taglib prefix=\"hs\" uri=\"http://erik.thauvin.net/taglibs/httpstatus\" %\u003e\n\u003chtml\u003e\u003chead\u003e\n\u003ctitle\u003e\u003chs:code/\u003e \u003chs:reason default=\"Server Error\"/\u003e\u003c/title\u003e\n\u003c/head\u003e\n\u003ch1\u003e\u003chs:reason default=\"Server Error\"/\u003e\u003c/h1\u003e\nCause: \u003cpre\u003e\u003chs:cause default=\"Unable to complete your request.\"/\u003e\u003c/pre\u003e\nMessage: \u003cpre\u003e\u003chs:message default=\"A server error has occured.\"/\u003e\u003c/pre\u003e\n...\n```\n\nor\n\n```jsp\n\u003c%@ page isErrorPage=\"true\" import=\"net.thauvin.erik.httpstatus.Reasons\" %\u003e\n\u003c%= Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()) %\u003e\n```\n\nwould display on a [501 status code](https://www.rfc-editor.org/rfc/rfc9110.html#name-501-not-implemented):\n\n```console\nNot Implemented\n```\n\n## Usage\n\n### [Gradle](https://gradle.org/)\n\nInclude the following in your `build.gradle` file:\n\n```gradle\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation 'net.thauvin.erik.httpstatus:httpstatus:1.1.1'\n}\n```\n\n### [bld](https://rife2.com/bld)\n\nInclude the following in your `bld` build file:\n\n```java\nscope(compile).include(\n        dependency(\"net.thauvin.erik.httpstatus\",\"httpstatus\", version(1, 1, 0))\n);\n```\n\n### [Maven](http://maven.apache.org/)\n\nAs a `Maven` artifact:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003enet.thauvin.erik.httpstatus\u003c/groupId\u003e\n    \u003cartifactId\u003ehttpstatus\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## JSP Tags\n\n### hs:cause\n\nThe `\u003chs:cause/\u003e` tag displays the cause of current HTTP status code, if any. A shorthand for:\n\n```jsp\n\u003c%= pageContext.getErrorData().getThrowable().getCause().getLocalizedMessage() %\u003e\n```\n\nOptional attributes are:\n\n| Attribute   | Description                                                                                                                                      |\n| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `default`   | The fallback value to output, if no cause is                                                                                                     |\n| `escapeXml` | Converts \u0026lt;, \u0026gt;, \u0026amp;, ', \" to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |\n\n### hs:code\n\nThe `\u003chs:code/\u003e` tag displays the current HTTP status code, if any. A shorthand for:\n\n```jsp\n\u003c%= pageContext.getErrorData().getStatusCode() %\u003e\n```\n\n### hs:message\n\nThe `\u003chs:message/\u003e` tag displays the current error message, if any. A shorthand for:\n\n```jsp\n\u003c%= request.getAttribute(\"javax.servlet.error.message\") %\u003e\n```\n\nOptional attributes are:\n\n| Attribute   | Description                                                                                                                                      |\n| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `default`   | The fallback value to output, if no error message is available.                                                                                  |\n| `escapeXml` | Converts \u0026lt;, \u0026gt;, \u0026amp;, ', \" to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |\n\n### hs:reason\n\nThe `\u003chs:reason/\u003e` tag displays the reason for an HTTP status code, if any. Optional attributes are:\n\n| Attribute   | Description                                                                                                                                      |\n| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `default`   | The fallback value to output, if no reason is available.                                                                                         |\n| `code`      | The HTTP status error code. If not specified the current status code is used.                                                                    |\n| `escapeXml` | Converts \u0026lt;, \u0026gt;, \u0026amp;, ', \" to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |\n\n## StatusCode Bean\n\nThe `StatusCode` bean can be used to check the class of the status code error. For example, using the JSTL:\n\n```jsp\n\u003c%@ taglib prefix=\"hs\" uri=\"http://erik.thauvin.net/taglibs/httpstatus\" %\u003e\n\u003c%@ taglib prefix=\"c\" uri=\"http://java.sun.com/jsp/jstl/core\" %\u003e\n\n\u003cjsp:useBean id=\"statusCode\" class=\"net.thauvin.erik.httpstatus.StatusCode\"/\u003e\n\u003cc:set target=\"${statusCode}\" property=\"code\"\u003e\u003chs:code/\u003e\u003c/c:set\u003e\n\u003cc:choose\u003e\n    \u003cc:when test=\"${statusCode.isClientError()}\"\u003e\n        An error occurred on your side. (\u003chs:reason/\u003e)\n    \u003c/c:when\u003e\n    \u003cc:otherwise\u003e\n        An error occurred on our side. (\u003chs:message/\u003e)\n    \u003c/c:otherwise\u003e\n\u003c/c:choose\u003e\n```\n\nor in a Servlet:\n\n```java\nimport net.thauvin.erik.httpstatus.StatusCode;\n\npublic class ExampleServlet extends HttpServlet {\n    public void doGet(HttpServletRequest request, HttpServletResponse response)  {\n        var statusCode = new StatusCode(\n                (Integer) request.getAttribute(\"javax.servlet.error.status_code\"));\n        if (statusCode.isError()) {\n            if (statusCode.isServerError()) {\n                var reason = statusCode.getReason();\n            } else {\n                // ...\n            }\n        }\n    }\n}\n```\n\nThe `StatusCode` bean methods are:\n\n| Method          | Description                                                          |\n| --------------- | -------------------------------------------------------------------- |\n| `getReason`     | Returns the reason for the status code (eg: `Internal Server Error`) |\n| `isClientError` | Checks if the status code is a client error.                         |\n| `isError`       | Checks if the status code is a server or client error.               |\n| `isInfo`        | Checks if the status code is informational.                          |\n| `isRedirect`    | Checks if the status code is a redirect.                             |\n| `isServerError` | Checks if the status code is a server error.                         |\n| `isSuccess`     | Checks if the status code is a success. (`OK`)                       |\n| `isValid`       | Checks if the status code is valid.                                  |\n\n## Reasons\n\nThe 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:\n\n| Status Code | Reason                                                     |\n| ----------- | ---------------------------------------------------------- |\n| `100`       | Continue                                                   |\n| `101`       | Switching Protocols                                        |\n| `102`       | Processing                                                 |\n| `103`       | Early Hints                                                |\n| `110`       | Response is Stale                                          |\n| `111`       | Revalidation Failed                                        |\n| `112`       | Disconnected Operation                                     |\n| `113`       | Heuristic Expiration                                       |\n| `199`       | Miscellaneous Warning                                      |\n| `200`       | OK                                                         |\n| `201`       | Created                                                    |\n| `202`       | Accepted                                                   |\n| `203`       | Non-Authoritative Information                              |\n| `204`       | No Content                                                 |\n| `205`       | Reset Content                                              |\n| `206`       | Partial Content                                            |\n| `207`       | Multi-Status                                               |\n| `208`       | Already Reported                                           |\n| `214`       | Transformation Applied                                     |\n| `218`       | This is fine                                               |\n| `226`       | IM Used                                                    |\n| `299`       | Miscellaneous Persistent Warning                           |\n| `300`       | Multiple Choices                                           |\n| `301`       | Moved Permanently                                          |\n| `302`       | Found/Moved Temporarily                                    |\n| `303`       | See Other                                                  |\n| `304`       | Not Modified                                               |\n| `305`       | Use Proxy                                                  |\n| `306`       | Unused                                                     |\n| `307`       | Temporary Redirect                                         |\n| `308`       | Permanent Redirect                                         |\n| `400`       | Bad Request                                                |\n| `401`       | Unauthorized                                               |\n| `402`       | Payment Required                                           |\n| `403`       | Forbidden                                                  |\n| `404`       | Not Found                                                  |\n| `405`       | Method Not Allowed                                         |\n| `406`       | Not Acceptable                                             |\n| `407`       | Proxy Authentication Required                              |\n| `408`       | Request Timeout                                            |\n| `409`       | Conflict                                                   |\n| `410`       | Gone                                                       |\n| `411`       | Length Required                                            |\n| `412`       | Precondition Failed                                        |\n| `413`       | Payload Too Large                                          |\n| `414`       | URI Too Long                                               |\n| `415`       | Unsupported Media Type                                     |\n| `416`       | Range Not Satisfiable                                      |\n| `417`       | Expectation Failed                                         |\n| `418`       | I'm A Teapot                                               |\n| `419`       | Insufficient Space on Resource                             |\n| `420`       | Method Failure                                             |\n| `421`       | Misdirected Request                                        |\n| `422`       | Unprocessable Content                                      |\n| `423`       | Locked                                                     |\n| `424`       | Failed Dependency                                          |\n| `425`       | Too Early                                                  |\n| `426`       | Upgrade Required                                           |\n| `428`       | Precondition Required                                      |\n| `429`       | Too Many Requests                                          |\n| `430`       | Request Header Fields Too Large                            |\n| `431`       | Request Header Fields Too Large                            |\n| `440`       | Login Timeout                                              |\n| `444`       | No Response                                                |\n| `449`       | Retry With                                                 |\n| `450`       | Blocked by Windows Parental Controls                       |\n| `451`       | Unavailable For Legal Reasons                              |\n| `460`       | Client Closed Connection Before Load Balancer Idle Timeout |\n| `463`       | X-Forwarded-For Header with More than 30 IP Addresses      |\n| `494`       | Request Header Too Large                                   |\n| `495`       | SSL Certificate Error                                      |\n| `496`       | SSL Certificate Required                                   |\n| `497`       | HTTP Request Sent to HTTPS Port                            |\n| `498`       | Token Expired/Invalid                                      |\n| `499`       | Client Closed Request                                      |\n| `500`       | Internal Server Error                                      |\n| `501`       | Not Implemented                                            |\n| `502`       | Bad Gateway                                                |\n| `503`       | Service Unavailable                                        |\n| `504`       | Gateway Timeout                                            |\n| `505`       | HTTP Version Not Supported                                 |\n| `506`       | Variant Also Negotiates                                    |\n| `507`       | Insufficient Storage                                       |\n| `508`       | Loop Detected                                              |\n| `509`       | Bandwidth Limit Exceeded                                   |\n| `510`       | Not Extended                                               |\n| `511`       | Network Authentication Required                            |\n| `520`       | Unknown Error                                              |\n| `521`       | Web Server Is Down                                         |\n| `522`       | Connection Timed Out                                       |\n| `523`       | Origin Is Unreachable                                      |\n| `524`       | A Timeout Occurred                                         |\n| `525`       | SSL Handshake Failed                                       |\n| `526`       | Invalid SSL Certificate                                    |\n| `527`       | Railgun Error                                              |\n| `529`       | Site is overloaded                                         |\n| `530`       | Site is frozen                                             |\n| `540`       | Temporarily Disabled                                       |\n| `561`       | Unauthorized                                               |\n| `598`       | Network Read Timeout Error                                 |\n| `599`       | Network Connect Timeout Error                              |\n| `783`       | Unexpected Token                                           |\n\n## Command Line Usage\n\nYou can query the reason phrase for status codes as follows:\n\n```console\n$ java -jar httpstatus-1.1.1.jar 404 500\n404: Not Found\n500: Internal Server Error\n```\n\nIf no status code is specified, all will be printed:\n\n```console\n$ java -jar httpstatus-1.1.1.jar\n100: Continue\n101: Switching Protocols\n102: Processing\n103: Early Hints\n110: Response is Stale\n111: Revalidation Failed\n112: Disconnected Operation\n113: Heuristic Expiration\n199: Miscellaneous Warning\n200: OK\n201: Created\n202: Accepted\n203: Non-Authoritative Information\n...\n```\n\nYou can also print status codes by [response classes](https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes):\n\n```console\n$ java -jar httpstatus-1.1.1.jar 2xx\n200: OK\n201: Created\n202: Accepted\n203: Non-Authoritative Information\n...\n```\n\n## Contributing\n\nIf you want to contribute to this project, all you have to do is clone the GitHub\nrepository:\n\n```console\ngit clone git@github.com:ethauvin/HttpStatus.git\n```\n\nThen use [bld](https://rife2.com/bld) to build:\n\n```console\ncd HttpStatus\n./bld compile\n```\n\nThe project has an [IntelliJ IDEA](https://www.jetbrains.com/idea/) project structure. You can just open it after all\nthe dependencies were downloaded and peruse the code.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethauvin%2Fhttpstatus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethauvin%2Fhttpstatus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethauvin%2Fhttpstatus/lists"}