Skip to content

Commit b772c15

Browse files
committed
Add Javadoc references
1 parent 6951df7 commit b772c15

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

README.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Include the following in your `bld` build file:
8686
repositories = List.of(MAVEN_CENTRAL, CENTRAL_SNAPSHOTS);
8787

8888
scope(compile).include(
89-
dependency("net.thauvin.erik.httpstatus","httpstatus", version(1, 1, 1))
89+
dependency("net.thauvin.erik.httpstatus","httpstatus", version(2, 0, 0, "SNAPSHOT"))
9090
);
9191
```
9292

@@ -104,7 +104,7 @@ repositories {
104104
}
105105
106106
dependencies {
107-
implementation 'net.thauvin.erik.httpstatus:httpstatus:1.1.1'
107+
implementation 'net.thauvin.erik.httpstatus:httpstatus:2.0.0-SNAPSHOT'
108108
}
109109
```
110110

@@ -114,7 +114,7 @@ Instructions for using with Maven, Ivy, etc. can be found on [Maven Central](htt
114114

115115
## JSP Tags
116116

117-
### hs:cause
117+
### [hs:cause](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/taglibs/CauseTag.html)
118118

119119
The `<hs:cause/>` tag displays the cause of current HTTP status code, if any. A shorthand for:
120120

@@ -129,15 +129,15 @@ Optional attributes are:
129129
| `default` | The fallback value to output, if no cause is |
130130
| `escapeXml` | Converts &lt;, &gt;, &amp;, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
131131

132-
### hs:code
132+
### [hs:code](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/taglibs/CodeTag.html)
133133

134134
The `<hs:code/>` tag displays the current HTTP status code, if any. A shorthand for:
135135

136136
```jsp
137137
<%= pageContext.getErrorData().getStatusCode() %>
138138
```
139139

140-
### hs:message
140+
### [hs:message](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/taglibs/MessageTag.html)
141141

142142
The `<hs:message/>` tag displays the current error message, if any. A shorthand for:
143143

@@ -152,7 +152,7 @@ Optional attributes are:
152152
| `default` | The fallback value to output, if no error message is available. |
153153
| `escapeXml` | Converts &lt;, &gt;, &amp;, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
154154

155-
### hs:reason
155+
### [hs:reason](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/taglibs/ReasonTag.html)
156156

157157
The `<hs:reason/>` tag displays the reason for an HTTP status code, if any. Optional attributes are:
158158

@@ -164,13 +164,14 @@ The `<hs:reason/>` tag displays the reason for an HTTP status code, if any. Opti
164164

165165
## StatusCode
166166

167-
The `StatusCode` bean can be used to check the class of the status code error.
167+
The [StatusCode](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html) bean can be used to check the class of the status code error.
168168

169169
For example, in Java:
170170

171171
```java
172-
if (StatusCode.isServerError(500)) {
173-
System.out.println(Reasons.getReasonPhrase(500)); // Internal Server Error
172+
var statusCode = new StatusCode(500);
173+
if (statusCode.isError()) {
174+
System.out.println(statusCode.getReason()); // Internal Server Error
174175
}
175176
```
176177

@@ -212,37 +213,39 @@ public class ExampleServlet extends HttpServlet {
212213
}
213214
```
214215

215-
The `StatusCode` bean methods are:
216+
The [StatusCode](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html) bean methods are:
216217

217-
| Method | Description |
218-
|:-----------------|:----------------------------------------------------------------------|
219-
| `getReason` | Returns the reason for the status code (e.g. `Internal Server Error`) |
220-
| `isClientError` | Checks if the status code is a client error. |
221-
| `isError` | Checks if the status code is a server or client error. |
222-
| `isInfo` | Checks if the status code is informational. |
223-
| `isRedirect` | Checks if the status code is a redirect. |
224-
| `isServerError` | Checks if the status code is a server error. |
225-
| `isSuccess` | Checks if the status code is a success. (`OK`) |
226-
| `isValid` | Checks if the status code is valid. |
218+
| Method | Description |
219+
|:-------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------|
220+
| [getReason](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#getReason()) | Returns the reason for the status code (e.g. `Internal Server Error`) |
221+
| [isClientError](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#isClientError()) | Checks if the status code is a client error. |
222+
| [isError](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#isError()) | Checks if the status code is a server or client error. |
223+
| [isInfo](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#isInfo()) | Checks if the status code is informational. |
224+
| [isRedirect](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#isRedirect()) | Checks if the status code is a redirect. |
225+
| [isServerError](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#isServerError()) | Checks if the status code is a server error. |
226+
| [isSuccess](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#isSuccess()) | Checks if the status code is a success. (`OK`) |
227+
| [isValid](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#isValid()) | Checks if the status code is valid. |
228+
229+
These methods are also available as [static methods](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCode.html#method-summary`).
227230

228231
### Status Code Class
229232

230-
You can also retrieve all status codes in a specific [class](https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes):
233+
The [StatusCodeClass](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCodeClass.html) can be used to retrieve all status codes in a specific [class](https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes):
231234

232235
```java
233236
var reasons = Reasons.getReasonClass(StatusCodeClass.SERVER_ERROR); // 5xx
234237
reasons.forEach((code, reason) -> System.out.println(code + ": " + reason)); // 500: Internal Server Error
235238
```
236239

237-
The [standard classes](https://www.rfc-editor.org/rfc/rfc9110.html#name-status-codes) are:
240+
The defined [standard classes](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCodeClass.html#enum-constant-summary) are:
238241

239-
| StatusCodeClass | Value | Description |
240-
|:----------------|:------:|:----------------------------------------------------------------|
241-
| 'INFORMATIONAL' | 1xx | The request was received, continuing process |
242-
| 'SUCCESSFUL' | 2xx | The request was successfully received, understood, and accepted |
243-
| 'REDIRECTION' | 3xx | Further action needs to be taken to complete the request |
244-
| 'CLIENT_ERROR' | 4xx | The request contains bad syntax or cannot be fulfilled |
245-
| 'SERVER_ERROR' | 5xx | The server failed to fulfil an apparently valid request |
242+
| StatusCodeClass | Values | Description |
243+
|:----------------------------------------------------------------------------------------------------------------------|:------:|:----------------------------------------------------------------|
244+
| [INFORMATIONAL](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCodeClass.html#INFORMATIONAL) | 1xx | The request was received, continuing process |
245+
| [SUCCESSFUL](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCodeClass.html#SUCCESSFUL) | 2xx | The request was successfully received, understood, and accepted |
246+
| [REDIRECTION](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCodeClass.html#REDIRECTION) | 3xx | Further action needs to be taken to complete the request |
247+
| [CLIENT_ERROR](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCodeClass.html#CLIENT_ERROR) | 4xx | The request contains bad syntax or cannot be fulfilled |
248+
| [SERVER_ERROR](https://ethauvin.github.io/HttpStatus/net/thauvin/erik/httpstatus/StatusCodeClass.html#SERVER_ERROR) | 5xx | The server failed to fulfil an apparently valid request |
246249

247250
## Reasons
248251

0 commit comments

Comments
 (0)