Package com.webobjects.appserver

Examples of com.webobjects.appserver.WOSession


      if (ec == null && !ERXThreadStorage.wasInheritedFromParentThread()) {
      // this can be problematic, if called from a background thread with ERXThreadStorage.useInheritableThreadLocal=true,
        // which is the default. In my case it was called indirectly from ERXEntityClassDescription.Factory.classDescriptionNeededForEntityName
        // resulting in locking problems
       
            WOSession s = ERXSession.anySession();
            if (s != null) {
                ec = s.defaultEditingContext();
            }
        }
        EOModelGroup group;
        if (ec == null) {
            group = EOModelGroup.defaultGroup();
View Full Code Here


        return result;
    }

    public WOComponent listPrinterFriendlyVersion() {
        D2WContext d2wContext = d2wContext();
        WOSession session = session();
        WODisplayGroup displayGroup = displayGroup();
        EODataSource dataSource = dataSource();
        if(dataSource == null) {
          if (displayGroup instanceof ERXBatchingDisplayGroup) {
        ERXBatchingDisplayGroup dg = (ERXBatchingDisplayGroup) displayGroup;
              dataSource = ERXEOControlUtilities.dataSourceForArray(displayGroup.displayedObjects());
      } else {
              dataSource = ERXEOControlUtilities.dataSourceForArray(displayGroup.allObjects());
      }
        }
        D2WContext newContext = ERD2WContext.newContext(session);
        String newTask = d2wContext.task().equals("edit") ? "inspect" : d2wContext.task();
        // for editable list pages...
        if("list".equals(d2wContext().valueForKey("subTask"))) {
            newTask = "list";
        }
        newContext.takeValueForKey(newTask, "task");
        // not using subTask directly here because the cache mechanism relies on
        // being able to compute wether this key
        // is 'computable' (subTask is since a rule can fire to give a default)
        // or an external output
        //        newContext.takeValueForKey("excel","subTask");
        newContext.takeValueForKey("excel", "forcedSubTask");
        newContext.takeValueForKey(d2wContext.valueForKey("pageName"), "existingPageName");
        newContext.takeValueForKey(d2wContext.valueForKey("subTask"), "existingSubTask");
        newContext.takeValueForKey(d2wContext.valueForKey("pageConfiguration"), "pageConfiguration");
        newContext.takeValueForKey(d2wContext.entity(), "entity");
        ListPageInterface result = (ListPageInterface) WOApplication.application().pageWithName((String) newContext.valueForKey("pageName"), session.context());
        ((D2WPage) result).setLocalContext(newContext);

        result.setDataSource(dataSource);
        WODisplayGroup dg = null;
        if (result instanceof D2WListPage) {
View Full Code Here

    }
    return aResponse;
  }

  private WOResponse _dispatchWithPreparedApplication(WOApplication anApplication, WOContext aContext, NSDictionary someElements) {
    WOSession aSession = null;
    WOResponse aResponse = null;
    WOResponse errorResponse = null;
    String aSessionID = (String)someElements.objectForKey(WOApplication.application().sessionIdKey());

    if (aSessionID == null) {
View Full Code Here

          if (aContext == null)
            aContext = anApplication.createContextForRequest(aRequest);
          else {
            aContext._putAwakeComponentsToSleep();
          }
          WOSession aSession = aContext._session();
          aResponse = anApplication.handleException(exception, aContext);
          if (aSession != null)
          {
            try
            {
View Full Code Here

        if (automaticMessageEncodingEnabled()) {
            ERXMessageEncoding messageEncoding = null;
           
            // This should retrieve the session object belonging to the same
            // worker thread that's been calling the current handleRequest method.
            WOSession session;
            if(false) {
                // ak only enable when fixed
                // as we will create deadlocks checking out the session this early.
                WOContext context = ERXWOContext.currentContext();
                session = context != null ? context.session() : null;
View Full Code Here

     * checks if the new Session has already  a EOObjectStoreCoordinator assigned,
     * if not it assigns a EOObjectStoreCoordinator to the session.
     * @param n {@link WOSession#SessionDidCreateNotification}
     */
    public void sessionDidCreate(NSNotification n) {
        WOSession s = (WOSession) n.object();
        if (_oscForSession.get(s.sessionID()) == null) {
            _oscForSession.put(s.sessionID(), currentThreadObjectStore());
        }
    }
View Full Code Here

      try {
        request = ERWOAdaptorUtilities.asWORequest(req);
      } catch (IOException e) {
        throw NSForwardException._runtimeExceptionForThrowable(e);
      }
      WOSession session = ERWOAdaptorUtilities.existingSession(request);
      DefaultWOWebSocket socket = create(channel);
      socket.init(session);
      if (session != null) {
        WOApplication.application().saveSessionForContext(session.context());
      }
      return socket;
    } finally {
      ERXApplication._endRequest();
    }
View Full Code Here

    try {
      WOComponent component = _component;
      if (component != null) {
       
        // Build request handler path with session ID if needed
            WOSession aSession = session();
        String aContextId = context.contextID();
        StringBuilder requestHandlerPath = new StringBuilder();
        if (WOApplication.application().pageCacheSize() == 0) {
          if (aSession.storesIDsInURLs()) {
            requestHandlerPath.append(component.name());
            requestHandlerPath.append('/');
            requestHandlerPath.append(aSession.sessionID());
            requestHandlerPath.append('/');
            requestHandlerPath.append(aContextId);
            requestHandlerPath.append(".0");
          }
          else {
            requestHandlerPath.append(component.name());
            requestHandlerPath.append('/');
            requestHandlerPath.append(aContextId);
            requestHandlerPath.append(".0");
          }
        }
        else if (aSession.storesIDsInURLs()) {
          requestHandlerPath.append(aSession.sessionID());
          requestHandlerPath.append('/');
          requestHandlerPath.append(aContextId);
          requestHandlerPath.append(".0");
        }
        else {
View Full Code Here

  }
 
  public static WOSession existingSession(WORequest request) {
    WOApplication app = WOApplication.application();
    String sessionID = request.stringFormValueForKey(app.sessionIdKey());
    WOSession session = null;
    if(sessionID != null) {
      WOContext context = app.createContextForRequest(request);
      session = app.restoreSessionWithID(sessionID, context);
    }
    return session;
View Full Code Here

    // /JAssert.notNull( component );
    // /JAssert.notNull( component.context() );

    // /JAssert.notNull( ERJavaMail.sharedInstance().defaultSession() );

    WOSession session = component.context()._session();
    String response;

    component.context().generateCompleteURLs();
    if (session == null) {
      response = component.generateResponse().contentString();
    }
    else {
      boolean oldStoresIDsInURLs = session.storesIDsInURLs();
      session.setStoresIDsInURLs(true);
      response = component.generateResponse().contentString();
      session.setStoresIDsInURLs(oldStoresIDsInURLs);
    }
    component.context().generateRelativeURLs();

    // --
View Full Code Here

TOP

Related Classes of com.webobjects.appserver.WOSession

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.