Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Web Servers To Handle Java Servlets And WAP? 111

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."

This discussion has been archived. No new comments can be posted.

Webservers Capable of Handling Java Servlets?

Comments Filter:
  • by Anonymous Coward on Sunday May 21, 2000 @08:37AM (#1057988)
    Try the new version of Roxen. Support for PHP4, Servlets, WAP, Pike scripts etc. etc. http://www.roxen.com [roxen.com]
  • This is a terrible way to maintain sessions if you are worried about caching. Cookies are the best with regards to caching, because the unique session string will require a cache to store a copy of the document even if it is identical to other pages.

    just something to think about..

    cheers,
    -o
  • It's too little, too late. It's not very userfriendly and it's a kludge on top GSM (or whatever you are using) 3rd generation [nokia.com] mobile systems like GPRS [mobilegprs.com] are around the corner, and IMHO we (developers) need to focus on them, rather than that horrible kludge the WAP is. Don't waste your time on WAP...
    Just my 2c

    J.
  • See above responses.. It's all about cookies..
  • 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 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?
  • 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 [lutris.com]. 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 [enhydra.org] them out .

    -Peter
  • > I didn't know /. had a WAP page... what is the URL?

    www.slashdot.org should work

    HTH ;)
  • > This together makes WAP that much faster and better suited for use over a wireless connection than HTML.

    Yeah. And if there would be devices/browser software that would fully support it and gateways that wouldnt suck it might actually someday be usable.
    Just sad that by that time the devices probably dont need to rely on the slow GSM connections anymore and the displays and processors should be big enough to support normal HTML rendering.
  • 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 <a href=".."> links the normal way, but to use the response.encodeURL method to make sure the servlet engine appends the ";jsessionid=<sessionid>" string to the URL in all links.
  • by Jacco de Leeuw ( 4646 ) on Sunday May 21, 2000 @07:34AM (#1057998) Homepage
    These guys [gbdirect.co.uk] have Wapped their geographic search engine, so that you can ask your phone to lookup the nearest pub or curry joint [somewherenear.com] :-)

    Besides, check out the rest of their website. All around cool guys...

  • Wow, I never thought we were cool - but thanks to Jacco for saying so. If anyone wants to pick up the php3 templates we use on the site, I've packed them into a gzipped tar archive and put them on the site at this location [somewherenear.com] - they will extract into the current directory, so be careful where you unpack them. They aren't a lot of use by themselves except as a source of ideas, but please feel free to explore them - and let me know if you spot any errors! The server will lie and tell you the archive is in text/plain format; just click on `save as' and then unzip it in the normal way. It's only about 9K.

    Mike
  • One thing you can do is use a little javascript to strip any HTTP GET variables from the URL and add them to any hyperlink on the page. All links would then call a Javascript function instead of simply redirecting to a new URL. That Javascript function would be responsible for assembling the redirect URL, including the HTTP GET variables that were decoded from the original URL. It's a pain, but you only have to write the code once, and it *does* work...

    That said, does WAP include ECMAscript (essentially, standard Javascirpt)? If not, then this solution won't work for WAP devices...
  • ... It's tough to track 20 people all coming from the same IP address :)

    php4 [php.net] has extensive session support - you can encode the session info into the URL, or as a cookie, or even use http authentication. That would go a long way towards ensuring uniqueness.

  • by Zombie ( 8332 ) on Sunday May 21, 2000 @07:50AM (#1058002) Homepage
    Check it out [ibm.com]. It can translate existing HTML pages to WML on the fly, either within your servlet framework or as a proxy in front of (and therefore totally independent of) your webserver. It will scale down GIFs or take them out, take out stuff that isn't supported by the target device such as javascript, applets etc.

    Wapsody [ibm.com] is a Java WAP development environment. Might find that worth looking at too.

  • I didn't know /. had a WAP page... what is the URL?

    Also, you can go through the google search engine, which will translate the site into wml...

  • I've seen the article [xml.com] to which you are referring with this remark. He makes some very interesting points with regards to the fact that anything possible in XSL could also be done with Stylesheets and programmatic translations.

    Basically, these views are correct, however, they also seem to miss the point of XSL. :-) XSL is not, nor is it likely to ever be a full-fledged programming language. XSL is a declarative translation language used for converting from XML to other forms of XML and/or HTML.

    XSL separates the programming logic of the site from the display logic in a relatively clean manner. The advantage of this is that it allows Designers to use advanced graphic oriented tools such as eXcelon Stylus [exceloncorp.com] to develop the look and feel of the site, rather than relying on developers.

    You can see an example of an entire site run by XSL/XML at HeadlineW atch.com [headlinewatch.com], where it provides all HTML content, as well as RSS and WAP feeds.

  • I've used several servlet engines in the past, and here's what I've found to be useful:
    • New Atlanta ServletExec 3.0 [newatlanta.com] - I've seen this one used succesfully before, and it was even used for a while with Javalobby.org [javalobby.org] as a plugin for Apache. It should be platform independant, but it is dependant upon you using a supported webserver (Apache, iPlanet, IIS, etc).
    • Orion Server [orionserver.com] - This is a 100% Java Webserver with built-in support for XML/XSLT/WAP/etc. It also fully supports servlets (of course) as well as JSPs and EJBs. This is the product currently used by Javalobby [javalobby.org]. Overall, I think that it's a great solution. The performance of this solution is excellent.

    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
  • by marvinx ( 9011 ) on Sunday May 21, 2000 @07:38AM (#1058006) Homepage
    Have you considered developing your web site around XML? There are two very good products out there (both open source) that enable the XML+XSLT=XHTML/WAP/PDF/whatever paradigm.

    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 [apache.org] (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 [caucho.com]. 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.

  • The current generation of WAP 1.1 gateways don't deliver cookies to the micro-browser, as there isn't the memory space on the handset.

    Whilst some gateways, most notably Phone.com's, will manage cookies for you, you're best off using the good old URL extension model for handling session information.

    Dynamic URL generation is a given here for any HREFs, though alternatively you could hack around with postfields and the like. You will need to be careful with your dynamic pages not to exceed 1387 bytes per deck of WMLC at the gateway, if you wish to deliver to Nokia 7110s...

    This means that you can use any servlet engine and web server combination. I'd recommend reading Steve Mann's "Programming Applications with the Wireless Application Protocol" [Wiley 2000] as a good starter. It's a bit too focused on Phone.com, but still worth a look at how to develop WAP servlet applications.

    In the future WAP 1.2 devices and their associated gateways will support cookies and other session mechanisms through the use of the WIM, an enhanced SIM with PKI features. However, don't expect them for 8 months or so - and then be prepared to comletely rewrite your applications!

    S.
  • Yes and no.

    If you are looking a year or so out, then possibly as we transition to MExE from WAP for 3G devices, but there'll always be a place for WAP no matter what the wireless layer - purely because it is designed to work with the familiar handset.

    EPOC devices will be part of the transition through GPRS and EDGE - but the SDKs for Quartz are not even in closed beta yet...

    It's my job to think about mobile device strategy, and there's a lot happening that you don't know about. However the first GPRS networks will only run at 30Kbps and there's not really any scope for more complex devices until we hit EDGE roll out towards the end of 2001 - and that's unlikely to occur now with the up front costs of 3G licences...

    S.
  • Slashdot pages will be very difficult to WAP-enable without a major rearchitecture, as they'll go over the deck size limits of 1400 bytes of compiled WMLC very easily...

    And if you've got a 7110 you're limited to 1387 bytes of deck due to a nasty bug in the Human Technology micro-browser - one that's taken over 20 versions of firmware to fix!

    S.
  • Just because whatever it is that he has works does not mean it's a good solution. There are endless reasons why just because something works dosn't mean it's a good way to get something done. It may not be reliable, it may force one to write code that isn't maintainable, he may be more comfortable working with a Unix based OS, it may not be scaleable, et cetera.. I hope you'll agree that these are valid considerations.

    In addition to the above, one may develop a distrust of a manufacturer because of bad experiences in the past, even when the product is indeed viable in its current state. My father stopped buying Pontiac cars when his third Pontiac developed the same premature problems that the first two had. Can you blame him? I've spent the better half of my professional life learning the bitter lesson that you can't depend on Microsoft products for one reason or another, after starting out as a Microsoft supporter. I'd consider myself a fool to continue to give Microsoft a chance, when in every single experience with them in the past they've severely disappointed me. Can you blame me?

    If you think the only reason people stay away from Microsoft is that they're just Microsoft haters and for no more specific reason than jealousy or mistrust of big companies, then you've been living with your head in the sand (or you don't have enough general computing experience to know better.)

    One more point, what's wrong with hating Microsoft anyway? Why should you even care if someone does? It's just a software company! Do you have Microsoft stock perhaps? If you want to rail against bigotry, fight racal or sexual bigotry and do some good instead.

  • WML is actually a lot more than simply a cut down version of HTML. While it is true that gateways exist to take HTML pages and turn them into WML, WAP in reality does a lot more than that.

    First of all, WML is designed for presenting data on unorthodox screen sizes, and uses a "card" system to show pages on a small screen. It is a lot more efficient, but more limited at present, than HTML.

    Secondly, the WAP gateway takes this WML content and compiles it, so that it is firstly much smaller, and secondly it executes on the client device much faster (remember, most mobile phones aren't yet endowed with Pentium III Xeon performance!)

    This together makes WAP that much faster and better suited for use over a wireless connection than HTML.

    David
  • I have implemented a server-side dynamic HTML thingumy in the past which encoded sessionId stuff into the URL

    There is no such thing as server-side DHTML. Unless you're talking about dynamically-generated pages, which is exactly what the person you're replying to had a problem with.

    and to allow people to browse off-site and return to the same session we dropped a cookie which also had the sessionId in it

    The whole point of this discussion was: in the absence of client-side cookies, how can we maintain state? Your solution: use cookies!?!

    HTH

    IDTID (I Don't Think It Did)

    -bp

  • Great standards compliance (J2EE), performance (check their benchmarks page) and written in 100% Java.

    Markus
    --

  • That's just dandy until you start working with a template system. One of the best parts of the servlet model is the ability to use templates editable by web designers with code in a servlet. 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.

    At lest, that's the problem I've found using URL rewriting as session management. It's not so bad when using embedded HTML in your servlet, but that is just a bad way to do servlets in the first place.

  • by Fats ( 14870 )
    You might want to look at MMBase [mmbase.com].
    It's a very nice open source dynamic content management system. It seems to be wap enabled also.
  • by kinkie ( 15482 )
    Roxen (www.roxen.com, distributed under GPL) could be able to handle both Servlets and WAP.
    I have never tested those capabilities though.
  • The main problem with this is that then ALL your pages have to be JSPs, because any static HTML will not have the right sessionId parameter. If the user goes to any static page, then follows links back to a JSP page, the session will be lost.

    Anyone know any way around this?
    ----------

  • Another important point regarding XSL is that XSL doesn't preclude you from using CSS. Most of the XSL I've done results in HTML with CSS in it. The above referenced article also forgets that, right now, CSS and DOM implementations are horrible, so for the next few *years*, it will not be possible to rely strictly on CSS and DOM on the client. Clients need to see more pure HTML, with very few advanced CSS/DOM features, because they simply don't work uniformly. So, it is better to put more formatting into the initial XML transformation layer. For now.

    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.
    ----------

  • While XMLC is a great idea, it is a performance hog, because you are generating a whole DOM tree, manipulating it, then displaying it, at run time. I don't know if Enhydra has introduced caching mechanisms, like the ones Apache's Cocoon [apache.org] is using, to alleviate this; right before I went off to another project, I was about to build this in.

    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.
    ----------

  • Ah, good idea. You're right about WAP devices, though, I also have no idea if they support client side scripting. I doubt they support JavaScript. In that case, it may be better to go with a server side solution, like the one mentioned above in reply to my question.
    ----------
  • How do you generate the DOM tree beforehand? XMLC generates the Java class for the DOM tree at compile time, but it's still instantiated at run time, and it's a pretty heavy weight object. Also, the DOM manipulations at run time are much more expensive than simply outputting different text for the dynamic HTML.

    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.
    ----------

  • I think you missed my point... I wasn't saying that JSP/PHP by themselves were good enough to substitute for XMLC. I'm saying that other XML to HTML solutions, combined with JSP, are better.

    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.
    ----------

  • 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.
  • Scaling is a function of the workload, not of the CPU. If the CPU speed is half or twice, scaling is still proportionally the same. In other words, if you need twice the CPU to get the job done because the code performs at half the speed, then that's going to be the case at any workload level. What a higher CPU usage of something like HTML parsing will do is just make your tolerance threashold be reached sooner. Funny how it is people will switch and say CPU is not the issue if I bring up how their favorite tool is a CPU hog.

    So.... get the best of both worlds. What you need is pre-parsed HTML templates that generate your servlets. Parse the HTML once, and the servlet code then "identifies" the session key insertion points by means of its (now) built-in code. Then compile the servlets down to binary once debugged.

  • BTW, Enhydra *is* open source. It supports session via cookie/URL rewriting. Session is not tied to IP address.
  • Actually, you generally generate the DOM tree before hand. It's true that loading a DOM tree can be taxing, but I wouldn't guess that your average WML document (meant to be displayed on a cell phone) is going to be of the magnitude that would put much of a strain on even the lamest of app server boxes. Even with a bit of performance hit, the design clarity that something like XMLC provides (as opposed to embedded code-presentation mixes like JSP, PHP, etc.) is worth it.
  • You are right that a DOM tree must still be instantiated at runtime. The point I was making (as you have gathered) is that you don't have to parse and create the DOM from scratch at runtime.
    When talking about how expensive a procedure is, you need to consider both the runtime performance/resource utilization as well as the cost of maintenance. You say that JSP/PHP give you the same content/design separation as XMLC, but that just isn't true. I have done a fair share of JSP in which the presentation has changed rapidly on top of static business logic. The bottom line is that these technologies just aren't good for that. Somewhere/somehow somebody who knows about programming has to get in the mix. Code (albeit small chunks) *are* embedded into the middle of the presentation.
    XMLC, on the other hand, allows for the kind of separation in which a static HTML (or WML) mockup can be uploaded to a server by a designer and changes will automatically take effect. The cost to maintain XMLC based projects vs. JSP based projects is significantly different.
    On the topic of expensive operations, just how expensive is DOM manipulation? When you already have the document parsed and the DOM created, where do you pay the performance prices? I haven't done a lot of benchmarking (have you?), but it would seem to me that the only real price you would pay is that of memory consumption. Otherwise, you're talking about loading an existing class into memory and executing lightweight methods on it. With the right sort of caching, I don't seem this as being much of an issue.
  • by chadfowler ( 17679 ) on Sunday May 21, 2000 @07:23AM (#1058028) Homepage
    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.
  • You might have said that about HTML about 6 years ago too...

    I have to disagree, WAP/WML has a very good design, and I think that we'll see it for quite a while. There's only going to be more appliances that are internet ready, which require very prudent use of requests. The "card" design of WML allows you to send multiple "pages" to these devices in one request.

    It likely will be extended in the near future to add new features like it's bastard cousin HTML. I see devices becoming more empowered, but I think WML will be used for quite some time. I think it has far too much momentum for it to just die out.

  • Beware InstantDB. Tried to use it a couple of months ago with a ad server and had nothing but problems. Major memory hog made worse by memory leaks and poor performance. I switch to MySQL and performance tripled and it hasn't crashed since.

  • 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)
  • www.orionserver.com [orionserver.com] is one of the best J2EE servers out there. It will support servlets, JSP, EJB, JNDI, etc..
  • By the way, here is some more info :
    http://www.wirelessdevnet.com/training/WAP/wapen hydra.html, with a nice mini-howto and a HelloWAP application !
  • The WAP caching model is quite different to the web caching model. If multiple 'pages' share the same URL then the 'page' will be loaded from the device's cache rather than the web server. Servlets are one of the few forms of dynamic web content that insist on having a single URL (not counting the ?bla=bla stuff that is tacked on the end).

    The solution is to ensure that your 'pages' (I'm quoting this since the correct WAP term is 'decks') are not cached. There are several ways to do this. I suggest that you read the WAP FAQ at wap.colorline.no/wap-faq [colorline.no].

  • by ppetru ( 24677 ) on Sunday May 21, 2000 @11:32AM (#1058035) Homepage

    Roxen Web Server [roxen.com] (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.

  • Deffinitively *the* appserver. Newly arriving "Enhydra Enterprise [enhydra.org]" combines the sophistication of XMLC, which allows very nice logic/presentation separation and delivery in multiple formats (HTML/WML/etc), integration of JOnAS for EJB support and a very well thought out API.

    Enhydra [enhydra.org] also comes with InstantDB [enhydra.org], a pure-Java RDBMS designed for the web and Enhydra Director [enhydra.org], a very good load-balancing tool.

    Other nice features are the MultiServer which, among other things, allows easy local developement without needing to setup a server like Apache. It also allows debugging live servlets.

    All in all, Enhydra is great! Use it!

    Adam

    P.S. Also, there are facilities to use an IDE like JBuilder or JDeveloper with Enhydra.



    --
    Adam Sherman

  • Doesn't URL rewriting mean that people can bookmark their sessions?

    If someone registers credit details at a site and then emails a link to a friend then that could be a potential security problem.

    +++++
  • Yup, I realise that sessions time out, but there could still be a potential risk. What if someone registers for a site like amazon, then emails idlechatter@bigcompany.com with the link and continues surfing?

    Somebody from bigcompany.com is likely to follow that link within the 20 or so minutes it takes the session to expire. If the session expire time is shortened then the site kicks people mid surf - also not desirable. If the victim keeps browsing the site for a while then the session could be open for hours after the mail is sent. Anyone in their company could buy books with their card.

    +++++
  • I have implemented a server-side dynamic HTML thingumy in the past which encoded sessionId stuff into the URL, and to allow people to browse off-site and return to the same session we dropped a cookie which also had the sessionId in it.

    Our session management code took care of resolving any conflicts between the two sessionIds.

    I've not got enough experience of WAP to be able make any useful comparisions yet.

    HTH,
    fRoGG

  • This may be slightly off topic but, i was just wondering what the state of slashdot's wml site is like and if rob and co. are still working on it. so far i can get the headlines but was hoping that i'll be able to read the stories as well. With the nokia 7110 i cant follow on from the headline links.

    ah well. hopefully soon i can read slashdot from just about anywhere :)
  • Call me a simple-minded clod, but what is wrong with just putting the session ID into a cookie instead of going through all the trouble to embed it into every URL? Tarzan not understand!
  • The thing I hate about URL rewriting is that you can't use static HTML pages that contain links.

    If you don't mind managing your own session table, you can do sessions with a slight variation on URL rewriting. Instead of embedding the session ID in the parameter section of the URL, you put it in the path section. You then have a servlet that is invoked for every reference to that path.

    For example, you set up a servlet to handle /appdir/. Now every request for /appdir/, like /appdir/index.html goes through the servlet. The trick is, you generate a random session ID and send the user to something like /appdir/9859738579834/index.html. When they click on a link in index.html, assuming the link is relative to index.html, the phone will request /appdir/9859738579834/whateverlink.html or a servlet/JSP. All you need to do in your /appdir/ servlet is parse the key, look up the session-oriented data, place it in the request object and then do a forward to the real page.

    There was a message about something similar (doing multiple sessions for a single browser instance) on the JSP interest mailing list [sun.com].

    I haven't tried it for WAP, but I suspect it would work.

  • That works fine if you are dealing with a device that supports cookies. The whole idea behind URL rewriting is that it inserts the session ID into a URL if the browser doesn't support cookies. Otherwise it puts the session ID in a cookie and everything works fine.

    The problem in the WAP arena is that there are a lot of phones that don't support cookies.

  • 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.
    -------------------------------------
    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 /appdir
    getServletContext().getRequestDispatcher("/appdir" +fullPath).
    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!
  • by Black0ut ( 32902 ) on Sunday May 21, 2000 @07:59AM (#1058046)
    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

  • Anyone know if there's a way to enable URL rewriting when using Tomcat?
  • by Kingpin ( 40003 ) on Sunday May 21, 2000 @07:24AM (#1058048) Homepage

    You should definitly check out the Cocoon project. XML, XSL/T and whatever you might need.
  • Sorry I forgot to post the URL..
    www.hawhaw.de...

    Cheers,
    -/r
  • 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..

    Check it out .. 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,

    Cheers
    -/ramas
  • 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.
  • Thanx to all the guys and grrls that responded. We sorted the problem at our end, with out making any chages to the existing Servlet model.

    The way we got around it was to make the first page that is called be a Servlet that will generate the WML. This way the first session id is not superceded by a second session id created for the WML. This is the same session id that gets passed around between all the rest of the servlets now.
    We found that the solution requires WAP 1.1 on the gateway/phone - WAP 1.0 doesn't work - we don't know if that is the gateway or the phone causing the problem, but we suspect it to be the gateway.

    Thanx again for all the info,
    ys

  • IIS doesn't even have a decent servlet story. To run a Java servlet on IIS requires a per web server licensed add-on like JRUN. With Apache on the other hand, you have JServ which is open source and free also. So, unless WAP is all bottled up by M$ I see no reason you need to use IIS for this project at all. Even if WAP was bottled up (I presume at server side) then you could use a CORBA-COM bridge to call the M$ WAP stuff. Presumably your clients are not M$ restricted.
  • 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).

  • by haggar ( 72771 ) on Sunday May 21, 2000 @01:56PM (#1058055) Homepage Journal
    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).

  • I think he's maintaining session through client side cookies, which works well and good for most browsers, but when you start maintaining session by placing cookies down to a WAP device, those cookies are stored on the server with a new sessionid - and are not accessable by the java applets?

    I think the easiest, most cost effective solution would be to suck it up and use IIS. The next best might just be to change the way you maintain session. (however, I'm not familier with Enhydra...)

  • WAP is either a White Anglo-Saxon Protestant... or go to <a href = "http://www.wapforum.org">Wapforum.org</a>
  • hehe, OOPS.

    (my apologies to all of the WASP's I just insulted)
  • Just wanted to put my .02 in -- the Orion Server is awesome. Highly recommended. It literally took me 5 minutes to move my stuff from Resin and Tomcat and get it running under Orion. This in part to the servlet 2.2 spec, but still.
  • If you try to download the technical documents from www.wapforum.org it asks you to click through a license agreement. While the license agreement doesn't ask you to treat the document as a trade secret, I still find it offensive.

    (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 [slashdot.org] 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.

  • . . I've read this week!
    ___
  • if it is about the cookies, some wap gateways emulate cookies and the ones that dont soon will. WAP browsers for the most part dont have cookies, they're too expensive.
  • by holzp ( 87423 )
    people get confused because you need a WAP Gateway to handle transforming wml into the approp format before it reaches the wap browser. but that is mostly handled by those providing the devices with wireless access anyway.
  • Actually, there's a neat little SSI-type API for Java on freecode.com that works quite well for this; you just form a link like this:
    <a href="/servlet/ServletName?sesid=&lt!--#echo var="sessionid"--&gt"&gtlink&gt/a&gt
    Check out the package (it's GPLed!) at http://www.freecode.com/cgi-bin /viewproduct.pl?8543 [freecode.com].
  • WAP creates its own session ids, and that stops other serverside objects from sharing the same objects.

    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 [wapforum.org] 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/ [arsdigita.com].

  • Everybody is having trouble trying to build wap pages or more important trying to convert old html stuff into wap.

    Since the java servlets are no problem in this case I'd reccomend you'd check out the WAPorizer at Dimon [dimon.is] software.
    It automatically converts html into wap and creates different wml pages for different screen sizes of the phones.

    ----------------
    Páll Melsted
    melsted@hie.is
  • by Issue9mm ( 97360 ) on Sunday May 21, 2000 @07:32AM (#1058067)
    This document [enhydra.org], an enhydra WAP/WML/HTML tutorial, will briefly illustrate the abilities of the Enhydra server.

    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...

  • By creating content as XML, you can now create XSLT scripts to transform [...] XML content into XHTML or into WAP.

    Dream on 8-(

    Like everyone and their dog (well, everyone who's dog is an XML/XSL geek), I too thought this was the way to go. Bitter experience shows that although it's technically possible, the sheer broken-ness of WML makes it almost useless. There are two big problems you need to work around; neither of which is conducive to an easy solution in XSL alone.

    • The WML deck size limit. WML is pared down to fit onto phones, where 'phones' are devices so small that they're barely comparable to PDAs. WML simply doesn't have the 'grunt' to deliver useful content volumes to something even as small as a Palm.
    • The clunkiness of WML navigation. You can't make a usable WML nav interface by simply taking the graphics off the same old menubar that works your desktop web pages. The transformation needs to be at a much deeper level, one that's beyond simple mechanical XSL.

    What this means in practice is that your presentation-free XML content needs to be heavily marked up with "WML deck - Cut here" markers, so that when you slice it into decks, then you break it across somewhat functional boundaries. Break it in the middle of (e.g.) a news story and the phone has to go and deal with both decks, just as the user scrolls to read it. More traffic, more delay as the phone leaps around from deck to deck, generally a pretty nasty way of mis-using WAP.

    For interface building, I managed to make it work with XSL transforms of my common XML. It still sucked - what I'd built turned out to be a standard interface hard-coded in XSL, with a bit of templating based on the content of the XML. For the one example I was looking at (a newsfeed service, to re-invent the cliche), this worked OK, but my XSL was entirely dependent on the purpose of this content. There's no way I could even have re-used it for a weather forecast or traffic service, without entirely re-coding the XSL.

    The more I see of WAP, the less I like it. I now see the point of 4K Associates and their "WAP considered harmful" piece of last year. XHTML-Basic [w3.org] is a much better thought out protocol, and it doesn't have this problem of being squeezed so thin that it's no longer big enough to support palmtops.

    I'm not convinced of the commercial future of WAP. Wireless wil be mega-, mega-huge, but I don't think it's going to be built out of WAP. You still have sourcing difficulties for handsets (in the UK) and if the handsets aren't out there, then there's not the same drive to build content. Any new tech in this market only gets one short slot at the championship, and I think WAP might miss it in favour of the Next New Thing.

    Roll on Bluetooth.

  • by dingbat_hp ( 98241 ) on Monday May 22, 2000 @12:40AM (#1058069) Homepage

    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.

  • http://www.uklinux.net/ is a UK free linux ISP to do this. ! Is any one making a list of these things ?
  • I don't see why you would need a special web server, etc. for WAP... it's just a different HTTP content type... and then the WML isn't any more difficult than HTML. What's the big deal?? yer_blues
  • Hell, I thought it was We Are Satans People ... :)
  • In my limited experience with DOM it's quick. I just learned xmlc (and the servlet API) last month for a project, after hacking dynamic HTML in perl for a few years. I initially hesitated at how cumbersome it was to program with, until I saw the advantages in terms of
    • detecting errors at runtime
    • guaranteeing that all paths of execution will result in well-formed HTML.
    • encouraging the developer to structure the application clearly.

    Modular programming results in a performance hit too, but in most cases it's worth it.

  • I don't see what the fuss is, to be honest. WAP is the easiest technology conversion I've had to make in the last two years.

    HOW to do WAP ( Taken from http://ali.as/ [ali.as] )
    Simply set the MIME type for .wml files ( or anything else ) to text/vnd.wap.wml and that's it! WAP server setup complete.

    Example: http://ali.as/wap/wap.wml ( doesn't work in a normal browser )

    The other thing you want to do is set index.wml as an index file... since every keystroke they have to type in will be a pain for mobile users, at least the phone ones anyway.

    Next, CGI ( or servlets, or whatever ).
    Given you now know the magic WAP MIME type ( text/vnd.wap.wml, simply get your program to spit out the MIME type. Perl example would be

    print "Content-type: text/vnd.wap.wml\n\n";

    I imagine it would not be THAT hard to change the Content-type line of the header in JSP... A collegue is mentioning to me that all you need to do is something like

    Method addHeader( 'Content-type', 'text/vnd.wap.wml' ); in the interface HttpServletResponse in the class javax.servlet.http

    All you have to do then is write in WML, which isn't that difficult to learn.

    To do that, I highly recommend the WAP Phone Simulator provided in the Unwired Planet SDK 4.0 [phone.com]

    AdamK
  • Your information may be a little old. Enhydra 3.0.1 *has* Servlet 2.2 support (through incorporating Tomcat), also the preferred way of using it with Apache (or other web servers inc. IIS :-) ) is to use Enhydra Director, which comes as part of the Enhydra download.
  • Just set up apache and add wml to the types defined in the httpd.conf file.

    The real work of WAP is done by the gateway at the service provider all you do is serve WML pages to that like you would html.

    Javaserverlets shouldn't be a problem as long as you can find a way of maintaining the states, serve the data in chunks using the WML methods provided for that reason.

    I serve WML with apache, php, mysql no problems.

    enjoy
  • something strange happened to the link! here it is again. [geocities.com]
  • WTF is wrong with Yahoo Geocities? Here is the fucking link: http://www.geocities.com/SiliconValley/Lab/5200/co mpetitiveanalysis.doc
  • Obviously, that is what the article is all about, they want to set the cookie on the device, not on the WAP server.
    Anyway, Mr.G. talk to you later.
  • 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.
  • by roman_mir ( 125474 ) on Sunday May 21, 2000 @08:59AM (#1058081) Homepage Journal
    You can use the following solutions:
    www.davinci.ca (here is the competitive analysis document I had to write: download) [geocities.com]
    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.
  • Hey Dude,

    When you set a cookie on a WAP device, the gateway manages the cookies, not the device. In the case of the UP.Phone simulator, if it is working in HTTP Direct mode, it will manage the cookies itself, which is good enough for testing.

    Easiest way is to use the cookie to identify a server-side session... then the WAP device looks like any other web client, and you deal with the same issues as you have in web browsers.
    I couldn't get to the document you linked to...
    Give me a call, we can discuss... :)
  • WAP devices do support client side scripting, with a language called WMLScript. It's essentially a stripped down version of ECMAScript.
  • Serving WML really involves three major components: the phone, a WAP gateway, and an HTTP server.

    The phone has a conversation with the gateway using the WAP protocols over some bearer network. That conversation may be either session or non-session oriented, and may be either secure or insecure. Your carrier's GSM network is one option for the bearer; a dial-up PPP connection is another. (If your phone is using a dial-up connection, it will need to connect with a WAP gateway using UDP ports 9200-9203.) In any case, the phone does not actually open an HTTP connection directly to your HTTP server; the connection the phone sees is to the gateway.

    The WAP gateway makes the actual connection with the HTTP server. It's basically a proxy server. The WAP gateway may open a separate HTTP session on behalf of each phone, or it may open a new session for every request.

    I'm not aware of any WAP enabled phones that store their own cookies. However, the gateway may support cookies on behalf of the phone, though some will downgrade persistent cookies to session cookies. Even if the gateway stores persistent cookies, there's still the problem that the phone may not always use the same gateway, so the persistent cookie store may not be available.

    The result of all this is that your HTTP server may or may not see session cookies, and persistent cookies may or may not really persist. About the only thing that is pretty reliable is that you'll get lots of requests from different users using the same gateway IP.

    One possibility to deal with missing session cookies is to use URL mangling. This is discussed at some length in another thread, so I won't go into the technique here. However, there are a couple caveats:

    • The maximum length of a URL on a phone may be significantly less than for a web browser. Even if you don't hit the max URL length, long URLs still increase the size of your HTTP response. It's pretty easy to send back more than a phone can handle (some choke on 1500 bytes or so.)
    • The gateway transcodes the WML and WMLScript text into a binary format for transmission to the phone, and most commercial WAP gateways do some caching. URL mangling makes caching more difficult, since the mangling introduces small differences between otherwise similar responses. This problem is compounded by the fact that some of the gateways still use HTTP 1.0.
  • Just have a look on this link http://www.bea.com/press/releases/2000/0508_Nokia. html
  • Enhydra also supports the required server-side sessioning that the questioner needs... Actually, that's a very cool technology if it's robust, but I'm not sure that server-side sessions work well in cases where things like NAT and firewalls are being used... It's tough to track 20 people all coming from the same IP address :)
  • 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.

Remember to say hello to your bank teller.

Working...