当前位置: 首页>>代码示例>>Java>>正文


Java Manager.findSession方法代码示例

本文整理汇总了Java中org.apache.catalina.Manager.findSession方法的典型用法代码示例。如果您正苦于以下问题:Java Manager.findSession方法的具体用法?Java Manager.findSession怎么用?Java Manager.findSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.catalina.Manager的用法示例。


在下文中一共展示了Manager.findSession方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPrimaryIndicator

import org.apache.catalina.Manager; //导入方法依赖的package包/类
/**
 * Mark Request that processed at primary node with attribute
 * primaryIndicatorName
 * 
 * @param request
 * @throws IOException
 */
protected void createPrimaryIndicator(Request request) throws IOException {
	String id = request.getRequestedSessionId();
	if ((id != null) && (id.length() > 0)) {
		Manager manager = request.getContext().getManager();
		Session session = manager.findSession(id);
		if (session instanceof ClusterSession) {
			ClusterSession cses = (ClusterSession) session;
			if (log.isDebugEnabled())
				log.debug(sm.getString("ReplicationValve.session.indicator", request.getContext().getName(), id,
						primaryIndicatorName, Boolean.valueOf(cses.isPrimarySession())));
			request.setAttribute(primaryIndicatorName, cses.isPrimarySession() ? Boolean.TRUE : Boolean.FALSE);
		} else {
			if (log.isDebugEnabled()) {
				if (session != null) {
					log.debug(sm.getString("ReplicationValve.session.found", request.getContext().getName(), id));
				} else {
					log.debug(sm.getString("ReplicationValve.session.invalid", request.getContext().getName(), id));
				}
			}
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:30,代码来源:ReplicationValve.java

示例2: createPrimaryIndicator

import org.apache.catalina.Manager; //导入方法依赖的package包/类
/**
 * Mark Request that processed at primary node with attribute
 * primaryIndicatorName
 * 
 * @param request
 * @throws IOException
 */
protected void createPrimaryIndicator(Request request) throws IOException {
    String id = request.getRequestedSessionId();
    if ((id != null) && (id.length() > 0)) {
        Manager manager = request.getContext().getManager();
        Session session = manager.findSession(id);
        if (session instanceof ClusterSession) {
            ClusterSession cses = (ClusterSession) session;
            if (log.isDebugEnabled())
                log.debug(sm.getString(
                        "ReplicationValve.session.indicator", request.getContext().getName(),id,
                        primaryIndicatorName,
                        Boolean.valueOf(cses.isPrimarySession())));
            request.setAttribute(primaryIndicatorName, cses.isPrimarySession()?Boolean.TRUE:Boolean.FALSE);
        } else {
            if (log.isDebugEnabled()) {
                if (session != null) {
                    log.debug(sm.getString(
                            "ReplicationValve.session.found", request.getContext().getName(),id));
                } else {
                    log.debug(sm.getString(
                            "ReplicationValve.session.invalid", request.getContext().getName(),id));
                }
            }
        }
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:34,代码来源:ReplicationValve.java

示例3: isRequestedSessionIdValid

import org.apache.catalina.Manager; //导入方法依赖的package包/类
/**
 * Return <code>true</code> if the session identifier included in this
 * request identifies a valid session.
 */
public boolean isRequestedSessionIdValid() {

    if (requestedSessionId == null)
        return (false);
    if (context == null)
        return (false);
    Manager manager = context.getManager();
    if (manager == null)
        return (false);
    Session session = null;
    try {
        session = manager.findSession(requestedSessionId);
    } catch (IOException e) {
        session = null;
    }
    if ((session != null) && session.isValid())
        return (true);
    else
        return (false);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:Request.java

示例4: getSession

import org.apache.catalina.Manager; //导入方法依赖的package包/类
/**
 * Return the internal Session that is associated with this HttpRequest,
 * possibly creating a new one if necessary, or <code>null</code> if
 * there is no such session and we did not create one.
 *
 * @param request The HttpRequest we are processing
 * @param create Should we create a session if needed?
 */
protected Session getSession(HttpRequest request, boolean create) {

    HttpServletRequest hreq =
        (HttpServletRequest) request.getRequest();
    HttpSession hses = hreq.getSession(create);
    if (hses == null)
        return (null);
    Manager manager = context.getManager();
    if (manager == null)
        return (null);
    else {
        try {
            return (manager.findSession(hses.getId()));
        } catch (IOException e) {
            return (null);
        }
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:28,代码来源:AuthenticatorBase.java

示例5: expire

import org.apache.catalina.Manager; //导入方法依赖的package包/类
private void expire(SingleSignOnSessionKey key) {
    if (engine == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.engineNull", key));
        return;
    }
    Container host = engine.findChild(key.getHostName());
    if (host == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.hostNotFound", key));
        return;
    }
    Context context = (Context) host.findChild(key.getContextName());
    if (context == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.contextNotFound", key));
        return;
    }
    Manager manager = context.getManager();
    if (manager == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerNotFound", key));
        return;
    }
    Session session = null;
    try {
        session = manager.findSession(key.getSessionId());
    } catch (IOException e) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerError", key), e);
        return;
    }
    if (session == null) {
        containerLog.warn(sm.getString("singleSignOn.sessionExpire.sessionNotFound", key));
        return;
    }
    session.expire();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:34,代码来源:SingleSignOn.java

示例6: isRequestedSessionIdValid

import org.apache.catalina.Manager; //导入方法依赖的package包/类
/**
 * Returns true if the request specifies a JSESSIONID that is valid within
 * the context of this ApplicationHttpRequest, false otherwise.
 *
 * @return true if the request specifies a JSESSIONID that is valid within
 * the context of this ApplicationHttpRequest, false otherwise.
 */
@Override
public boolean isRequestedSessionIdValid() {

    if (crossContext) {

        String requestedSessionId = getRequestedSessionId();
        if (requestedSessionId == null)
            return (false);
        if (context == null)
            return (false);
        Manager manager = context.getManager();
        if (manager == null)
            return (false);
        Session session = null;
        try {
            session = manager.findSession(requestedSessionId);
        } catch (IOException e) {
            // Ignore
        }
        if ((session != null) && session.isValid()) {
            return (true);
        } else {
            return (false);
        }

    } else {
        return super.isRequestedSessionIdValid();
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:37,代码来源:ApplicationHttpRequest.java

示例7: isRequestedSessionIdValid

import org.apache.catalina.Manager; //导入方法依赖的package包/类
/**
 * Returns true if the request specifies a JSESSIONID that is valid within
 * the context of this ApplicationHttpRequest, false otherwise.
 *
 * @return true if the request specifies a JSESSIONID that is valid within
 * the context of this ApplicationHttpRequest, false otherwise.
 */
public boolean isRequestedSessionIdValid() {

    if (crossContext) {

        String requestedSessionId = getRequestedSessionId();
        if (requestedSessionId == null)
            return (false);
        if (context == null)
            return (false);
        Manager manager = context.getManager();
        if (manager == null)
            return (false);
        Session session = null;
        try {
            session = manager.findSession(requestedSessionId);
        } catch (IOException e) {
            session = null;
        }
        if ((session != null) && session.isValid()) {
            return (true);
        } else {
            return (false);
        }

    } else {
        return super.isRequestedSessionIdValid();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:ApplicationHttpRequest.java

示例8: expire

import org.apache.catalina.Manager; //导入方法依赖的package包/类
private void expire(SingleSignOnSessionKey key) {
	if (engine == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.engineNull", key));
		return;
	}
	Container host = engine.findChild(key.getHostName());
	if (host == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.hostNotFound", key));
		return;
	}
	Context context = (Context) host.findChild(key.getContextName());
	if (context == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.contextNotFound", key));
		return;
	}
	Manager manager = context.getManager();
	if (manager == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerNotFound", key));
		return;
	}
	Session session = null;
	try {
		session = manager.findSession(key.getSessionId());
	} catch (IOException e) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.managerError", key), e);
		return;
	}
	if (session == null) {
		containerLog.warn(sm.getString("singleSignOn.sessionExpire.sessionNotFound", key));
		return;
	}
	session.expire();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:34,代码来源:SingleSignOn.java

示例9: isRequestedSessionIdValid

import org.apache.catalina.Manager; //导入方法依赖的package包/类
/**
 * Returns true if the request specifies a JSESSIONID that is valid within
 * the context of this ApplicationHttpRequest, false otherwise.
 *
 * @return true if the request specifies a JSESSIONID that is valid within
 *         the context of this ApplicationHttpRequest, false otherwise.
 */
@Override
public boolean isRequestedSessionIdValid() {

	if (crossContext) {

		String requestedSessionId = getRequestedSessionId();
		if (requestedSessionId == null)
			return (false);
		if (context == null)
			return (false);
		Manager manager = context.getManager();
		if (manager == null)
			return (false);
		Session session = null;
		try {
			session = manager.findSession(requestedSessionId);
		} catch (IOException e) {
			// Ignore
		}
		if ((session != null) && session.isValid()) {
			return (true);
		} else {
			return (false);
		}

	} else {
		return super.isRequestedSessionIdValid();
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:37,代码来源:ApplicationHttpRequest.java

示例10: doGetSession

import org.apache.catalina.Manager; //导入方法依赖的package包/类
private HttpSession doGetSession(boolean create) {
    // There cannot be a session if no context has been assigned yet
    if (context == null)
        return (null);

    // Return the current session if it exists and is valid
    if ((session != null) && !session.isValid())
        session = null;
    if (session != null)
        return (session.getSession());


    // Return the requested session if it exists and is valid
    Manager manager = null;
    if (context != null)
        manager = context.getManager();

    if (manager == null)
        return (null);      // Sessions are not supported

    if (requestedSessionId != null) {
        try {
            session = manager.findSession(requestedSessionId);
        } catch (IOException e) {
            session = null;
        }
        if ((session != null) && !session.isValid())
            session = null;
        if (session != null) {
            return (session.getSession());
        }
    }

    // Create a new session if requested and the response is not committed
    if (!create)
        return (null);
    if ((context != null) && (response != null) &&
        context.getCookies() &&
        response.getResponse().isCommitted()) {
        throw new IllegalStateException
          (sm.getString("httpRequestBase.createCommitted"));
    }

    session = manager.createSession();
    if (session != null)
        return (session.getSession());
    else
        return (null);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:51,代码来源:HttpRequestBase.java

示例11: invoke

import org.apache.catalina.Manager; //导入方法依赖的package包/类
/**
 * Select the appropriate child Context to process this request,
 * based on the specified request URI.  If no matching Context can
 * be found, return an appropriate HTTP error.
 *
 * @param request Request to be processed
 * @param response Response to be produced
 * @param valveContext Valve context used to forward to the next Valve
 *
 * @exception IOException if an input/output error occurred
 * @exception ServletException if a servlet error occurred
 */
public void invoke(Request request, Response response,
                   ValveContext valveContext)
    throws IOException, ServletException {

    // Validate the request and response object types
    if (!(request.getRequest() instanceof HttpServletRequest) ||
        !(response.getResponse() instanceof HttpServletResponse)) {
        return;     // NOTE - Not much else we can do generically
    }

    // Select the Context to be used for this Request
    StandardHost host = (StandardHost) getContainer();
    Context context = (Context) host.map(request, true);
    if (context == null) {
        ((HttpServletResponse) response.getResponse()).sendError
            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
             sm.getString("standardHost.noContext"));
        return;
    }

    // Bind the context CL to the current thread
    Thread.currentThread().setContextClassLoader
        (context.getLoader().getClassLoader());

    // Update the session last access time for our session (if any)
    HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
    String sessionId = hreq.getRequestedSessionId();
    if (sessionId != null) {
        Manager manager = context.getManager();
        if (manager != null) {
            Session session = manager.findSession(sessionId);
            if ((session != null) && session.isValid())
                session.access();
        }
    }

    // Ask this Context to process this request
    context.invoke(request, response);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:53,代码来源:StandardHostValve.java


注:本文中的org.apache.catalina.Manager.findSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。