This is the framework to allow callbacks from xmlBlaster to browsers.

SEE: xmlBlaster/demo/http/README
     http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.browser.html
     http://www.xmlblaster.org/xmlBlaster/demo/http/index.html

TODO: Remove all applet specific stuff, this is now seperately handled in package appletproxy

We provide the JSDK from SUN  xmlBlaster/lib/servlet.jar (2.1 (copied from tomcat 3.2.4)?)
in this distribution to allow compilation.

The servlets connects to xmlBlaster using CORBA
and to the browser using a persistent http connection
(using a hidden frame to communicate).

The messages are directly transferred to the browser, which has a
XML parser and notifies the interested browser frames about the callback.
For Javascript examples see the javascript directory.

Create a war file:

  build.sh all
  build.sh deploy_war

and deploy it to tomcat.



****----- Stop reading further: The rest of this file is outdated! -------****


IMPORTANT NOTE FOR SERVLET INSTALLATION:
========================================
We need to run the JVM with the JacORB CORBA library and not
with the incomplete CORBA contained in the JDK.

So you need to:
 - You install orb.properties into 'java.home' and there will be no problem.
or
 - Edit /etc/httpd/conf/jserv/jserv.properties and add (see below as well):
      wrapper.bin.parameters=-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB
      wrapper.bin.parameters=-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
or
 - Include the jacorb.jar file first in the bootclasspath
   otherwise the JDK-internal CORBA is used.

If you run jserv started automatically by Apache, jserv will
look for jacorb.properties and xmlBlaster.properties in the Apache
home directory.
If this is a problem, copy the two property files into 'java.home'
as well.
'java.home' is on my machine: /opt/jdk1.2.2/jre/lib/



Using Suns Web Development Kit (JSWDK):
=======================================
The servlet setup is easy if you use JSWDK.

The JavaServer Web Development Kit (JSWDK)1.0.1 combines the reference
implementation for JavaServer PagesTM 1.0.1 and the JavaTMServlet API (2.1).
   http://java.sun.com/products/jsp/download.html
and
   http://java.sun.com/products/servlet/

Configure it in webserver.xml:
   <Service id="service0" port="8082">
   ....

Start the server:
   startserver

Test it (netscape):
   http://localhost:8082/
   http://localhost:8082/examples/servlet/HelloWorldExample

(The servlets are in examples/WEB-INF/servlets)



Installing and configuring JServ for Apache:
============================================

As i used JServ and Apache to develop this framework here how
i installed and configured it.



http://www.apache.org The Servlet engine

rpm -iv ApacheJServ-1.1-2_RH6x.i386.rpm

Read
   /usr/doc/ApacheJServ-1.1/index.html

Read !!! the good Apache Jserv configuring overview at
   http://www.magiccookie.com/computers/apache-jserv/

1) Edit /etc/httpd/httpd.conf     (Apache 1.3.12)
      LoadModule jserv_module       /usr/lib/apache/mod_jserv.so
      AddModule mod_jserv.c
      <IfModule mod_jserv.c>
      Include /etc/httpd/conf/jserv/jserv.conf
      </IfModule>

      # KeepAlive: Whether or not to allow persistent connections (more than
      # one request per connection). Set to "Off" to deactivate.
      KeepAlive On

      # MaxKeepAliveRequests: The maximum number of requests to allow
      # during a persistent connection. Set to 0 to allow an unlimited amount.
      MaxKeepAliveRequests 0

2) Watch log output:
      tail -f  /var/log/httpd/jserv.log
      tail -f  /var/log/httpd/mod_jserv.log

3) As root
      /sbin/init.d/apache stop
      /sbin/init.d/apache start

4) Test it:
      http://localhost/servlets/IsItWorking
      http://localhost/jserv/

Config files setup:
===================

    httpd.conf -> jserv.conf -> jserv.properties -> zone.properties

5) Where are the xmlBlaster servlets lying around:
   Edit /etc/httpd/conf/jserv/zone.properties

      # List of Repositories
      #######################
      repositories=/home/ruff/xmlBlaster/classes
      or:
      repositories=/home/ruff/xmlBlaster/lib/xmlBlaster.jar


      # Servlet Aliases
      ##################
      servlet.BlasterHttpProxyServlet.code=org.xmlBlaster.protocol.http.BlasterHttpProxyServlet
      servlet.BrowserTest.code=org.xmlBlaster.protocol.http.BrowserTest
      servlet.ReqListServlet.code=org.xmlBlaster.util.servlet.ReqListServlet
      servlet.ReqItemServlet.code=org.xmlBlaster.util.servlet.ReqItemServlet
      servlet.SystemInfo.code=demo.html.systemInfo.SystemInfo
      servlet.PXSLServlet.code=PXSLServlet

      servlets.default.initArgs=org.omg.CORBA.ORBClass=org.jacorb.orb.ORB
      servlets.default.initArgs=org.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
      servlets.default.initArgs=org.xml.sax.parser=com.sun.xml.parser.Parser


   Edit /etc/httpd/conf/jserv/jserv.properties

      wrapper.bin=/usr/local/jdk/bin/java

      wrapper.bin.parameters=-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB
      wrapper.bin.parameters=-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
      wrapper.bin.parameters=-Dorg.xml.sax.parser=com.sun.xml.parser.Parser

      wrapper.classpath=/home/ruff/xmlBlaster/lib/jacorb/jacorb.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/jacorb/logkit-1.2.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/jacorb/avalon-framework-4.1.5.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/jacorb/idl.jar
      wrapper.classpath=/home/ruff/xmlBlaster/classes
      #wrapper.classpath=/home/ruff/xmlBlaster/lib/xmlBlaster.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/servlet-2.0.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/junit.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/omquery.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/xtdash.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/parser.jar
      wrapper.classpath=/home/ruff/xmlBlaster/lib/jaxp.jar

      log.file=/var/log/httpd/jserv.log

      security.authentication=false



6) We need to run the JVM with the jacorb.jar file first in the bootclasspath
   otherwise the JDK-internal CORBA is used.
   There are two variants with Apache/Jserv

   Start the serlvet runtime manually on your xterm (command prompt):

      - switch off the automatic starting in jserv.conf:
        (you can start jserv manually or use the automatic startup with apache
        both runs fine)
         ApJServManual on

         ApJServLogFile /var/log/httpd/mod_jserv.log

      - # Apache JServ secret key file relative to Apache root directory.
        #ApJServSecretKey /etc/httpd/jserv/jserv.secret.key
        ApJServSecretKey DISABLED

      - use this script to start jserv (it is provided in the xmlBlaster/bin directory):
            #!/bin/sh
            properties=/etc/conf/jserv/jserv.properties
            log=${XMLBLASTER_HOME}/jserv_manual.log

            #The jsdk jar file is included already in .bashrc:
            #CLASSPATH=$CLASSPATH:/home/httpd/classes/servlet-2.0.jar

            CLASSPATH=$CLASSPATH:/usr/lib/apache/ApacheJServ.jar

            jaco -Djava.compiler= org.apache.jserv.JServ $properties $1
            #jaco org.apache.jserv.JServ $properties $1 2>> $log

7) Test it
   Start the Apache and then the servlet engine:

      jserv

   Invoke browser test servlet:

      http://localhost/servlets/BrowserTest?mode=push  (Netscape and Mozilla)
      http://localhost/servlets/BrowserTest?mode=multi (MS-IE and Opera)
      http://localhost/servlets/BrowserTest?mode=poll


   Watch log output (if there are problems):

      tail -f  /var/log/httpd/jserv.log

8) For an example see:

      xmlBlaster/demo/html/systemInfo



========= Installing the newer ApacheJServ-1.1.1b1.tar.gz ===================
cd /usr/local; tar xIvf jsdk20-solaris2-sparc.tar.bz2

tar xzvf ApacheJServ-1.1.1b1.tar.gz

./configure --with-apxs=/usr/sbin/apxs --enable-EAPI
or
./configure --with-apxs=/opt/apache/bin/apxs --enable-EAPI --with-apache-src=/opt/apache_1.3.12 --with-JSDK=/opt/JSDK2.0

make

make install   (as root)

Installs to=====>
/usr/local/jserv
/usr/local/httpd/logs
/etc/httpd/jserv/
/usr/lib/apache/ApacheJServ.jar

Put this line somewhere in Apache's httpd.conf file:
   Include /etc/httpd/jserv/jserv.conf

   # MaxKeepAliveRequests: The maximum number of requests to allow
   # during a persistent connection. Set to 0 to allow an unlimited amount.
   MaxKeepAliveRequests 0

Test it:
http://localhost/servlets/Hello

See:
http://java.apache.org/faq/




======= CACHING and MSIE ===========================================
   Page refreshes well with HTTP 1.1 Expires: -1 header.

   The information in this article applies to:

     Microsoft Internet Explorer versions 3.02, 4.0, 4.01, 4.01 Service Pack 1, 5 for Windows 95 
     Microsoft Internet Explorer version 5 for Windows 98 
     Microsoft Internet Explorer versions 4.0, 4.01, 4.01 Service Pack 1, 5 for Windows NT 4.0

SYMPTOMS

  When you use the <HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> metatag in the header section at the
  beginning of an HTML Web page, the Web page may still be cached in the Temporary Internet Files folder. 

  CAUSE

  A page that Internet Explorer is browsing is not cached until half of the 64 KB buffer is filled. Usually, metatags
  are inserted in the header section of an HTML document, which appears at the beginning of the document.
  When the HTML code is parsed, it is read from top to bottom. When the <HTTP-EQUIV="PRAGMA"
  CONTENT="NO-CACHE"> metatag is read, Internet Explorer looks for the existence of the page in cache at
  that exact moment. If it is there, it is removed.

  RESOLUTION

  To properly prevent the Web page from appearing in the cache, place another header section at the end of the
  HTML document. For example:

  <HTML>
  <HEAD>

  <META HTTP-EQUIV="REFRESH" CONTENT="5">
  <TITLE> Pragma No-cache </TITLE>
  </HEAD>

  <BODY>
  This is an example of where to place the second header section<br>
  so that the "Pragama, No-Cache" metatag will work as it is supposed to.<br>
  </BODY>

  <HEAD>
  <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
  </HEAD>
  </HTML>








