Package com.bitmovers.maui.engine.httpserver

Examples of com.bitmovers.maui.engine.httpserver.HTTPSession


    {
      retVal = getRunningApplications ();
    }
    else
    {
      HTTPSession theSession = HTTPSession.getSession (aSessionID);
      retVal = getSessionApplications (theSession);
    }
    return retVal;
  }
View Full Code Here


    *
    */
   
  public void sessionDeleted (SessionEvent aSessionEvent)
  {
    HTTPSession theSession = (HTTPSession) aSessionEvent.getSource ();
    System.out.println ("Session removed: " + theSession.getSessionID ());
   
    //
    //  Purge this session from the sessions to applications cross-reference table
    MauiApplication [] theApplications = theSession.getCachedMauiApplications ();
    for (int i = 0; i < theApplications.length; i++)
    {
      String theName = getMauiApplicationClassName (theApplications [i].getApplicationName ());
      SessionInformation theSessionInformation = (SessionInformation) sessions.get (theName);
      if (theSessionInformation != null)
View Full Code Here

    *
    */
 
  public void applicationRemoved (SessionEvent aSessionEvent)
  {
    HTTPSession theSession = (HTTPSession) aSessionEvent.getSource ();
    String theApplicationName = getMauiApplicationClassName (aSessionEvent.getMauiApplication ().getApplicationName ());
    System.out.println ("Application " + theApplicationName +
              " removed from session: " + theSession.getSessionID ());
             
    SessionInformation theSessionInformation = (SessionInformation) sessions.get (theApplicationName);
    if (theSessionInformation != null)
    {
      theSessionInformation.removeSession (theSession);
View Full Code Here

    StringBuffer retVal = new StringBuffer ("<go href=\"/");
    MauiApplication theApplication = getMauiApplication (renderable);
   
    if (aUsePreviousApp)
    {
      HTTPSession theSession = theApplication.getSession ();
      Object thePreviousApp = theSession.getShared ("previousApp");
      if (thePreviousApp != null)
      {
        theApplication = (MauiApplication) thePreviousApp;
      }
    }
View Full Code Here

    */
   
  private String [] getClientClassification (MauiApplication aMauiApplication)
  {
    String [] retVal = new String [3];
    HTTPSession theSession = aMauiApplication.getSession ();
    retVal [0] = (aMauiApplication.getCompositor () instanceof WMLCompositor ? "wml" : "html");
    if (retVal [0].equals ("wml"))
    {
      theSession.setKeepAlive (false);
    }
   
    Map theHeaderValues = aMauiApplication.getRequestHeaderValues ();
    String theUserAgent = (String) theHeaderValues.get ("user-agent");
    if (theUserAgent != null)
    {
      theUserAgent = theUserAgent.toLowerCase ();
      int theIndex;
     
      // Internet Explorer
      // e.g. "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)"
      if ((theIndex = theUserAgent.indexOf ("msie")) != -1)
      {
        retVal [1] = "explorer";
        theUserAgent = theUserAgent.substring (theIndex + 5);
        theIndex = theUserAgent.indexOf (";");
        retVal [2] = theUserAgent.substring (0, theIndex);
      }
      else if ((theIndex = theUserAgent.indexOf ("opera")) != -1)
      {
        retVal [1] = "opera";
        theIndex = theUserAgent.indexOf ("/");
        theUserAgent = theUserAgent.substring (theIndex);
        retVal [2] = theUserAgent.substring (0, theUserAgent.indexOf (" "));
       
        //
        //  Can't use keep alive
        //
        theSession.setKeepAlive (false);
      }
     
      // Palm Web Clipping Application (a.k.a. PQA)
      // e.g. "Mozilla/2.0 (compatible; Elaine/2.0)"
      else if (theUserAgent.indexOf ("elaine") != -1)
      {
        retVal [1] = "wca";
        theIndex = theUserAgent.indexOf ("/");
        theUserAgent = theUserAgent.substring (theIndex + 1);
        theIndex = theUserAgent.indexOf (")");
        retVal [2] = theUserAgent.substring (0, theIndex);
       
        // If we are dealing with a RIM device, set the dimension to 132x64
        if ((theUserAgent.indexOf("rim") != -1) && (theUserAgent.indexOf("957") == -1))
        {
          theSession.setClientDimension(new Dimension(132, 64));
        }
        // All Palms have 160x160 screens.
        else
        {
          theSession.setClientDimension(new Dimension(160, 160));
        }
      }
     
      // Netscape
      // e.g. "Mozilla/4.76 (Macintosh; U; PPC)"
      else if (theUserAgent.indexOf ("mozilla") != -1)
      {
        retVal [1] = "netscape";
        theIndex = theUserAgent.indexOf ("/");
        theUserAgent = theUserAgent.substring (theIndex + 1);
        theIndex = theUserAgent.indexOf (" ");
        retVal [2] = theUserAgent.substring (0, theIndex);
      }
     
      // Lynx
      // e.g. "Lynx/2.8.3rel.1 libwww-FM/2.14"
      else if (theUserAgent.indexOf ("lynx") == 0)
      {
        retVal [1] = "lynx";
        theIndex = theUserAgent.indexOf ("/");
        theUserAgent = theUserAgent.substring (theIndex + 1);
        theIndex = theUserAgent.indexOf (" ");
        retVal [2] = theUserAgent.substring (0, theIndex);
      }
     
      // UP.Browser
      else if ((theIndex = theUserAgent.indexOf ("up.browser")) != -1)
      {
        retVal [1] = "up";
        theIndex = theUserAgent.indexOf ("/");
        theUserAgent = theUserAgent.substring (theIndex + 1);
        theIndex = theUserAgent.indexOf (" ");
        int theOther = theUserAgent.indexOf ("-");
        if (theOther != -1 && theOther < theIndex)
        {
          theIndex = theOther;
        }
        retVal [2] = theUserAgent.substring (0, theIndex);
        String theDimension = (String) theHeaderValues.get ("x-up-devcap-screenpixels");
        if (theDimension != null)
        {
          int theComma = theDimension.indexOf (',');
          theSession.setClientDimension (new Dimension (Integer.parseInt (theDimension.substring (0, theComma)),
                                  Integer.parseInt (theDimension.substring (theComma + 1))));
        }
      }
     
      // Klondike
      else if (theUserAgent.indexOf ("klondike") != -1)
      {
        retVal [1] = "klondike";
        retVal [2] = null;
      }
     
      // Wapsody
      else if (theUserAgent.indexOf ("wapsody") != -1)
      {
        retVal [1] = "wapsody";
        retVal [2] = null;
      }
     
      // Nokia
      else if (theUserAgent.indexOf ("nokia") != -1)
      {
        retVal [1] = "nokia";
        //
        //  7110 is (96 x 65)
        //
        if ((theIndex = theUserAgent.indexOf ("7110")) != -1)
        {
          theSession.setClientDimension (new Dimension (96, 65));
          theUserAgent = theUserAgent.substring (theIndex + 5);
        }
       
        theIndex = theUserAgent.indexOf ("/");
        if (theIndex != -1)
View Full Code Here

      //  Notify the session that a renderer has been created
      //
      MComponent theRootParent = aComponent.getRootParent ();
      if (theRootParent instanceof MauiApplication)
      {
        HTTPSession theSession = ((MauiApplication) theRootParent).getSession ();
        if (theSession != null)
        {
          theSession.rendererCreated (new RendererEvent (this, retVal, aComponent, aClientClassification));
        }
      }
    }
    return retVal;
  }
View Full Code Here

TOP

Related Classes of com.bitmovers.maui.engine.httpserver.HTTPSession

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.