/* zxidhlo.java - Hellow World Java/Tomcat servlet script that calls libzxid using JNI * Copyright (c) 2007 Symlabs (symlabs@symlabs.com), All Rights Reserved. * Author: Sampo Kellomaki (sampo@iki.fi) * This is confidential unpublished proprietary source code of the author. * NO WARRANTY, not even implied warranties. Contains trade secrets. * Distribution prohibited unless authorized in writing. * Licensed under Apache License 2.0, see file COPYING. * $Id: zxidhlo.java,v 1.6 2007/02/23 05:00:29 sampo Exp $ * 12.1.2007, created --Sampo * * See also: README-zxid section 10 "zxid_simple() API" */ import zxidjava.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class zxidhlo extends HttpServlet { static { System.loadLibrary("zxidjni"); } // CONFIG: You must have created /var/zxid directory hierarchy. See `make dir' // CONFIG: You must edit the URL to match your domain name and port static final String conf = "PATH=/var/zxid/&URL=http://sp1.zxidsp.org:8080/zxidservlet/zxidHLO"; //public static void main(String argv[]) throws java.io.IOException { } public void do_zxid(HttpServletRequest req, HttpServletResponse res, String qs) throws ServletException, IOException { String ret = zxidjni.simple(conf, qs, 0x1d54); System.err.print(ret); switch (ret.charAt(0)) { case 'L': /* Redirect: ret == "LOCATION: urlCRLF2" */ res.sendRedirect(ret.substring(10, ret.length() - 4)); return; case '<': switch (ret.charAt(1)) { case 's': /*