Title: Building Wireless Internet Applications
1Building Wireless Internet Applications
Wireless Developer Workshop
2Architectural Map
Thin Client
Mobile Data Store
Device Identification
Data Synchronization
Content Transformation
iAnywhere Wireless Server
Messaging
Security
Enterprise Integration
3Topics
- Wireless Internet Characteristics
- Development Overview
- Developing Internet Applications
- J2EE Servlets and JSPs
- J2EE Wireless Framework
- Using XML/XSL
4Wireless Internet Characteristics
- Browser based applications
- No deployment required
- Dynamic content
- Multiple devices
- Many different browsers
- Many different markup languages
- Messaging
- Notifications and alerts
- Integrated business logic
- Logic remains on server platform
5Development Overview
- Browser Based applications/Multiple Devices
- JSPs, Servlets, XML/XSL
- Markup language (WML, HTML, etc)
- Messaging
- JMS
- Integrated Business Logic
- EJBs
Java
6Developing Internet Applications
PageServer
HTTP Server
Database Connectivity
HTTP
HTML
ComponentTransactionServer
Name Server
7The Good News
- When you buy an application server, it provides
basic services for hosting components - Connection pooling
- Transaction management
- Component life cycle
- Security
- Multi-threading
- Name services
- Dynamic page services
- Messaging
8The Bad News
- Each vendor provides these services as a set of
proprietary APIs - Pages not portable between servers
- Components not portable between servers
- Developer locked into a vendor
9The SolutionJava 2 Enterprise Edition (J2EE)
- Defines a standard for developing multitier
applications - Vendors collaborate on standards and compete on
implementation - All the pieces of the application are portable
across platforms and servers - Simplifies application development
- Developer focuses on application logic
- J2EE server handles complexity of lower level
services
10J2EE Architecture
JSPEngine
JDBC
JavaMail
HTTP Server
Servlet Container
JNDI Server
EJB Server
11What is a Servlet?
- Server side Java program that extends the
functionality of a Web Server - Used to dynamically generate markup language
based documents - Comparable to
- CGI
- Netscape NSAPI
- Microsoft ISAPI
- Apache Modules
12Servlets Benefits
- Written in pure Java
- Platform independent
- Can take advantage of JDBC, EJB, JMS, JavaMail,
JavaIDL, RMI, ... - Server independent
- Scalability
- Dont start new process for each request
- Can run in same server process as HTTP server
- Multi-threaded
13Building a ServletUsing the Servlet API
- Extend HttpServlet
- Code Servlet's life cycle Methods
Servlet
GenericServlet
HttpServlet
LogonServlet
14Java Server Pages
- Web scripting technology
- Creation of dynamic content using static
templates - Combine markup (WML, HTML, VoiceXML, XML, etc.)
with Java Code to produce a dynamic web page - Similar to ASP
- Uses Java as its scripting language
- Full power of the Java language
- Simple tags allow non Java developer to generate
dynamic content
15A Simple JSP
- lthtmlgt
- ltbodygt
- lt_at_ page language"java" import"" gt
- ltH1gtWelcome back,
- lt
- String user (String) session.getAttribute("user
") - out.println(user)
- gt
- lt/H1gt
- lt/bodygt
- lt/htmlgt
16How it Works
User Request
Server
FileChanged ?
Create Source
Compile
Execute Servlet
17Java Server Pages and Servlets
- Servlets
- Markup language enclosed in Java code
- JSP
- Java code enclosed in markup language
- Easier to author
- Better tool support
18J2EE Wireless Framework What it Offers
- Reduced development complexity
- Global data members
- Extends capabilities of Java Servlets/JSPs
- Device identification
- Parallel content with single URL
- Application management
- Session management
- User authentication
- Flow management
19J2EE Wireless Framework What it Offers
- Enterprise data integration
- JDBC/ODBC
- Custom adapters
- XML
- Messaging integration
- JMS access to Messaging systems
- Servlet, JSP and XML/XSL development
20J2EE Wireless Framework Device Identification
- Provides the ability to detect the device type
and content type to format the data appropriately - Redirector allows you to have parallel content
with a single URL - Stored information about devices can be accessed
to generate appropriate content - Language support
- Image support
21J2EE Wireless Framework Device Identification
- Specific browsers recognition built-in
- Nokia WML
- Ericsson WML
- UP.Browser
- Palm VII PQA
- MS Pocket IE
- NTT i-mode
- Neomar
- MS Internet Explorer
- Netscape
- Can develop generic recognition
22J2EE Wireless Framework Application Management
- Session management
- Most wireless devices cant use cookies so server
needs to be able to manage session information - Via server-side cookies or URL rewriting
- User doesnt have to be concerned with underlying
implementation
23J2EE Wireless Framework Application Management
- User Management
- Authentication
- Personalization
- Flow Management
- Filters provide pre-built functionality
- i.e. LoginFilter
24J2EE Wireless Framework Messaging
- Java Message Service (JMS) provider for mobile
messaging system - Notifications, alerts
- Allows integration between thin-client and
smart-client applications
25Thin Client Development Options
- Static content
- Dynamic content
- Java Servlets
- Java Server Pages
- XML content with XSL style-sheets
26Developing Internet Applications Static Web Site
HTTP Server
HTTP
27Dynamic Page GenerationUsing Servlets and JSP
JSPEngine
HTTP Server
JDBC
HTTP
Servlet Container
28J2EE Wireless Framework
- Simplifies the development of thin client
applications - Extends HTTPServlet with additional functionality
- ianywhere.framework.Application class allows you
to develop web based apps the same way you would
develop regular Java classes - Global data members throughout application
public class MyApp extends ianywhere.framework.Ap
plication public void mymethod(Request req,
Response res)
29Building a ServletUsing the iAnywhere Framework
- Extend
- ianywhere.framework.Application
- Code servlet's business methods
Servlet
GenericServlet
HttpServlet
Application
Logon
30Thin Client Servlet Generated Content
- StringBuffer s new StringBuffer()
- s.append("lthtmlgt\n")
- s.append("ltheadgt\n")
- s.append("lttitlegtTitle on Pagelt/titlegt\n")
- //more code here for simple or complex logic
- out.print(s.toString())
- out.flush()
31Building the Application
- Step 1 Retrieve client information
- Step 2 Identify the content type
- Step 3 Identify the browser type
- Step 4 Create content appropriate for the
mobile browser
32Step 1 Getting client information
- String reqType req.getUserAgent().getPreferredTy
pe() - resp.setContentType( reqType )
- HttpServletRequest hr req.getHttpRequest()
- String agent hr.getHeader( "user-agent" )
- String device agent.getDevice()
- String deviceID agent.getDeviceID()
33Step 2 Identifying Content Type
-
- if ( reqType.equals( MIMEType.WML ) )
-
- //Generic WML content
-
- else if (reqType.equals( MIMEType.HTML))
-
- //Generic HTML Content
-
34Step 3,4 Identifying Device Broswer
-
- if ( agent.equals( NokiaUserAgent" )
-
- //nokia specific content here
-
35XML Document Characteristics
- No presentation information
- No specification of type style or color
- No specification of format table, list, bold,
etc - Tags are application-oriented
- ltproductgt, ltquantitygt, etc, instead of just ltpgt
- Easy to distinguish Bandages as Product vs
Price
36Presentation Using XSL
- XML documents omit all formatting
- Formatting is supplied by XSL
- XSL Extensible Style Language
- Specified separate from the XML document
- Allows multiple XSL specs for one XML document
- An XSL spec maps
- An XML document type to HTML, or
- One XML document type to another
37J2EE Wireless FrameworkXML Server
- Permits XML access to relational databases
- Data retrieval, inserts, deletes and updates
- Allows for one content source for multiple client
types using XSL - Takes advantage of connection caching mechanism
in iAnywhere Wireless Server -
38XML transformation
XSL Stylesheet
XSL Stylesheet
XML Document
XSL Stylesheet
XSL Stylesheet
XSL Stylesheet
39Building the Application
- Step 1 Create an instance of XML Server
- Step 2 Specify the XSL style sheet
- Step 3 Specify database properties and
execute the query - Step 4 Transform resulting XML document and
output the results
40Step 1 XSL Style Sheet
XMLServer xml_server new XMLServer() xml_server
.create()
41Step 2 XML Server
- xsl baseURI "xsl/wml/OrderListMaster.xsl"
- xml_server.setXsl(xsl)
-
42Step 3 Database Access
- xml_server.setUserid("dba")
- xml_server.setPassword("sql")
- xml_server.setSQL("SELECT order_id, product_name,
orders.quantity, discount, orders.order_date FROM
orders, product WHERE orders.product_id
product.product_id AND status 'Pending' AND
orders.rep_id " rep_id ) - xml_server.processSQLRequest()
-
43Step 4 Content Translation
- Document rs_xml_orders xml_server.getXMLDocument
() - ByteArrayOutputStream byteOutStream new
ByteArrayOutputStream() - domImpl.writeDocument(rs_xml_orders,byteOutStream)
-
- out resp.getOutputStream()
- xsltImpl.transform( in,new InputSource( xsl ),out
)
44Using PowerJ for Thin Client apps
- Complete J2EE support
- Tight integration with iAnywhere Wireless Server
- Automatic deployment of WebApplications
- Servlets
- JSPs
- Automatic deployment of EJBs
- Design-time syntax checking of JSPs
- Servlet Wizard can be used to develop
applications based on the iAnywhere Wireless
Server framework
45Summary
- Similar architecture to Internet applications
- more device and browser types
- New markup languages (WML, HDML, VoiceXML, etc)
- iAnywhere Solutions provides a server platform
that simplifies wireless web development - Multiple development options including Java
servlets, JSPs and XML/XSL
46Building Wireless Internet Applications
Wireless Developer Workshop