Package org.speakright.core

Examples of org.speakright.core.SRRunner


public class AppFactory {

  public SRRunner createRunner()
  {
    SRFactory factory = new SRFactory();
    SRRunner run = factory.createRunner(BaseTest.dir, "http://abc.com", "", null);
//    m_run.locations().setProjectDir(dir);
    String path = BaseTest.dir + "prompts.xml";
    run.registerPromptFile(path);
//    m_run.setReturnUrl("http://abc.com");
    Model m = new Model();
    run.setModelBinder(m, new ModelBinder(m));
    return run;
  }
View Full Code Here


        boolean isNew = session.isNew();
        String id = session.getId();
        m_logger.log("SERVLET: " + ((isNew) ? "*** NEW SESSION ***" : "EXISTING SESSION") + " ID: " + id);
       
        if (!isNew) {
          SRRunner run = activateSavedSRRunner(m_request);
          if (run == null)
          {
          m_logger.log("SERVLET: oops, no runner. what happened to our session?!!!!!!!!!!!!!");
        return true;
          }
View Full Code Here

  }
 
  void saveSRRunner(HttpServletRequest request, boolean alreadyExists)
  {
    HttpSession session = request.getSession();
        SRRunner savedRun = (SRRunner)session.getAttribute("runner");
        if (!alreadyExists && savedRun != null)
        {
          m_logger.log("WARNING: new session GET and runner already exists!");
        }
        m_run.prepareToPassivate(); //must call this!
View Full Code Here

 
  SRRunner activateSavedSRRunner(HttpServletRequest request)
  {
    SRLogger logger = SRLogger.createLogger();
        HttpSession session = request.getSession();
        SRRunner run = (SRRunner)session.getAttribute("runner");
        if (run == null)
        {
          logger.log("POST and no runner!");
      return null;
        }
        else
        {
          logger.log("POST restored saved session");         
          run.restoreModelBinder(new ModelBinder());
          run.finishActivation(); //must call this!
      run.setExtensionFactory(this);
//          setupUrls(run, request);
      m_factory.initUrls(run, getUrl(m_request), getServletUrl(m_request));
          m_run = run;
          return run;
        }
View Full Code Here

        }
  }
 
  boolean generateNextPage(HttpServletRequest request, java.io.PrintWriter out)
  {
    SRRunner run = m_run;
        HttpSession session = request.getSession();

        if (run.isFinished()) {
          finish(out, session);
      return false;
    }
       
       
        RawCGIParams rawParams = new RawCGIParams();
        Enumeration paramNames = m_request.getParameterNames();
        while (paramNames.hasMoreElements()) {
          String name = (String) paramNames.nextElement();
          String[] values = m_request.getParameterValues(name);
          for (int i = 0; i < values.length; i++) {
            //out.println("      " + values[i]);
            //I assume most of the time, each param only has one value!
            rawParams.add(name, values[i]);
          }
         }
      
        SRResults results = new SRResults(rawParams);
        run.proceed(results);

      if (run.isFinished()) {
        finish(out, session);
      return false;
    }
      return true;
  }
View Full Code Here

   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    SRServletRunner runner = new SRServletRunner(new AppFactory(), this, request, response, "GET");

    if (runner.isNewSession()) {
          SRRunner run = runner.createNewSRRunner(this);
   
          SRApp flow = new SRApp();
          flow.addPromptFlow("Welcome to the Speak-Right demo application. {..}");
         
          DateFormat fDateFormat = DateFormat.getDateInstance(DateFormat.LONG);
View Full Code Here

TOP

Related Classes of org.speakright.core.SRRunner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.