Building Wireless Internet Applications

1 / 46
About This Presentation
Title:

Building Wireless Internet Applications

Description:

Filters provide pre-built functionality. i.e. LoginFilter. J2EE Wireless Framework. Messaging ... Using PowerJ for Thin Client apps. Complete J2EE support ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 47
Provided by: tracey83

less

Transcript and Presenter's Notes

Title: Building Wireless Internet Applications


1
Building Wireless Internet Applications
Wireless Developer Workshop
  • Module 3

2
Architectural Map
Thin Client
Mobile Data Store
Device Identification
Data Synchronization
Content Transformation
iAnywhere Wireless Server
Messaging
Security
Enterprise Integration
3
Topics
  • Wireless Internet Characteristics
  • Development Overview
  • Developing Internet Applications
  • J2EE Servlets and JSPs
  • J2EE Wireless Framework
  • Using XML/XSL

4
Wireless 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

5
Development Overview
  • Browser Based applications/Multiple Devices
  • JSPs, Servlets, XML/XSL
  • Markup language (WML, HTML, etc)
  • Messaging
  • JMS
  • Integrated Business Logic
  • EJBs

Java
6
Developing Internet Applications
PageServer
HTTP Server
Database Connectivity
HTTP
HTML
ComponentTransactionServer
Name Server
7
The 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

8
The 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

9
The 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

10
J2EE Architecture
JSPEngine
JDBC
JavaMail
HTTP Server
Servlet Container
JNDI Server
EJB Server
11
What 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

12
Servlets 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

13
Building a ServletUsing the Servlet API
  • Extend HttpServlet
  • Code Servlet's life cycle Methods

Servlet
GenericServlet
HttpServlet
LogonServlet
14
Java 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

15
A 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

16
How it Works
User Request
Server
FileChanged ?
Create Source
Compile
Execute Servlet
17
Java Server Pages and Servlets
  • Servlets
  • Markup language enclosed in Java code
  • JSP
  • Java code enclosed in markup language
  • Easier to author
  • Better tool support

18
J2EE 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

19
J2EE 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

20
J2EE 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

21
J2EE 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

22
J2EE 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

23
J2EE Wireless Framework Application Management
  • User Management
  • Authentication
  • Personalization
  • Flow Management
  • Filters provide pre-built functionality
  • i.e. LoginFilter

24
J2EE Wireless Framework Messaging
  • Java Message Service (JMS) provider for mobile
    messaging system
  • Notifications, alerts
  • Allows integration between thin-client and
    smart-client applications

25
Thin Client Development Options
  • Static content
  • Dynamic content
  • Java Servlets
  • Java Server Pages
  • XML content with XSL style-sheets

26
Developing Internet Applications Static Web Site
HTTP Server
HTTP
27
Dynamic Page GenerationUsing Servlets and JSP
JSPEngine
HTTP Server
JDBC
HTTP
Servlet Container
28
J2EE 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)
29
Building a ServletUsing the iAnywhere Framework
  • Extend
  • ianywhere.framework.Application
  • Code servlet's business methods

Servlet
GenericServlet
HttpServlet
Application
Logon
30
Thin 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()

31
Building 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

32
Step 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()

33
Step 2 Identifying Content Type
  • if ( reqType.equals( MIMEType.WML ) )
  • //Generic WML content
  • else if (reqType.equals( MIMEType.HTML))
  • //Generic HTML Content

34
Step 3,4 Identifying Device Broswer
  • if ( agent.equals( NokiaUserAgent" )
  • //nokia specific content here

35
XML 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

36
Presentation 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

37
J2EE 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

38
XML transformation
XSL Stylesheet
XSL Stylesheet
XML Document
XSL Stylesheet
XSL Stylesheet
XSL Stylesheet
39
Building 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

40
Step 1 XSL Style Sheet
XMLServer xml_server new XMLServer() xml_server
.create()
41
Step 2 XML Server
  • xsl baseURI "xsl/wml/OrderListMaster.xsl"
  • xml_server.setXsl(xsl)

42
Step 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()

43
Step 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
    )

44
Using 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

45
Summary
  • 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

46
Building Wireless Internet Applications
Wireless Developer Workshop
  • Module 3
Write a Comment
User Comments (0)