private String[] parseDirectActionRequest(AWRequest request) { String actionName = DefaultActionName; String className = DefaultDirectActionClassName; AWApplication application = application(); Class directActionClass = null; String[] requestHandlerPathComponents = request.requestHandlerPath(); if (requestHandlerPathComponents != null) { AWNodeManager nodeManager = application.getNodeManager(); if (nodeManager != null) { requestHandlerPathComponents = nodeManager.filterUrlForNodeCallback(requestHandlerPathComponents); } int requestHandlerPathComponentsLength = requestHandlerPathComponents.length; if (requestHandlerPathComponentsLength > 0) { actionName = requestHandlerPathComponents[0]; } // Hack -- check explicitly for awres so we can use // path rather than query string -- for webserver caching of resources -- // example: http://host/ACM/Main/ad/awres/realm/imagename.jpg // if we can modify the webserver cache to understand query strings // then we can switch to // http://host/ACM/Main/ad/awimg?realm=xxxx&filename=xxxx if (requestHandlerPathComponentsLength > 1 && !AWDirectAction.AWResActionName.equals(actionName)) { className = application.directActionClassNameForKey(requestHandlerPathComponents[1]); // try to find a class for the className if (StringUtil.nullOrEmptyOrBlankString(className)) { className = DefaultDirectActionClassName; } else { directActionClass = AWUtil.classForName(className); if (directActionClass == null) { directActionClass = application.resourceManager().classForName(className); if (directActionClass == null) { className = DefaultDirectActionClassName; } } } } } String[] directActionName = new String[2]; directActionName[ClassNameIndex] = className; directActionName[ActionNameIndex] = actionName; return directActionName; }
private boolean attemptSavePage(AWRequestContext requestContext, AWPage page) { // attemptSavePage checks for either a valid sessionId or an existing session // in the requestContext // session id, no existing session -- normal request that does not cause the // session to get set in the requestContext during take or invoke // no session id, existing session (before append) -- request that causes a new // session to be associated with the requestContext during take, invoke, // or session validation (aka sso) // no session id, existing session (after append) -- request that causes a new // session to be associated with the requestContext during append to response // see Note [sessionless requests] below boolean pageSaved = false; if (page.pageComponent().shouldCachePage() && (!StringUtil.nullOrEmptyOrBlankString(requestContext.request().sessionId()) || requestContext.session(false) != null)) { Log.aribaweb.debug( "AWDirectActionRequestHandler: session exists -- saving page for %s", page.pageComponent().getClass().getName()); requestContext.session().savePage(page); pageSaved = true; } return pageSaved; }