Cleanup.
This commit is contained in:
parent
7245515df1
commit
4fbc229beb
8 changed files with 18 additions and 22 deletions
|
@ -29,6 +29,7 @@
|
|||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.thauvin.erik.httpstatus;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -48,8 +49,7 @@ public final class Utils {
|
|||
*
|
||||
* @throws UnsupportedOperationException If the constructor is called.
|
||||
*/
|
||||
private Utils()
|
||||
throws UnsupportedOperationException {
|
||||
private Utils() {
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public final class Utils {
|
|||
* @throws IOException If an I/O error occurs.
|
||||
*/
|
||||
public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
|
||||
throws IOException {
|
||||
throws IOException {
|
||||
if (xml) {
|
||||
if (value != null) {
|
||||
out.write(escapeXml(value));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HTML LANG="en">
|
||||
<HEAD>
|
||||
<TITLE>HttpStatus JSP Tag Library</TITLE>
|
||||
</HEAD>
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.thauvin.erik.httpstatus.taglibs;
|
||||
|
||||
import net.thauvin.erik.httpstatus.Utils;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
import java.io.IOException;
|
||||
|
@ -50,8 +50,7 @@ public class CauseTag extends XmlSupport {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException {
|
||||
public void doTag() throws IOException {
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.thauvin.erik.httpstatus.taglibs;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
@ -49,8 +49,7 @@ public class CodeTag extends SimpleTagSupport {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException {
|
||||
public void doTag() throws IOException {
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
|
||||
|
|
|
@ -29,12 +29,12 @@
|
|||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.thauvin.erik.httpstatus.taglibs;
|
||||
|
||||
import net.thauvin.erik.httpstatus.Reasons;
|
||||
import net.thauvin.erik.httpstatus.Utils;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
import java.io.IOException;
|
||||
|
@ -54,8 +54,7 @@ public class ReasonTag extends XmlSupport {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException {
|
||||
public void doTag() {
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
|
||||
|
@ -63,10 +62,8 @@ public class ReasonTag extends XmlSupport {
|
|||
if (statusCode >= 0) {
|
||||
Utils.outWrite(out, Reasons.getReasonPhrase(statusCode), defaultValue, escapeXml);
|
||||
} else {
|
||||
Utils.outWrite(out,
|
||||
Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()),
|
||||
defaultValue,
|
||||
escapeXml);
|
||||
Utils.outWrite(out, Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()), defaultValue,
|
||||
escapeXml);
|
||||
}
|
||||
} catch (IOException ignore) {
|
||||
// Ignore.
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.thauvin.erik.httpstatus.taglibs;
|
||||
|
||||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
@ -44,12 +45,12 @@ public abstract class XmlSupport extends SimpleTagSupport {
|
|||
/**
|
||||
* Default value string.
|
||||
*/
|
||||
protected String defaultValue;
|
||||
String defaultValue;
|
||||
|
||||
/**
|
||||
* Escape XML flag.
|
||||
*/
|
||||
protected boolean escapeXml = true;
|
||||
boolean escapeXml = true;
|
||||
|
||||
/**
|
||||
* Sets the default value.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HTML LANG="en">
|
||||
<HEAD>
|
||||
<TITLE>HttpStatus JSP Tag Library</TITLE>
|
||||
</HEAD>
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
~ 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.
|
||||
-->
|
||||
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<taglib xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
|
||||
version="2.1">
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue