Compare commits
2 commits
55c0cfdce5
...
3bedb10705
Author | SHA1 | Date | |
---|---|---|---|
3bedb10705 | |||
d0770a76f6 |
4 changed files with 25 additions and 22 deletions
4
.idea/libraries/bld.xml
generated
4
.idea/libraries/bld.xml
generated
|
@ -2,11 +2,11 @@
|
||||||
<library name="bld">
|
<library name="bld">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.1.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.1-sources.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.2-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<excluded>
|
<excluded>
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||||
|
|
41
README.md
41
README.md
|
@ -72,9 +72,9 @@ The `<hs:cause/>` tag displays the cause of current HTTP status code, if any. A
|
||||||
|
|
||||||
Optional attributes are:
|
Optional attributes are:
|
||||||
|
|
||||||
| Attribute | Description |
|
| Attribute | Description |
|
||||||
|-------------|----------------------------------------------------------------------------------------------------------|
|
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `default` | The fallback value to output, if no cause is |
|
| `default` | The fallback value to output, if no cause is |
|
||||||
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
|
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
|
||||||
|
|
||||||
## hs:code
|
## hs:code
|
||||||
|
@ -94,19 +94,19 @@ The `<hs:message/>` tag displays the current error message, if any. A shorthand
|
||||||
|
|
||||||
Optional attributes are:
|
Optional attributes are:
|
||||||
|
|
||||||
| Attribute | Description |
|
| Attribute | Description |
|
||||||
|-------------|----------------------------------------------------------------------------------------------------------|
|
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `default` | The fallback value to output, if no error message is available. |
|
| `default` | The fallback value to output, if no error message is available. |
|
||||||
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
|
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
|
||||||
|
|
||||||
## hs:reason
|
## hs:reason
|
||||||
|
|
||||||
The `<hs:reason/>` tag displays the reason for a HTTP status code, if any. Optional attributes are:
|
The `<hs:reason/>` tag displays the reason for an HTTP status code, if any. Optional attributes are:
|
||||||
|
|
||||||
| Attribute | Description |
|
| Attribute | Description |
|
||||||
|-------------|----------------------------------------------------------------------------------------------------------|
|
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `default` | The fallback value to output, if no reason is available. |
|
| `default` | The fallback value to output, if no reason is available. |
|
||||||
| `code` | The HTTP status error code. If not specified the current status code is used. |
|
| `code` | The HTTP status error code. If not specified the current status code is used. |
|
||||||
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
|
| `escapeXml` | Converts <, >, &, ', " to their corresponding [entity codes](http://dev.w3.org/html5/html-author/charref). Value is `true` by default. |
|
||||||
|
|
||||||
## StatusCode Bean
|
## StatusCode Bean
|
||||||
|
@ -134,14 +134,17 @@ or in a Servlet:
|
||||||
```java
|
```java
|
||||||
import net.thauvin.erik.httpstatus.StatusCode;
|
import net.thauvin.erik.httpstatus.StatusCode;
|
||||||
|
|
||||||
// ---
|
public class ExampleServlet extends HttpServlet {
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) {
|
||||||
StatusCode statusCode = new StatusCode((Integer) request.getAttribute("javax.servlet.error.status_code"));
|
var statusCode = new StatusCode(
|
||||||
if (statusCode.isError()) {
|
(Integer) request.getAttribute("javax.servlet.error.status_code"));
|
||||||
if (statusCode.isServerError()) {
|
if (statusCode.isError()) {
|
||||||
String reason = statusCode.getReason();
|
if (statusCode.isServerError()) {
|
||||||
} else {
|
var reason = statusCode.getReason();
|
||||||
// ...
|
} else {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Binary file not shown.
|
@ -4,4 +4,4 @@ bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2
|
||||||
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.0
|
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.0
|
||||||
bld.repositories=RIFE2_SNAPSHOTS,RIFE2_RELEASES,MAVEN_CENTRAL
|
bld.repositories=RIFE2_SNAPSHOTS,RIFE2_RELEASES,MAVEN_CENTRAL
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
bld.version=1.7.1
|
bld.version=1.7.2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue