Miscellany, WAP and VXML - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Miscellany, WAP and VXML

Description:

setup A man walks into a bar with a newt on his shoulder /setup couplet question actor='bartender' What did you name your newt? /question ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 22
Provided by: csMi4
Category:
Tags: vxml | wap | miscellany | newt

less

Transcript and Presenter's Notes

Title: Miscellany, WAP and VXML


1
Miscellany, WAP and VXML
2
Objectives
  • Tie up some loose ends.
  • Talk about XML friends.
  • Integrating cell phone interfaces.
  • Integrating voice mail interfaces.

3
Transactions in JDBC
By default, all updates in JDBC automatically
commit. You can turn this off, by doing this
connection.setAutoCommit(false) Where
connection is the connection you get in the
traditional fashion connection
DriverManager.getConnection(...) If you do
this, then any update you make will lock the
relevant data items until you do
this connection.commit()
4
Example Code
Connection.setAutoCommit(false Statement stmt
connection.createStatement() String
updatequery "update Sailors set name'foo'
where sailorid31" // this will lock the row,
preventing further updates stmt.executeUpdate(upda
tequery) try
Thread.sleep(30000) // force a long wait
catch (InterruptedException e)
connection.commit() // finally, commit!
catch (Exception e)
5
Example Question
  • Read(T1, x), write(T2, x), commit(T2),
    write(T1,x), commit(T1), write(T3,x), commit(T3)
  • Is this conflict serializable, view serializable,
    does it avoid cascading rollbacks and.. draw a
    precedence graph
  • Precedence rules line from Ti to Tj...
  • if Tj reads a value written by Ti
  • if Tj writes a value after it was read by Ti
  • if Tj writes a value after it was written by Ti
  • View serializable rules
  • If t1 reads initial value of x in s1 it must in
    s1
  • For each read in s1 if Ti reads output of Tj, it
    must also in s2
  • The last write on each item has to be by same
    transaction

6
XML
  • XML has become the standard for dealing with
    semi-structured data.
  • It has also become the standard for data
    interchange and tagging.
  • The taglib TLDs are XML documents.
  • Distributed databases use it to share
    information.
  • All Microsoft books are coded in it, then
    transformed into books.
  • Websites are increasingly using it.
  • It is EVERYWHERE!

7
Semi-structured Data
Data that may be irregular or incomplete and have
a structure that may change rapidly or
unpredictably. The data is often
self-describing, its structure is PART of the
data itself. This allows it to be interchanged
more freely systems don't have to agree before
hand on an exact structure.
8
Example XML File
lt?xml version"1.0" encoding"UTF-8" ?gt ltjokegt
ltsetupgtA man walks into a bar with a newt on
his shoulderlt/setupgt ltcoupletgt
ltquestion actorbartendergtWhat did you name
your newt?lt/questiongt ltanswer
actormangtHis name is Tiny. lt/coupletgt
ltcoupletgt ltquestion actorbartendergtWhy
did you name him that?lt/questiongt ltanswer
actormangtBecause, heaposs my newt!lt/answergt
lt/coupletgt lt/jokegt
9
XML Rules
  • All tags either have start and end tags or, the
    tag ends like this /gt
  • ltjokegt .... lt/jokegt
  • ltapplause volumemaximum/gt
  • Tags are case sensitive - ltjokegt and ltJokegt are
    different
  • Attributes in quotes
  • Nesting tags must not overlap
  • Bad ltcoupletgt ltquestiongt lt/coupletgt lt/questiongt
  • Good ltcoupletgt ltquestiongt lt/questiongt lt/coupletgt

10
More Rules
  • Spacing and indenting doesn't matter
  • Comments look like this lt!-- comment --gt
  • There are a few special character's which must be
    specially encoded
  • quot for double quote marks
  • apos for apostropes
  • lt for less than sign
  • gt for greater than sign
  • amp for ampersand

11
Good vs Bad XML
XML which follows these rules is called WELL
FORMED But, it may not be VALID To be VALID the
XML has to follow a specific structure called
either a DTD (Document Type Definition) OR an XML
Schema. Both of these describe what VALID XML
for a certain vocabulary. Here's the start of the
taglib XML document lt?xml version"1.0"
encoding"ISO-8859-1" ?gt lt!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag
Library 1.2//EN" "http//java.sun.com/dtd/web-js
ptaglibrary_1_2.dtd"gt lttaglibgt ... lt/taglibgt
12
WML The XML of Wireless
ltwmlgt ltcard id"first" title"My First
Card"gt ltpgt This is my first wireless
card! lt/pgt ltpgt ltanchorgtNext card ltgo
href"second"/gt lt/anchorgt lt/pgt lt/cardgt ltcard
id"second" title"My Second Card"gt ltpgt This is
my second wireless card! lt/pgt ltanchorgtPrevious
card ltprev/gt lt/anchorgt lt/cardgt lt/wmlgt
13
WML Forms
lt?xml version"1.0"?gt lt!DOCTYPE wml PUBLIC
"-//WAPFORUM//DTD WML 1.1//EN" "http//www.wapforu
m.org/DTD/wml_1.1.xml"gt ltwmlgt ltcard
title"search"gt ltpgt Title ltinput name"title"
size"15"/gtltbr/gt Author ltinput name"author"
size"15"/gtltbr/gt lt/pgt ltdo type"accept"gt ltgo
href"http//cs.mills.edu8666/wap/search.dowap"
method"post"gtSend it ltpostfield
name"title" value"(title)"/gt ltpostfield
name"author" value"(author)"/gt
lt/gogt lt/dogt lt/cardgt lt/wmlgt
14
WML Resources
  • Which phones WAP?
  • http//cellphones.about.com/library/blwap_or_minib
    rowser.htm
  • Good tutorial at w3schools
  • http//www.w3schools.com/wap/default.asp
  • Lots of good info on all things wireless
  • http//www.wirelessdevnet.com/channels/wap/trainin
    g/
  • Open source WAP gateway
  • http//www.kannel.org/
  • WinWap browser
  • http//www.winwap.org/

15
VXML Voice XML
You can voice activate your application using one
of several VXML gateway providers. VXML is
another form of XML. lt?xml version1.0?gt lt!DOCTY
PE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
"http//cafe.bevocal.com/libraries/dtd/vxml2-0-bev
ocal.dtd"gt ltvxml version2.0gt ltformgt ltblockgt
ltpromptgtHello World!lt/promptgt lt/blockgt lt/for
mgt lt/vxmlgt
16
VXML Forms
ltformgt ltfield name"selection"gt
ltpromptgtBooks by White or Carson?lt/promptgt
ltgrammar type"application/x-nuance-gsl"gt
lt!CDATA white
ltoption "White"gt carson ltoption
"Carson"gt gtlt/grammargt
ltfilledgt ltgoto expr"'http//blah/foo.vxml?
author' selection"/gt lt/filledgt lt/fieldgt
lt/formgt
17
VXML resources
Gateways BeVocal Cafe - http//cafe.bevocal.com
/ Tellme - http//studio.tellme.com/ The VXML
Specification http//www.w3.org/TR/voicexml20/ T
utorials Developer http//www.developer.com/voi
ce/ BeVocal - http//cafe.bevocal.com/docs/index.
html
18
Two ways to incorporate WML and VXML
  • Making separate JSP pages for HTML, WML, and VXML
  • Good if the content will be very different
  • Pretty straightforward
  • Can be a pain to maintain
  • Making one XML document and using XSLT to
    transform it into either HTML, WML, VXML or
    whatever you need
  • Easier to maintain
  • Initially harder to code

19
Separate JSP files
Basically, just output a WML document instead of
an HTML document. Create a jsp called
waptitles.jsp It's just like your titles.jsp page
except instead of starting with lt_at_page
contentTypetext/htmlgt use lt_at_page
contentTypetest/wmlgt stick the lt?xml ...?gt
tag and the lt!DOCTYPE ... gt tag at the top and
use the WML tags instead of HTML
20
More on separate JSP files
One annoying thing about some WAP clients is that
they insist that the files end with .wml To deal
with this 1. make your forms post to
http//host/something.wml 2. change your
web.xml file so that things ending in wml get
sent to your controller 3. you'll need to use
forwarding instead of redirection when you serve
up the jsp page this is because forwarding
won't change the URL that the browser sees
21
XML Transformations
The alternative is to output your pages to XML
and then transform it into the appropriate format
of XML before serving it up. Use XSLT for that
it's crazy-making but very cool. You create an
XSL style sheet which turns your XML into either
WML or HTML or VXML depending on where it needs
to go. For more information on this
see http//xml.apache.org/xalan-j/index.html http
//xml.apache.org/cocoon/introduction.html
Write a Comment
User Comments (0)
About PowerShow.com