2008-05-11 11:01:23 -07:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!--
|
2008-06-19 13:56:24 -07:00
|
|
|
Copyright 2008 ZXing authors
|
2008-05-11 11:01:23 -07:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
http://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.
|
|
|
|
-->
|
2008-11-14 16:07:25 -08:00
|
|
|
<!-- Author: Sean Owen -->
|
2009-08-13 04:11:48 -07:00
|
|
|
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
|
2010-03-25 10:22:45 -07:00
|
|
|
<jsp:directive.page import="
|
|
|
|
java.util.List,
|
|
|
|
com.google.zxing.Result,
|
|
|
|
com.google.zxing.client.result.ResultParser,
|
|
|
|
com.google.zxing.client.result.ParsedResult,
|
|
|
|
org.apache.commons.lang.StringEscapeUtils"/>
|
|
|
|
<jsp:declaration>
|
|
|
|
private static String arrayToString(byte[] bytes) {
|
|
|
|
int length = bytes.length;
|
|
|
|
StringBuilder result = new StringBuilder(length << 2);
|
|
|
|
int i = 0;
|
|
|
|
while (i < length) {
|
|
|
|
int max = Math.min(i + 8, length);
|
|
|
|
for (int j = i; j < max; j++) {
|
|
|
|
int value = bytes[j] & 0xFF;
|
|
|
|
result.append(Integer.toHexString(value / 16));
|
|
|
|
result.append(Integer.toHexString(value % 16));
|
|
|
|
result.append(' ');
|
|
|
|
}
|
|
|
|
result.append('\n');
|
|
|
|
i += 8;
|
|
|
|
}
|
|
|
|
for (int j = i - 8; j < length; j++) {
|
|
|
|
result.append(Integer.toHexString(bytes[j] & 0xFF));
|
|
|
|
result.append(' ');
|
|
|
|
}
|
|
|
|
return result.toString();
|
|
|
|
}
|
|
|
|
</jsp:declaration>
|
2009-08-13 04:11:48 -07:00
|
|
|
<jsp:directive.page contentType="text/html" session="false"/>
|
|
|
|
<jsp:scriptlet>response.setHeader("Cache-Control", "no-cache");</jsp:scriptlet>
|
|
|
|
<jsp:text><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">]]></jsp:text>
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
|
|
|
<head>
|
|
|
|
<title>Decode Succeeded</title>
|
2010-01-31 06:43:44 -08:00
|
|
|
<link rel="stylesheet" href="style.css" type="text/css"/>
|
2009-08-13 04:11:48 -07:00
|
|
|
<style type="text/css">
|
|
|
|
td { vertical-align: top; padding: 0.1in; background-color: #EEEEEE; font-family: monospace; }
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
2010-01-31 06:43:44 -08:00
|
|
|
<div id="header"><h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Decode Succeeded</h1></div>
|
2010-03-25 10:22:45 -07:00
|
|
|
<jsp:scriptlet>
|
|
|
|
for (Result result : (List<Result>) request.getAttribute("results")) {
|
|
|
|
ParsedResult parsedResult = ResultParser.parseResult(result);
|
|
|
|
|
|
|
|
String text = result.getText();
|
|
|
|
if (text == null) {
|
|
|
|
text = "(Not applicable)";
|
|
|
|
} else {
|
|
|
|
text = StringEscapeUtils.escapeXml(text);
|
2010-08-16 04:09:49 -07:00
|
|
|
text = text.replaceAll("\r?\n", "<br/>");
|
2010-03-25 10:22:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
byte[] rawBytes = result.getRawBytes();
|
|
|
|
String rawBytesString;
|
|
|
|
if (rawBytes == null) {
|
|
|
|
rawBytesString = "(Not applicable)";
|
|
|
|
} else {
|
|
|
|
rawBytesString = arrayToString(rawBytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
String displayResult = parsedResult.getDisplayResult();
|
|
|
|
if (displayResult == null) {
|
|
|
|
displayResult = "(Not applicable)";
|
|
|
|
} else {
|
|
|
|
displayResult = StringEscapeUtils.escapeXml(displayResult);
|
2010-08-16 04:09:49 -07:00
|
|
|
displayResult = displayResult.replaceAll("\r?\n", "<br/>");
|
2010-03-25 10:22:45 -07:00
|
|
|
}
|
|
|
|
</jsp:scriptlet>
|
2009-08-13 04:11:48 -07:00
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td>Raw text</td>
|
2010-03-25 10:22:45 -07:00
|
|
|
<td><jsp:expression>text</jsp:expression></td>
|
2009-08-13 04:11:48 -07:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Raw bytes</td>
|
2010-03-25 10:22:45 -07:00
|
|
|
<td><jsp:expression>rawBytesString</jsp:expression></td>
|
2009-08-13 04:11:48 -07:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Barcode format</td>
|
2010-03-25 10:22:45 -07:00
|
|
|
<td><jsp:expression>result.getBarcodeFormat()</jsp:expression></td>
|
2009-08-13 04:11:48 -07:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Parsed Result Type</td>
|
2010-03-25 10:22:45 -07:00
|
|
|
<td><jsp:expression>parsedResult.getType()</jsp:expression></td>
|
2009-08-13 04:11:48 -07:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Parsed Result</td>
|
2010-03-25 10:22:45 -07:00
|
|
|
<td><jsp:expression>displayResult</jsp:expression></td>
|
2009-08-13 04:11:48 -07:00
|
|
|
</tr>
|
|
|
|
</table>
|
2010-03-25 10:22:45 -07:00
|
|
|
<hr/>
|
|
|
|
<jsp:scriptlet>
|
|
|
|
}
|
|
|
|
</jsp:scriptlet>
|
2010-01-31 06:43:44 -08:00
|
|
|
<div id="footer"><p>Copyright 2008 and onwards ZXing authors</p></div>
|
2009-08-13 04:11:48 -07:00
|
|
|
<jsp:include page="analytics.jspx"/>
|
|
|
|
</body>
|
|
|
|
</html>
|
2008-05-11 11:01:23 -07:00
|
|
|
</jsp:root>
|