|
Newsletters
|
|
|
|
|
Serving Up WAP with Enhydra
Configuring Enhydra for WAP
While the Enhydra distribution comes with the WML 1.1 DTD (found in
/usr/local/enhydra3.0.1/xml/wml/), it doesn't come ready to handle WAP
applications, so we need to do a little tweaking. You have to make some
changes to the main Enhydra configuration files and to our HelloWAP configuration
files, but the changes don't break Enhydra from building standard HTML applications,
it just adds the WML functionality.
Changes to the wml.xcat file
First, open up the wml.xcat file found in /usr/local/enhydra3.0.1/xml/wml/ in your
favorite text editor. Change the HRef="file:..." line to point to the directory you're
currently in. Save it, and now let's make the bulk of the necessary changes to
the stdrules.mk file.
Changes to the stdrules.mk file
Find Enhydra's stdrules.mk file in /usr/local/enhydra3.0.1/lib/. Open it in your
favorite text editor and find the line:
java_pass:: do_xmlc_html_targets dojhtml_targets jpass_subdirs dojpass_targets
Add 'do_xmlc_wml_targets' so it looks like:
java_pass:: do_xmlc_html_targets do_xmlc_wml_targets dojhtml_targets jpass_subdirs dojpass_targets
Now find:
dojpass_targets:: $(JDDI_CLASSES:%=$(PACKAGE_OUTPUT)/%.class)
$(JOLT_CLASSES:%=$(PACKAGE_OUTPUT)/%.class)
$(HTML_CLASSES:%=${PACKAGE_OUTPUT}/%.class)
$(CLASSES:%=$(PACKAGE_OUTPUT)/%.class)
And add '$(WML_CLASSES:%=${PACKAGE_OUTPUT}/%.class)' like so:
dojpass_targets:: $(JDDI_CLASSES:%=$(PACKAGE_OUTPUT)/%.class)
$(JOLT_CLASSES:%=$(PACKAGE_OUTPUT)/%.class)
$(HTML_CLASSES:%=${PACKAGE_OUTPUT}/%.class)
$(WML_CLASSES:%=${PACKAGE_OUTPUT}/%.class)
$(CLASSES:%=$(PACKAGE_OUTPUT)/%.class)
Now find:
#
# Default rule to build classes from HTML using XMLC
#
do_xmlc_html_targets:: $(HTML_CLASSES:%=${PACKAGE_OUTPUT}/%.class)
And under it, add:
#
# Default rule to build classes to WML using XMLC
#
do_xmlc_wml_targets:: $(WML_CLASSES:%=${PACKAGE_OUTPUT}/%.class)
Next, find:
ifneq ($(HTML_CLASSES),)
-rm -rf $(HTML_CLASSES:%=./%.java)
-rm -rf $(HTML_CLASSES:%=./%Impl.java)
endif
And under that, add:
ifneq ($(WML_CLASSES),)
-rm -rf$(WML_CLASSES:%=./%.java)
-rm -rf$(WML_CLASSES:%=./%Impl.java)
endif
(Almost done!) Now find:
#
# Support for XMLC recompilation
#
ifeq ($(XMLC_AUTO_COMP),YES)
XMLC_HTML_OPTS += -for-recomp
endif
And insert 'XMLC_WML_OPTS += -for-recomp' like so:
#
# Support for XMLC recompilation
#
ifeq ($(XMLC_AUTO_COMP),YES)
XMLC_HTML_OPTS += -for-recomp
XMLC_WML_OPTS += -for-recomp
endif
Finally, after the section:
#
# Compile HTML with XMLC
#
Add the following: (You may want to cut and paste this, to eliminate typing errors)
#
# Complie WML with XMLC
#
XMLC_WML_OPTS += -domfactory org.enhydra.wireless.wml.WMLDomFactory
$(PACKAGE_OUTPUT)/%WML.class: $(WML_DIR)/%.wml $(XMLC_WML_OPTS_FILE) $(XMLC_%_OPTS_FILE)
@mkdir -p $(PACKAGE_OUTPUT)
ifeq ($(XMLC_AUTO_COMP),YES)
cp -f $(WML_DIR)/$*.wml $(PACKAGE_OUTPUT)
endif
@CLASSPATH="$(ENHYDRA_CLASSPATH)" ; export CLASSPATH ; \
set -x ; \
$(XMLC_CMD) -class $(PACKAGE).$*WML $(XMLC_WML_OPTS) $(XMLC_$*_OPTS) $(XMLC_JAVAC) $(XMLC_WML_OPTS_FILE) $(XMLC_$*_OPTS_FILE) $(WML_DIR)/$*.wml
$(PACKAGE_OUTPUT)/%WML.class: %.wml $(XMLC_WML_OPTS_FILE)
@mkdir -p $(PACKAGE_OUTPUT)
ifeq ($(XMLC_AUTO_COMP),YES)
cp -f $*.wml $(PACKAGE_OUTPUT)
endif
@CLASSPATH="$(ENHYDRA_CLASSPATH)" ; export CLASSPATH ; \
set -x ; \
$(XMLC_CMD) -class $(PACKAGE).$*WML $(XMLC_WML_OPTS) $(XMLC_$*_OPTS) $(XMLC_JAVAC) $(XMLC_WML_OPTS_FILE) $*.wml
Whew! That's all the changes we need to make on the main Enhydra files, now
let's move to the HelloWAP application and make the necessary changes there.
Changes to config.mk
Open up the config.mk file in your top-level HelloWAP directory. In:
#
# Generate interfaces and implementions
#
XMLC_HTML_OPTS += -generate both
Add 'XMLC_WML_OPTS += -xcatalog /usr/local/enhydra3.0.1./xml/wml/wml.xcat -generate both' to the end like so:
#
# Generate interfaces and implementions
#
XMLC_HTML_OPTS += -generate both
XMLC_WML_OPTS += -xcatalog /usr/local/enhydra3.0.1./xml/wml/wml.xcat -generate both
Now cd into the HelloWAP/helloWAP/presentation directory and open the Makefile.
Change the lines:
HTML_DIR = .
HTML_CLASSES = WelcomeHTML
to
WML_DIR = .
WML_CLASSES = WelcomeWML
And that's it! All the necessary configurations for your new WAP application are made.
Now all we need is a WAP Application to try it out, so let's make one!
Next: The HelloWAP Application
|
|
|