WURFL (original) (raw)
WALL
the Wireless Abstraction Library
Back to Java
WALL with Improvements
This is an update we kindly received from Murray Brandon in Australia.
A lot of what Murray did will be supported also in WURFL evolution, but for those who can't wait, just be grateful to Brandon.
Here is Murray's explanation of the new features:
Hi Luca,
Here's the updated wurlf/wall source that we refactored for our project to allow wurfl to be reloaded at runtime (ie without stopping the webserver) and to allow us to create complex renderers made up of a bunch of WALL renderers as per my previous posting.
It also has:
- style_class attributes for all the major WALL tags
- a style tag with the ability to embed a css in the xhtml/html page so it loads faster on newer 3G phones.
- log4j instead of system.out.printlns.
- Ability to choose to default to XHTML/WML etc when a handset isn't known.
It does not implement (ran out of time and no ability to test):
- coolmenus - should be easy to slot back in.
- some of the WML form field stuff (see commented-out member variables in the DocumentInfo.java class), since we didn't need it for the work we were doing. I've left the code commented out in the places where it would fit if anyone would like to tackle that.
Sorry it's so late - better late than never, but anyway, here's our contribution back for your original hard work. Let me know of any problems or questions, although I'm still very busy wrapping up this project. Can you host it?
Cheers, Murray
PS. The .tld data is pasted at the end.
Of course we can host it, Murray. Thanks for that.Source Code is available here
and here is the .TLD Murray mentioned:
a net.sourceforge.wurfl.wall.AnchorTag JSP Multiserve Link and Menu Item href true true accesskey false true title false true opwv_icon false true style_class false true div net.sourceforge.wurfl.wall.DivTag JSP Generic DIV handler style_class false true id false true br net.sourceforge.wurfl.wall.BrTag JSP Generic BR handler img net.sourceforge.wurfl.wall.ImgTag img element src true true alternate_src false true style_class false true alt true true align false true width false true height false true nopicture false true opwv_icon false true eu_imode_icon false true ja_imode_icon false true document net.sourceforge.wurfl.wall.DocumentTag JSP Container Tag disable_wml_extensions false true disable_xhtml_extensions false true disable_cache false true disable_content_type_generation false true force_template false true default_markup xhtmlmp or chtml or wml false true xmlpidtd net.sourceforge.wurfl.wall.XmlpidtdTag Generate appropriate XML Processing Instruction and DTD encoding false true head net.sourceforge.wurfl.wall.HeadTag JSP Multiserve Head Description title false true enforce_title false true title net.sourceforge.wurfl.wall.TitleTag JSP Multiserve Title Attribute title false true enforce_title false true body net.sourceforge.wurfl.wall.BodyTag JSP Multiserve BODY tag bgcolor false true text false true wml_back_button_label false true disable_wml_template false true newcontext false true block net.sourceforge.wurfl.wall.BlockTag JSP Multiserve p tag style_class false true align false true p net.sourceforge.wurfl.wall.ParagraphTag JSP Multiserve p tag style_class false true align false true style net.sourceforge.wurfl.wall.StyleTag JSP Includes a different style sheet depending on the template attribute of the DocumentInfo href false true base false true embed false true override false true
Finally, here is an email from Murray that explains what has been changed in particular:
================ What's in there:
- Ability to pass in style_class to most tags for those dealing with modern handsets. You can now do an xhtml style-sheet driven approach
- WALL:div tag.
- Appropriate calls to reset() on all WALL tags - this prevents a bug where subsequent tag usage shows old values.
- A great deal of repeated code moved into helper classes:
cm = ObjectsManager.getCapabilityMatrixInstance();
uam = ObjectsManager.getUAManagerInstance();
request = (HttpServletRequest) pageContext.getRequest();
//Check the capability string
warning = TagUtil.checkCapability("preferred_markup");
if (warning.length() > 0) {
throw new JspException(warning);
}
//get the user agent
UA = TagUtil.getUA(this.request);
device_id = uam.getDeviceIDFromUALoose(UA); capability_value = cm.getCapabilityForDevice(device_id,
"preferred_markup"); capability_value = TagUtil.getWallMarkup(capability_value);
- Much of the repeated logic moved to a DocumentInfo class that contains anything that needs to be remembered about a page.
- "if (capability_value.startsWith("xhtmlmp"))" check has been moved into the DocumentInfo class.
- A WALL:style tag that gives the ability to embed or include style
sheets, and to switch off embedding for phones that don't support it.
Phones render faster if embedded - recommended for 3G. - Moved most hard coded strings into WurflConstants.java
- Changed the System.out.println(..) to log4j calls - Our customers didn't allow us to go to production with println statements in the code.
- Rendering of tags has been split out into renderers so logic can be re-used. eg. BrTag and BrRenderer so users can cobble together complex tags for their projects by calling a series of renderers one after the other.
- Fixed XHTML rendering so it renders well to normal web browsers (eg. Mozilla Firefox). Hence it is easier to debug screens or check if they are XHTML compliant using http://validator.w3.org.
- String TagUtil.checkCapability(String capability) was changed to: boolean TagUtil.isValidCapability(String capability) since that's all it does.
- ObjectsManager.resetWurfl() used to set references to null, so all WALL renderings by other threads failed during the reload time. Fixed so this means you can update WURFL at runtime.
- WALL no longer keeps a cached reference to the WURFL, so WURFL can be updated at runtime.
- When a phone isn't detected, WALL falls back to XHTML.
- If you want WALL to fall back to another rendering when a device isn't detected, use default_markup="wml" in the WALL:document tag.
- WallDocument which extends TagSupport is no longer attached to the request as an attribute. The DocumentInfo object replaces this and goes into the request instead.
- When a tag fails to detect a capability, some of the JspExceptions that used to get thrown are recovered from, since we should always attempt to render something in at least XHTMLMP.
- You can now choose a style sheet depending on the handset.
DocumentTag now has a method .setDocumentExit(DocumentExit) on it to adjust the DocumentInfo class. - Wurfl ObjectsManager can now tell you if the reload of WURFL has failed.
- Lots of input streams in Wurfl.java are now closed. No more resource leaks ;-)
======================== What's not in there (yet):
- Cool menus. I ran out of time to include this but it would go in the wall.composite.* package.
- some of the WML form field stuff (see commented-out member variables in the DocumentInfo.java class), since we didn't need it for the work we were doing.
- I've left the code commented out in the places where it would fit if anyone would like to tackle that - I doubt I'll get time and don't have the testing resources.