Web Servers To Handle Java Servlets And WAP?
Yousef asks: "We're trying to develop a WAP enabled Webserver, that can work with Java (Servlets). Currently the only working option is M$ IIS running the New Atlanta plugin. Now I'd rather NOT run IIS, so if anyone else has a solution to this, it would be much appreciated. We've tried Inprise IAS and Apache JServ (We're deploying to a Sun Solaris box). Any help would be nice. Getting the servlets to run is quite easy -- The problem is getting them to work with WAP!"
"WAP creates its own session ids, and that stops other serverside objects from sharing the same objects.
In short, we have an existing Servlet based system. Now we are trying to incorporate WAP into it (WML). It seems to us as though WML passes cookies around differently to HTML: HTML stores them with the browser, and WML stores them on the server. We've tried just about every server under the sun, and they all behave in the same way."
Try the new version of Roxen. Support for PHP4, Servlets, WAP, Pike scripts etc. etc. http://www.roxen.com
See above responses.. It's all about cookies..
-- I'm the root of all that's evil, but you can call me cookie..
Ahh, I had never even thought about using cookies on WAP devices. Personally, I've always based the session information on data contained within the form, aka, URL based, along with form attributes.
Now it starts to make sense..
-- I'm the root of all that's evil, but you can call me cookie..
I'm confused. Nearly anything that can serve HTML can serve up WML, provided the content type is configured correctly, and it spits out valid WML. Why would one need a specific API set to spit out WML code?
-- I'm the root of all that's evil, but you can call me cookie..
The cool thing about Engydra (that I'm suprised the original poster didn't mention) is that the development is entirely opensourced. It's sponsored by lutris. They make their money off support contracts for this thing. I've seen some demos of the product, mostly just using cell phone emulators (that I think they ship with enhydra, or they will very shortly), one java, and two win32's, so you can test all your wap apps before fully deploying them. There's also a sample app or two in there. go check them out .
-Peter
We use Apache together with Resin to create cookie-less session management. Almost all servlet/JSP engines have support for creating sessions this way; the critical thing to remember is to *not* just write links the normal way, but to use the response.encodeURL method to make sure the servlet engine appends the ";jsessionid=" string to the URL in all links.
Besides, check out the rest of their website. All around cool guys...
-------
Warning: Slashdot may contain traces of nuts.
Wapsody is a Java WAP development environment. Might find that worth looking at too.
Anyway, I'm sure that there are plenty of other options, but I've used both of those and found them to be of good quality and performance (Orion being the fastest).
------ Jess
Throw the bums out!
I don't know the particulars of your application, but by decoupling the content from the presentation, you gain an enormous amount of flexibility and power.
By creating content as XML, you can now create XSLT scripts to transform that pure content into an arbitrary presentation form. So you can write an XSLT script that transforms your XML content into XHTML or into WAP. This is powerful because now you can serve multiple different requestors with the same content.
There is a project called Cocoon (from the Apache Software Foundation) that does this exact thing. Cocoon itself is a servlet, so it gives you a choice of what servlet engine to run it on. It provides good caching, XSLT transformations, and even a "sitemap", which is a central location for binding look&feels to content.
There is an open source servlet engine that has built in XSLT processing, XPath processing, and XML parsing. It is extremely fast and has a lot of features. It is Resin. I recommend this one. Because this is a full blown servlet engine, you have JSP processing, session support, and it is even a small web server.
In either case, as the poster above said, the real point of XSL is that you don't have to be a full fledged programmer to use it. While XSL can definitely be painful, I think it is better than writing a computer program in {Perl,Java,Python,*} to do the same thing. Unfortunately, it's not easy enough for just anyone to pick up, so it doesn't completely allow for designers or HTML coders to assume all control of layout without an engineer showing them the ropes, unless of course they are particularly bright and can pick it up.
----------
In a real emergency, we would have all fled in terror, and you would not have been notified.
A better approach is to statically do the base XML to HTML conversion, with JSP (or PHP, mod_perl, whatever) to introduce the final dynamic content. (I.e. convert the XML to a JSP with scriptlet tags for the true run time dynamic content.) Caching algorithms would alleviate this, but I don't see the advantage of doing it runtime, when it works just as well doing it statically. Even with caching, your performance will clearly be better.
----------
In a real emergency, we would have all fled in terror, and you would not have been notified.
I think something like XML/XSL at compile time, followed by JSP/PHP/whatever at runtime, works better, because you have the same content/design separation as XMLC, but not the performance implications.
BTW, even though you're speaking of WML in particular, I'm speaking of content serving in general.
----------
In a real emergency, we would have all fled in terror, and you would not have been notified.
There is a difference between static and dynamic content, vs. how static content is generated. For example, a basic web page that doesn't vary for anyone could be generated on the fly with XMLC/Cocoon, but it's still essentially static content. If the page shows the current time on each access, then it's dynamic, even if it's a simple PHP HTML template.
So, for basic content generation, I think XML to HTML is a great idea. XMLC is one solution. XSL is another. The problem with XMLC is that it only works at run time, which is a non-trivial performance hit. (Especially when you consider static content, that can no longer be served as a plain HTML file, and has to go through a servlet engine.) With XSL, and perhaps other technologies, the XML to HTML processing can be done at build time, resulting in HTML files that can be served faster.
The reason I mention JSP or PHP is because then you have to insert dynamic content into the resulting HTML, and at that point, you need JSP/PHP/whatever. But keep in mind that if you apply the content/logic separation with JSP/PHP clean, then making sure that your XML to HTML translation adds the right JSP tags is easy. So, you still maintain your content/logic separation throughout the whole process. And you get an additional performance boost over XMLC because you are simply outputting new strings, as opposed to manipulating a DOM tree, which is harder and slower.
Bottom line: XMLC combines static content generation with dynamic content generation. Both are slow, because (a) it happens at run time, and (b) DOM manipulation is slow. My suggestion is to move static content generation to build time, and use a simpler technology, like JSP, that gives you the same content/logic separation, to do the dynamic stuff. This still involves using XML to keep the distinction between logic and presentation nice and clean.
----------
In a real emergency, we would have all fled in terror, and you would not have been notified.
While this isn't a possible solution for the original poster, because he's tied to servlets, it might be a possible solution for others.
PHP allows for effective session management, and with a bit of work, I'm sure you could make it compatible with the WAP cookie things. It might even be possible to do so without having to mod the base system.
There are also several good looking WAP/HTML gateways either in early production or late development, and I'm sure those will be interesting.
Note that I have not looked much at either the gateways, or the possability of server side cookies in PHP. I'm just throwing the idea around incase it might help anyone.
Terje Elde
http://www.enhydra.org Has a servlet engine (built around tomcat) with an Apache/ISS/Netscape based load balancer. Built-in support for WML via an extension to their GPL'd XMLC technology.
Cookies and wap don't go together afaik. You should make the session-id in a hidden value in the wmlfile. You can do this with postfield. You'll have to make sure your sessions time out and some more.
But it is the way to go.
Also. You've got to look out for & and $. The need to be encoded no matter what. Or the gateway will go berserk (i.e: not respond)
-- Thorkild
By the way, here is some more info :n hydra.html, with a nice mini-howto and a HelloWAP application !
http://www.wirelessdevnet.com/training/WAP/wape
Roxen Web Server (former Roxen Challenger) is a quite good choice (amongst many others it has native servlet/Java modules support and speaks WML natively (also knows to generate WBM)). Plus, it's GPL'd.
Petru
In case anyone is interested, you can use this servlet to insert the session ID into the URL and filter the ID out of the path, even if you use a WML file. This doesn't seem to work in the Phone.com simulator, though. It works fine in the Nokia. I think it may have something to do with the Phone.com server supporting cookies, but I can't be sure. If anyone gets it to work, let me know. I'll keep playing with it, too.
/appdir " +fullPath).
-------------------------------------
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class FakeSessionServlet extends HttpServlet
{
public void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
response.setHeader("Content-Location", request.getRequestURI());
String extraInfo = request.getPathInfo();
// Locate the next slash in the path (assume there is one at position 0)
int slashPos = extraInfo.indexOf('/', 1);
if (slashPos > 0)
{
// Get the subsession id and the real path to access
String virtSession = extraInfo.substring(1, slashPos);
String fullPath = extraInfo.substring(slashPos);
if (fullPath.indexOf(";jsessionid") < 0)
{
fullPath = fullPath + ";jsessionid="+virtSession;
}
// Assume the real path is under
getServletContext().getRequestDispatcher("/appdir
forward(request, response);
}
}
}
---------------------------------------------
Using Resin, you need to add the following items to your resin.conf file:
---------------------------------------------
<servlet-mapping url-pattern='/appsession/*' servlet-name='fake-session-servlet'/>
<servlet servlet-name='fake-session-servlet' servlet-class='FakeSessionServlet'>
</servlet>
<path-mapping url-regexp='^/appdir/' real-path='h:/jprogs/sesstest/'/>
<mime-mapping>
<extension>.wml</extension>
<mime-type>text/vnd.wap.wml</mime-type>
</mime-mapping>
---------------------------------------------
Now, you send your phone to this main page that redirects you through the FakeSessionServlet to get to the real main menu:
---------------------------------------------
<%
response.sendRedirect("/appsession/"+
session.getId()+"/Menu.wml");
%>
---------------------------------------------
The menu.wml file looks like this:
---------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="mainmenu">
<p>
<a href="Test1.jsp" title="Put Into Session">Put Into Session</a><br/>
<a href="Test2.jsp" title="Get From Session">Get From Session</a>
</p>
</card>
</wml>
---------------------------------------------
The Test1.jsp file looks like:
---------------------------------------------
<%@ page language="java" contentType="text/vnd.wap.wml" %>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<%
session.setAttribute("foo", "Bar!");
%>
<wml>
<card id="test1">
<p>
I put <%= session.getAttribute("foo") %> into the session.
<a href="Menu.wml" title="Back to Menu">Back To Menu</a>
<a href="Test2.jsp" title="Get From Session">Get From Session</a>
</p>
</card>
</wml>
---------------------------------------------
Test2.jsp looks like this:
---------------------------------------------
<%@ page language="java" contentType="text/vnd.wap.wml" %>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="test2">
<p>
I found <%= session.getAttribute("foo") %> in the session.
<a href="Menu.wml" title="Back To Menu">Back To Menu</a>
</p>
</card>
</wml>
---------------------------------------------
You just need to explicitly store the session ID in a cookie. After the section:
if (fullPath.indexOf(";jsessionid") < 0)
{
fullPath = fullPath + ";jsessionid="+virtSession;
}
Add this line:
response.addCookie(new Cookie("jsessionid", virtSession));
Frogg mentioned that he has something that did this and sure enough, that was the trick. Thanks for sharing, Frogg!
WAP and WML are things that allow webpages to be seen over portable conncections like web enabled cell phones and PalmPilots...From what little i have read about it, it takes the HTML and strips thing like img tags and such and parses it into a form portable devices can understand
You should definitly check out the Cocoon project. XML, XSL/T and whatever you might need.
Unable to read configuration file '/bigassraid/htdig//conf/14229.conf'
Geocrawler error message.
If you can go the PHP way there is the option of going with the hybrid web server HAWHAW - HTML and WML Hybrid Adapter Webserver which delivers content depending on the browser capabilities.. so you no longer have to create separate HTML and WML pages to deliver similar content..
.. wonder if it helps the the person who wanted to use Servlets/JSP on a non IIS server but this info might be useful to others,
Check it out
Cheers
-/ramas
- ramas opines !!
To use URL rewriting all of the links of the template need to be interpreted by a servlet. This can be done one of two ways, by using a HTML parser to find all of the links and manipulate them, or by using some kind of tag in your template to specify a link. The first seems way to CPU intensive to scale well, and the second is going to be nasty for the web designers.
The concern that the first might be "way too CPU intensive to scale well" presupposes that the page will be parsed by the server on-the-fly every time it is serverd.
Why not precompile it, having the compiler insert the tags?
Then the web authors can work on normal HTML, directly or using arbitrary tools. But the server can work with the fast, tagged form.
There are several ways to manage the compilation so the designer's process is either unmodified or requires just an extra click or so to view the page-under-construction as it would be seen externally.
Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
Judging from the Wireless Session Protocol Specfication at http://www.wapforum.org/what/technical.h tm it looks like most of the session handling stuff is
geared to handling the connection between the phone and proxy.
Well, of course! That is because the air interface (or radio-transmissio part) is located in that segment, and which is the source of interruptions, timeouts, lost packets and delays. The air interface is much less reliable that the Internet in general (we ae talking celular network here, not (yet) 3G), so all those complicated handshakes, receipt and delivery confirmations explained in the WSP (wireless session protocol) specs make tremendous sense. The WAP protocol stack is a little bit like X.25, but at even lower speed.
However, WAP is also scalable, it's designed to support future air transmission techniques, coming with G3, like GPRS, for example, or some of those non-cellular radio networks you already have in some US cities (Ricochet, for example).
Sigged!
What is so difficult about it? I actually have signed a NDA so I am not going to tell details here, but our solutions all use Netscape Enterprise Server, but I have also used Apache on Linux to serve WAP. Actually WML and WMLS. The logic behind generating WML and WMLS is the same old **** that today generates dynamic HTML.
Really no big deal, just the syntax is different, and the mind has to be set to think little (cell phone display and keypad).
Sigged!
WAP is either a White Anglo-Saxon Protestant... or go to Wapforum.org
hehe, OOPS.
(my apologies to all of the WASP's I just insulted)
(As near as I can tell, the license agreement is meaningless; perhaps someone with more legal understanding can explain what they get from this that is not already granted to them by law ?)
You might also be interested in this slashdot article which talks about patent and licensing related issues in WAP.
On the whole, there seems to be enough uncertainty associated with the WAP licensing/patent issue that I decided not to use it for what I was working on.
The thing to realize is that in WAP you have a proxy/gateway sitting between the cell phone and web server.
Judging from the Wireless Session Protocol Specfication at http://www.wapforum.org/what/technical.h tm it looks like most of the session handling stuff is geared to handling the connection between the phone and proxy.
In a perfect world we'd simply use cookies to track session just like in HTTP, but sadly these don't seem to work reliably yet in WAP. In the meantime, you'll have to resort to either passing session identifiers as form variables or else in the URL.
For anyone interested, I'm working on an overview article on how to add wireless users to your web service. The draft lives at http://dev.arsdigita.com/asj/wireless/.
They are currently in the process of upgrading to the servlet 2.2 API, and their FAQ details the finer points of running Enhydra with Apache and Apache JServ.
All in all, it's a fine solution. It took me just a little bit of research, but once I got it up and running, I found that it was very reliable, and more than ample speed-wise.
Hope this helps...
Nearly anything that can serve HTML can serve up WML
Serving up WML is easy (as you say). WAP needs some extra stuff doing though, mainly to deal with handling session state in an entirely different way to the traditional HTTP (and thus the cookies are different too).
Think about it. Phones have fixed IDs (from the telco network), but nowhere big enough to store client-side cookies.
Forgot to mention:
There are also multiple Servlet Engines available.
There is New Atlanta Servlet Exec, there is IBM Servlet Engine used in WebSphere, there is a servlet engine from Sun, there is Caucho servlet engine for Apache *nix or JServ, there is a webserver Jasper that currently confirms with Servlet Engine 2.1 specifications, there is Allair JRun, there is 10BaseJ servlet engine, there is an engine called cocoon.
Basically there are so many more of them now than there were 2 years ago when I started looking at New Atlanta that it's easy to loose your head.
All you really need is an engine that supports Servlet Engine 2.2 specifications and that is fast reliable and runs well under your OS. Make sure that if you get an engine that it can be pluged in as a filter into your current WebServer, otherwise you'll have to get yourself a whole application server or another WebServer.
You can't handle the truth.
You can use the following solutions:
www.davinci.ca (here is the competitive analysis document I had to write: download)
www.724.com
www.microstrategy.com
www.zope.com
www.orionserver.com
The fact is that neither phones nor PDAs currently can not accept cookies. Obviously this is a memory and bandwidth restriction and a good one - imagine you have a phone and every site you visit sets a cookie on it, pretty soon you'd run out of space.
To keep your user's session you can use either URL Rewriting technique or a server side Session identifier (the later one is harder to implement for unregistered users.) Don't forget that a user can have more than one session at a time on any server with multiple devices.
Look at 'resin' if you need good authentication and session implementations.
Good application servers also provide all possible techniques for storing session: Cookies, URL Rewriting and server side sessions, so check out these: www.weblogic.com (www.bea.com), www.gemstone.com, www.orionserver.com, www.zope.com, www.websphere.com
The product I am working on currently is an XML server that allows easy implementation and separation of business logic from layout module and has a granular cache for storing data results from varios functions for all users, so check out 'Trinity' project from www.davinci.ca
In general, there are many solutions but none will help you to store the cookies on the mobile device itself.
Good Luck.
You can't handle the truth.
Just have a look on this link http://www.bea.com/press/releases/2000/0508_Nokia. html
I hope you want to find out how to setup a webserver to serve WML (Since the WAP part happens after a WAP gateway, pulls the WML content from a WML webserver and sends it over the Internet). I have it working and have tested this against real and emulator phones. I run Apache with JServ. In simplest of requirements, all it requires is setting up the mimetypes (atleast for vnd.wap.wml and possibly 4/5 more). Then in your servlet you will setContentType("whatever you want to server"). Note that it is also possible to setup the webserver to intelligently serve pages depending on the end-agent (browser?!) and serve either wml or html etc... in Apache.