Reformatted code, updated to new Analytics tags, fixed a problem with EmailAuthenticator

git-svn-id: https://zxing.googlecode.com/svn/trunk@386 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2008-05-05 17:39:33 +00:00
parent 08c7c6fadb
commit 13b637fa53
10 changed files with 417 additions and 332 deletions

View file

@ -55,14 +55,8 @@ final class DecodeEmailTask extends TimerTask {
private static final String SMTP_PORT = "465"; private static final String SMTP_PORT = "465";
private static final String POP_PORT = "995"; private static final String POP_PORT = "995";
private static final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; private static final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
private static final Address fromAddress;
private static final Properties sessionProperties = new Properties(); private static final Properties sessionProperties = new Properties();
static { static {
try {
fromAddress = new InternetAddress("w@zxing.org", "ZXing By Email");
} catch (UnsupportedEncodingException uee) {
throw new RuntimeException(uee);
}
sessionProperties.setProperty("mail.transport.protocol", "smtp"); sessionProperties.setProperty("mail.transport.protocol", "smtp");
sessionProperties.setProperty("mail.smtp.host", SMTP_HOST); sessionProperties.setProperty("mail.smtp.host", SMTP_HOST);
sessionProperties.setProperty("mail.smtp.auth", "true"); sessionProperties.setProperty("mail.smtp.auth", "true");
@ -80,9 +74,16 @@ final class DecodeEmailTask extends TimerTask {
} }
private final Authenticator emailAuthenticator; private final Authenticator emailAuthenticator;
private final Address fromAddress;
DecodeEmailTask(Authenticator emailAuthenticator) { DecodeEmailTask(String emailAddress, Authenticator emailAuthenticator) {
this.emailAuthenticator = emailAuthenticator; this.emailAuthenticator = emailAuthenticator;
try {
fromAddress = new InternetAddress(emailAddress, "ZXing By Email");
} catch (UnsupportedEncodingException uee) {
// Can't happen?
throw new RuntimeException(uee);
}
} }
@Override @Override

View file

@ -67,23 +67,24 @@ import java.util.logging.Logger;
*/ */
public final class DecodeServlet extends HttpServlet { public final class DecodeServlet extends HttpServlet {
private static final long MAX_IMAGE_SIZE = 500000L; private static final long MAX_IMAGE_SIZE = 500000L;
private static final long EMAIL_CHECK_INTERVAL = 60000L; private static final long EMAIL_CHECK_INTERVAL = 60000L;
private static final Logger log = Logger.getLogger(DecodeServlet.class.getName()); private static final Logger log = Logger.getLogger(DecodeServlet.class.getName());
static final Hashtable<DecodeHintType, Object> HINTS; static final Hashtable<DecodeHintType, Object> HINTS;
static { static {
HINTS = new Hashtable<DecodeHintType, Object>(3); HINTS = new Hashtable<DecodeHintType, Object>(3);
HINTS.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); HINTS.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
} }
private HttpClient client; private HttpClient client;
private DiskFileItemFactory diskFileItemFactory; private DiskFileItemFactory diskFileItemFactory;
private Timer emailTimer; private Timer emailTimer;
@Override @Override
public void init(ServletConfig servletConfig) throws ServletException { public void init(ServletConfig servletConfig) throws ServletException {
Logger logger = Logger.getLogger("com.google.zxing"); Logger logger = Logger.getLogger("com.google.zxing");
logger.addHandler(new ServletContextLogHandler(servletConfig.getServletContext())); logger.addHandler(new ServletContextLogHandler(servletConfig.getServletContext()));
@ -107,138 +108,138 @@ public final class DecodeServlet extends HttpServlet {
Authenticator emailAuthenticator = new EmailAuthenticator(emailAddress, emailPassword); Authenticator emailAuthenticator = new EmailAuthenticator(emailAddress, emailPassword);
emailTimer = new Timer("Email decoder timer", true); emailTimer = new Timer("Email decoder timer", true);
emailTimer.schedule(new DecodeEmailTask(emailAuthenticator), 0L, EMAIL_CHECK_INTERVAL); emailTimer.schedule(new DecodeEmailTask(emailAddress, emailAuthenticator), 0L, EMAIL_CHECK_INTERVAL);
log.info("DecodeServlet configured"); log.info("DecodeServlet configured");
} }
@Override @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String imageURIString = request.getParameter("u"); String imageURIString = request.getParameter("u");
if (imageURIString == null || imageURIString.length() == 0) { if (imageURIString == null || imageURIString.length() == 0) {
response.sendRedirect("badurl.jspx"); response.sendRedirect("badurl.jspx");
return; return;
} }
if (!(imageURIString.startsWith("http://") || imageURIString.startsWith("https://"))) { if (!(imageURIString.startsWith("http://") || imageURIString.startsWith("https://"))) {
imageURIString = "http://" + imageURIString; imageURIString = "http://" + imageURIString;
} }
URI imageURI; URI imageURI;
try { try {
imageURI = new URI(imageURIString); imageURI = new URI(imageURIString);
} catch (URISyntaxException urise) { } catch (URISyntaxException urise) {
response.sendRedirect("badurl.jspx"); response.sendRedirect("badurl.jspx");
return; return;
} }
HttpGet getRequest = new HttpGet(imageURI); HttpGet getRequest = new HttpGet(imageURI);
try { try {
HttpResponse getResponse = client.execute(getRequest); HttpResponse getResponse = client.execute(getRequest);
if (getResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) { if (getResponse.getStatusLine().getStatusCode() != HttpServletResponse.SC_OK) {
response.sendRedirect("badurl.jspx"); response.sendRedirect("badurl.jspx");
return; return;
} }
if (!isSizeOK(getResponse)) { if (!isSizeOK(getResponse)) {
response.sendRedirect("badimage.jspx"); response.sendRedirect("badimage.jspx");
return; return;
} }
log.info("Decoding " + imageURI); log.info("Decoding " + imageURI);
InputStream is = getResponse.getEntity().getContent(); InputStream is = getResponse.getEntity().getContent();
try { try {
processStream(is, response); processStream(is, response);
} finally { } finally {
is.close(); is.close();
} }
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
getRequest.abort(); getRequest.abort();
response.sendRedirect("badurl.jspx"); response.sendRedirect("badurl.jspx");
} catch (HttpException he) { } catch (HttpException he) {
getRequest.abort(); getRequest.abort();
response.sendRedirect("badurl.jspx"); response.sendRedirect("badurl.jspx");
} }
} }
@Override @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { throws ServletException, IOException {
if (!ServletFileUpload.isMultipartContent(request)) { if (!ServletFileUpload.isMultipartContent(request)) {
response.sendRedirect("badimage.jspx"); response.sendRedirect("badimage.jspx");
return; return;
} }
ServletFileUpload upload = new ServletFileUpload(diskFileItemFactory); ServletFileUpload upload = new ServletFileUpload(diskFileItemFactory);
upload.setFileSizeMax(MAX_IMAGE_SIZE); upload.setFileSizeMax(MAX_IMAGE_SIZE);
// Parse the request // Parse the request
try { try {
for (FileItem item : (List<FileItem>) upload.parseRequest(request)) { for (FileItem item : (List<FileItem>) upload.parseRequest(request)) {
if (!item.isFormField()) { if (!item.isFormField()) {
if (item.getSize() <= MAX_IMAGE_SIZE) { if (item.getSize() <= MAX_IMAGE_SIZE) {
log.info("Decoding uploaded file"); log.info("Decoding uploaded file");
InputStream is = item.getInputStream(); InputStream is = item.getInputStream();
try { try {
processStream(is, response); processStream(is, response);
} finally { } finally {
is.close(); is.close();
} }
} else { } else {
throw new ServletException("File is too large: " + item.getSize()); throw new ServletException("File is too large: " + item.getSize());
} }
break; break;
} }
} }
} catch (FileUploadException fue) { } catch (FileUploadException fue) {
response.sendRedirect("badimage.jspx"); response.sendRedirect("badimage.jspx");
} }
}
private static void processStream(InputStream is, HttpServletResponse response) throws IOException { }
BufferedImage image = ImageIO.read(is);
if (image == null) {
response.sendRedirect("badimage.jspx");
return;
}
Reader reader = new MultiFormatReader(); private static void processStream(InputStream is, HttpServletResponse response) throws IOException {
Result result; BufferedImage image = ImageIO.read(is);
try { if (image == null) {
result = reader.decode(new BufferedImageMonochromeBitmapSource(image), HINTS); response.sendRedirect("badimage.jspx");
} catch (ReaderException re) { return;
log.info("DECODE FAILED: " + re.toString()); }
response.sendRedirect("notfound.jspx");
return;
}
response.setContentType("text/plain"); Reader reader = new MultiFormatReader();
response.setCharacterEncoding("UTF-8"); Result result;
Writer out = new OutputStreamWriter(response.getOutputStream(), "UTF-8"); try {
try { result = reader.decode(new BufferedImageMonochromeBitmapSource(image), HINTS);
out.write(result.getText()); } catch (ReaderException re) {
} finally { log.info("DECODE FAILED: " + re.toString());
out.close(); response.sendRedirect("notfound.jspx");
} return;
} }
private static boolean isSizeOK(HttpMessage getResponse) { response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");
Writer out = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
try {
out.write(result.getText());
} finally {
out.close();
}
}
private static boolean isSizeOK(HttpMessage getResponse) {
Header lengthHeader = getResponse.getLastHeader("Content-Length"); Header lengthHeader = getResponse.getLastHeader("Content-Length");
if (lengthHeader != null) { if (lengthHeader != null) {
long length = Long.parseLong(lengthHeader.getValue()); long length = Long.parseLong(lengthHeader.getValue());
if (length > MAX_IMAGE_SIZE) { if (length > MAX_IMAGE_SIZE) {
return false; return false;
} }
} }
return true; return true;
} }
@Override @Override
public void destroy() { public void destroy() {
log.config("DecodeServlet shutting down..."); log.config("DecodeServlet shutting down...");
emailTimer.cancel(); emailTimer.cancel();
} }

View file

@ -19,105 +19,105 @@ package com.google.zxing.web;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.Collection;
/** /**
* @author Sean Owen * @author Sean Owen
*/ */
public final class DoSFilter implements Filter { public final class DoSFilter implements Filter {
private static final int MAX_ACCESSES_PER_IP_PER_TIME = 10; private static final int MAX_ACCESSES_PER_IP_PER_TIME = 10;
private static final long MAX_ACCESS_INTERVAL_MSEC = 10L * 1000L; private static final long MAX_ACCESS_INTERVAL_MSEC = 10L * 1000L;
private static final long UNBAN_INTERVAL_MSEC = 60L * 60L * 1000L; private static final long UNBAN_INTERVAL_MSEC = 60L * 60L * 1000L;
private final IPTrie numRecentAccesses; private final IPTrie numRecentAccesses;
private final Timer timer; private final Timer timer;
private final Set<String> bannedIPAddresses; private final Set<String> bannedIPAddresses;
private final Collection<String> manuallyBannedIPAddresses; private final Collection<String> manuallyBannedIPAddresses;
private ServletContext context; private ServletContext context;
public DoSFilter() { public DoSFilter() {
numRecentAccesses = new IPTrie(); numRecentAccesses = new IPTrie();
timer = new Timer("DosFilter reset timer"); timer = new Timer("DosFilter reset timer");
bannedIPAddresses = Collections.synchronizedSet(new HashSet<String>()); bannedIPAddresses = Collections.synchronizedSet(new HashSet<String>());
manuallyBannedIPAddresses = new HashSet<String>(); manuallyBannedIPAddresses = new HashSet<String>();
} }
public void init(FilterConfig filterConfig) { public void init(FilterConfig filterConfig) {
context = filterConfig.getServletContext(); context = filterConfig.getServletContext();
String bannedIPs = filterConfig.getInitParameter("bannedIPs"); String bannedIPs = filterConfig.getInitParameter("bannedIPs");
if (bannedIPs != null) { if (bannedIPs != null) {
for (String ip : bannedIPs.split(",")) { for (String ip : bannedIPs.split(",")) {
manuallyBannedIPAddresses.add(ip.trim()); manuallyBannedIPAddresses.add(ip.trim());
} }
}
timer.scheduleAtFixedRate(new ResetTask(), 0L, MAX_ACCESS_INTERVAL_MSEC);
timer.scheduleAtFixedRate(new UnbanTask(), 0L, UNBAN_INTERVAL_MSEC);
} }
timer.scheduleAtFixedRate(new ResetTask(), 0L, MAX_ACCESS_INTERVAL_MSEC);
timer.scheduleAtFixedRate(new UnbanTask(), 0L, UNBAN_INTERVAL_MSEC);
}
public void doFilter(ServletRequest request, public void doFilter(ServletRequest request,
ServletResponse response, ServletResponse response,
FilterChain chain) throws IOException, ServletException { FilterChain chain) throws IOException, ServletException {
if (isBanned(request)) { if (isBanned(request)) {
HttpServletResponse servletResponse = (HttpServletResponse) response; HttpServletResponse servletResponse = (HttpServletResponse) response;
servletResponse.sendError(HttpServletResponse.SC_FORBIDDEN); servletResponse.sendError(HttpServletResponse.SC_FORBIDDEN);
} else { } else {
chain.doFilter(request, response); chain.doFilter(request, response);
}
} }
}
private boolean isBanned(ServletRequest request) { private boolean isBanned(ServletRequest request) {
String remoteIPAddressString = request.getRemoteAddr(); String remoteIPAddressString = request.getRemoteAddr();
if (bannedIPAddresses.contains(remoteIPAddressString) || if (bannedIPAddresses.contains(remoteIPAddressString) ||
manuallyBannedIPAddresses.contains(remoteIPAddressString)) { manuallyBannedIPAddresses.contains(remoteIPAddressString)) {
return true; return true;
}
InetAddress remoteIPAddress;
try {
remoteIPAddress = InetAddress.getByName(remoteIPAddressString);
} catch (UnknownHostException uhe) {
context.log("Can't determine host from: " + remoteIPAddressString + "; assuming banned");
return true;
}
if (numRecentAccesses.incrementAndGet(remoteIPAddress) > MAX_ACCESSES_PER_IP_PER_TIME) {
context.log("Possible DoS attack from " + remoteIPAddressString);
bannedIPAddresses.add(remoteIPAddressString);
return true;
}
return false;
}
public void destroy() {
timer.cancel();
numRecentAccesses.clear();
bannedIPAddresses.clear();
} }
InetAddress remoteIPAddress;
try {
remoteIPAddress = InetAddress.getByName(remoteIPAddressString);
} catch (UnknownHostException uhe) {
context.log("Can't determine host from: " + remoteIPAddressString + "; assuming banned");
return true;
}
if (numRecentAccesses.incrementAndGet(remoteIPAddress) > MAX_ACCESSES_PER_IP_PER_TIME) {
context.log("Possible DoS attack from " + remoteIPAddressString);
bannedIPAddresses.add(remoteIPAddressString);
return true;
}
return false;
}
private final class ResetTask extends TimerTask { public void destroy() {
@Override timer.cancel();
public void run() { numRecentAccesses.clear();
numRecentAccesses.clear(); bannedIPAddresses.clear();
} }
}
private final class UnbanTask extends TimerTask { private final class ResetTask extends TimerTask {
@Override @Override
public void run() { public void run() {
bannedIPAddresses.clear(); numRecentAccesses.clear();
} }
} }
private final class UnbanTask extends TimerTask {
@Override
public void run() {
bannedIPAddresses.clear();
}
}
} }

View file

@ -17,6 +17,7 @@
package com.google.zxing.web; package com.google.zxing.web;
import javax.mail.Authenticator; import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
final class EmailAuthenticator extends Authenticator { final class EmailAuthenticator extends Authenticator {
@ -28,4 +29,9 @@ final class EmailAuthenticator extends Authenticator {
this.emailPassword = emailPassword; this.emailPassword = emailPassword;
} }
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(emailUsername, emailPassword);
}
} }

View file

@ -24,50 +24,51 @@ import java.util.Arrays;
*/ */
final class IPTrie { final class IPTrie {
private final IPTrieNode root; private final IPTrieNode root;
IPTrie() { IPTrie() {
root = new IPTrieNode(false); root = new IPTrieNode(false);
} }
int incrementAndGet(InetAddress ipAddress) { int incrementAndGet(InetAddress ipAddress) {
byte[] octets = ipAddress.getAddress(); byte[] octets = ipAddress.getAddress();
synchronized (root) { synchronized (root) {
IPTrieNode current = root; IPTrieNode current = root;
int max = octets.length - 1; int max = octets.length - 1;
for (int offset = 0; offset < max; offset++) { for (int offset = 0; offset < max; offset++) {
int index = 0xFF & octets[offset]; int index = 0xFF & octets[offset];
IPTrieNode child = current.children[index]; IPTrieNode child = current.children[index];
if (child == null) { if (child == null) {
child = new IPTrieNode(offset == max - 1); child = new IPTrieNode(offset == max - 1);
current.children[index] = child; current.children[index] = child;
} }
current = child; current = child;
} }
int index = 0xFF & octets[max]; int index = 0xFF & octets[max];
current.values[index]++; current.values[index]++;
return current.values[index]; return current.values[index];
} }
} }
void clear() { void clear() {
synchronized (root) { synchronized (root) {
Arrays.fill(root.children, null); Arrays.fill(root.children, null);
} }
} }
private static final class IPTrieNode { private static final class IPTrieNode {
final IPTrieNode[] children; final IPTrieNode[] children;
final int[] values; final int[] values;
private IPTrieNode(boolean terminal) {
if (terminal) { private IPTrieNode(boolean terminal) {
children = null; if (terminal) {
values = new int[256]; children = null;
} else { values = new int[256];
children = new IPTrieNode[256]; } else {
values = null; children = new IPTrieNode[256];
} values = null;
} }
} }
}
} }

View file

@ -15,23 +15,35 @@
limitations under the License. limitations under the License.
--> -->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1"> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1">
<jsp:output <jsp:output
omit-xml-declaration="false" doctype-root-element="html" omit-xml-declaration="false" doctype-root-element="html"
doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.1//EN" doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.1//EN"
doctype-system="http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"/> doctype-system="http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"/>
<jsp:directive.page contentType="application/xhtml+xml" session="false"/> <jsp:directive.page contentType="application/xhtml+xml" session="false"/>
<jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet> <jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>No Barcode Found</title></head> <head>
<body> <title>No Barcode Found</title>
<p><b>Bad URL</b></p> </head>
<p>The image you uploaded could not be decoded, or was too large. Go "Back" in your browser and try another image.</p> <body>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> <p>
</script> <b>Bad URL</b>
<script type="text/javascript"> </p>
_uacct = "UA-788492-5"; <p>The image you uploaded could not be decoded, or was too large. Go "Back" in your browser and try another
urchinTracker(); image.
</script> </p>
</body> <script type="text/javascript">
</html> var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost +
"google-analytics.com/ga.js'
type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-788492-5");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
</jsp:root> </jsp:root>

View file

@ -15,23 +15,35 @@
limitations under the License. limitations under the License.
--> -->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1"> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1">
<jsp:output <jsp:output
omit-xml-declaration="false" doctype-root-element="html" omit-xml-declaration="false" doctype-root-element="html"
doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.1//EN" doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.1//EN"
doctype-system="http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"/> doctype-system="http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"/>
<jsp:directive.page contentType="application/xhtml+xml" session="false"/> <jsp:directive.page contentType="application/xhtml+xml" session="false"/>
<jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet> <jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>No Barcode Found</title></head> <head>
<body> <title>No Barcode Found</title>
<p><b>Bad URL</b></p> </head>
<p>You didn't specify a URL, or the URL was not valid, or did not return an image. Go "Back" in your browser and try again.</p> <body>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> <p>
</script> <b>Bad URL</b>
<script type="text/javascript"> </p>
_uacct = "UA-788492-5"; <p>You didn't specify a URL, or the URL was not valid, or did not return an image. Go "Back" in your browser and
urchinTracker(); try again.
</script> </p>
</body> <script type="text/javascript">
</html> var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost +
"google-analytics.com/ga.js'
type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-788492-5");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
</jsp:root> </jsp:root>

View file

@ -15,40 +15,58 @@
limitations under the License. limitations under the License.
--> -->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1"> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1">
<jsp:output <jsp:output
omit-xml-declaration="false" doctype-root-element="html" omit-xml-declaration="false" doctype-root-element="html"
doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/> doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>
<jsp:directive.page contentType="text/html" session="false"/> <jsp:directive.page contentType="text/html" session="false"/>
<jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet> <jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>ZXing Decoder Online</title></head> <head>
<body> <title>ZXing Decoder Online</title>
</head>
<body>
<h1>ZXing Decoder Online</h1> <h1>ZXing Decoder Online</h1>
<p><b>Under Construction</b>: This is a simple page that will let you decode a 1D or 2D barcode found <p><b>Under Construction</b>: This is a simple page that will let you decode a 1D or 2D barcode found
in an image online. Enter a URL below.</p> in an image online. Enter a URL below.
</p>
<form action="decode" method="get"> <form action="decode" method="get">
<p><input type="text" size="50" name="u"/><input type="submit"/></p> <p>
</form> <input type="text" size="50" name="u"/>
<input type="submit"/>
</p>
</form>
<p>Or try uploading a file:</p> <p>Or try uploading a file:</p>
<form action="decode" method="post" enctype="multipart/form-data" > <form action="decode" method="post" enctype="multipart/form-data">
<p><input type="file" size="50" name="f"/><input type="submit"/></p> <p>
</form> <input type="file" size="50" name="f"/>
<input type="submit"/>
</p>
</form>
<p>See the <a href="http://code.google.com/p/zxing">project page</a> for details.</p> <p>See the
<a href="http://code.google.com/p/zxing">project page</a>
for details.
</p>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> <script type="text/javascript">
</script> var gaJsHost = (("https:" == document.location.protocol) ?
<script type="text/javascript"> "https://ssl." : "http://www.");
_uacct = "UA-788492-5"; document.write(unescape("%3Cscript src='" + gaJsHost +
urchinTracker(); "google-analytics.com/ga.js'
</script> type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-788492-5");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body> </body>
</html> </html>
</jsp:root> </jsp:root>

View file

@ -15,27 +15,50 @@
limitations under the License. limitations under the License.
--> -->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1"> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1">
<jsp:output <jsp:output
omit-xml-declaration="false" doctype-root-element="html" omit-xml-declaration="false" doctype-root-element="html"
doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.1//EN" doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.1//EN"
doctype-system="http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"/> doctype-system="http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"/>
<jsp:directive.page contentType="application/xhtml+xml" session="false"/> <jsp:directive.page contentType="application/xhtml+xml" session="false"/>
<jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet> <jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Download ZXing Reader</title></head> <head>
<body> <title>Download ZXing Reader</title>
<p><strong>Welcome to zxing!</strong></p> </head>
<p><a href="BarcodeReader.jad">Download</a> the ZXing Barcode Reader.</p> <body>
<p><strong>Having problems with the regular version?</strong></p> <p>
<p><a href="BarcodeReaderBasic.jad">Download</a> the ZXing Barcode Reader Basic version.</p> <strong>Welcome to zxing!</strong>
<p><strong>An Android client is available for the curious:</strong></p> </p>
<p><a href="BarcodeReader.apk">Download</a> the Android client.</p> <p>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> <a href="BarcodeReader.jad">Download</a>
</script> the ZXing Barcode Reader.
<script type="text/javascript"> </p>
_uacct = "UA-788492-5"; <p>
urchinTracker(); <strong>Having problems with the regular version?</strong>
</script> </p>
</body> <p>
</html> <a href="BarcodeReaderBasic.jad">Download</a>
the ZXing Barcode Reader Basic version.
</p>
<p>
<strong>An Android client is available for the curious:</strong>
</p>
<p>
<a href="BarcodeReader.apk">Download</a>
the Android client.
</p>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost +
"google-analytics.com/ga.js'
type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-788492-5");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
</jsp:root> </jsp:root>

View file

@ -15,24 +15,35 @@
limitations under the License. limitations under the License.
--> -->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1"> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns="http://www.w3.org/1999/xhtml" version="2.1">
<jsp:output <jsp:output
omit-xml-declaration="false" doctype-root-element="html" omit-xml-declaration="false" doctype-root-element="html"
doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.1//EN" doctype-public="-//WAPFORUM//DTD XHTML Mobile 1.1//EN"
doctype-system="http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"/> doctype-system="http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd"/>
<jsp:directive.page contentType="application/xhtml+xml" session="false"/> <jsp:directive.page contentType="application/xhtml+xml" session="false"/>
<jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet> <jsp:scriptlet>response.setHeader("Cache-Control", "public");</jsp:scriptlet>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>No Barcode Found</title></head> <head>
<body> <title>No Barcode Found</title>
<p><b>No Barcode Found</b></p> </head>
<p>No barcode was found in this image. Either it did not contain a barcode, or did not contain one in a <body>
supported format, or the software was simply unable to find it. Go "Back" in your browser and try another image.</p> <p>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> <b>No Barcode Found</b>
</script> </p>
<script type="text/javascript"> <p>No barcode was found in this image. Either it did not contain a barcode, or did not contain one in a
_uacct = "UA-788492-5"; supported format, or the software was simply unable to find it. Go "Back" in your browser and try another image.
urchinTracker(); </p>
</script> <script type="text/javascript">
</body> var gaJsHost = (("https:" == document.location.protocol) ?
</html> "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost +
"google-analytics.com/ga.js'
type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-788492-5");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
</jsp:root> </jsp:root>