X-Git-Url: http://git.rot13.org/?p=zxing.git;a=blobdiff_plain;f=zxingorg%2Fweb%2Fdecoderesult.jspx;h=b7002f3e5fcfee0f9779f7c750cf3a24987cd929;hp=00d82f82e287eb17aa53b8fb95858da68f6bdf80;hb=5cc5a1cd29b034939d7545140454c869844ddfea;hpb=1db937b1d34d6570be95426f1e9c5a629e86ffe3 diff --git a/zxingorg/web/decoderesult.jspx b/zxingorg/web/decoderesult.jspx index 00d82f82..b7002f3e 100644 --- a/zxingorg/web/decoderesult.jspx +++ b/zxingorg/web/decoderesult.jspx @@ -14,52 +14,106 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - - response.setHeader("Cache-Control", "no-cache"); - - - - - - - - Decode Succeeded - - - -

Decode Succeeded

- - - - - - - - - - - - - - - - - - - - - -
Raw text${text}
Raw bytes${rawBytesString}
Barcode format${result.barcodeFormat}
Parsed Result Type${parsedResult.type}
Parsed Result${displayResult}
-

Copyright 2008 ZXing authors

- - - + + + + + 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(); + } + + +response.setHeader("Cache-Control", "no-cache"); +]]> + + + Decode Succeeded + + + + + + + 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); + text = text.replaceAll("\r?\n", "<br/>"); + } + + 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); + displayResult = displayResult.replaceAll("\r?\n", "<br/>"); + } + + + + + + + + + + + + + + + + + + + + + + +
Raw texttext
Raw bytesrawBytesString
Barcode formatresult.getBarcodeFormat()
Parsed Result TypeparsedResult.getType()
Parsed ResultdisplayResult
+
+ + } + + + + +