org.speakright.servlet
Class SRServletRunner

java.lang.Object
  extended by org.speakright.servlet.SRServletRunner
All Implemented Interfaces:
ISRExtensionFactory

public class SRServletRunner
extends java.lang.Object
implements ISRExtensionFactory

Manages running a SpeakRight application inside a servlet. Is a lightweight wrapper around SRInstance to remove dependency of application code from it.

Author:
IanRaeLaptop

Constructor Summary
SRServletRunner(SRFactory factory, ISRServlet self, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String httpActionName)
           
 
Method Summary
 void continueApp()
           
 SRRunner createNewSRRunner(javax.servlet.http.HttpServlet servlet)
          Create an SRRunner object for this session (phone call)
 ISpeechPageWriter createPageWriter()
          Create a page writer that renders SpeakRight output content into VoiceXML or whatever markup text you want.
 java.io.PrintWriter getWriter()
          Get the print writer that will output the servlet's content (voicexml)
 boolean isNewSession()
          Is this a new session? A session is considered new if session.isNew is true or if it can't find the saved SRRunner object saved in the session.
 void log(java.lang.String msg)
           
 SRLogger logger()
          Get the SpeakRight logger (log4j)
 SRRunner runner()
           
 void startApp(IFlow flow)
          Start the SpeakRight app.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SRServletRunner

public SRServletRunner(SRFactory factory,
                       ISRServlet self,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response,
                       java.lang.String httpActionName)
Method Detail

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Get the print writer that will output the servlet's content (voicexml)

Returns:
Throws:
java.io.IOException

logger

public SRLogger logger()
Get the SpeakRight logger (log4j)

Returns:

log

public void log(java.lang.String msg)

runner

public SRRunner runner()

isNewSession

public boolean isNewSession()
Is this a new session? A session is considered new if session.isNew is true or if it can't find the saved SRRunner object saved in the session.

Returns:

startApp

public void startApp(IFlow flow)
              throws java.io.IOException
Start the SpeakRight app. This MUST be called only once for each session (phone call), when isNewSession returns true. startApp will generate a single VoiceXML page and write it to the print writer.

Parameters:
flow - the application flow object
Throws:
java.io.IOException

continueApp

public void continueApp()
                 throws java.io.IOException
Throws:
java.io.IOException

createNewSRRunner

public SRRunner createNewSRRunner(javax.servlet.http.HttpServlet servlet)
Create an SRRunner object for this session (phone call)

Parameters:
servlet -
Returns:

createPageWriter

public ISpeechPageWriter createPageWriter()
Create a page writer that renders SpeakRight output content into VoiceXML or whatever markup text you want.

Specified by:
createPageWriter in interface ISRExtensionFactory
Returns: