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


Java Request.setAttribute方法代码示例

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


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

示例1: createPrimaryIndicator

import org.apache.catalina.connector.Request; //导入方法依赖的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: changeRequestSessionID

import org.apache.catalina.connector.Request; //导入方法依赖的package包/类
/**
 * Change Request Session id
 * @param request current request
 * @param sessionId
 *            original session id
 * @param newSessionID
 *            new session id for node migration
 */
protected void changeRequestSessionID(Request request, String sessionId, String newSessionID) {
    request.changeSessionId(newSessionID);

    // set original sessionid at request, to allow application detect the
    // change
    if (sessionIdAttribute != null && !"".equals(sessionIdAttribute)) {
        if (log.isDebugEnabled()) {
            log.debug(sm.getString("jvmRoute.set.orignalsessionid",sessionIdAttribute,sessionId));
        }
        request.setAttribute(sessionIdAttribute, sessionId);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:JvmRouteBinderValve.java

示例3: createPrimaryIndicator

import org.apache.catalina.connector.Request; //导入方法依赖的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

示例4: invoke

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

    // Disallow any direct access to resources under WEB-INF or META-INF
    MessageBytes requestPathMB = request.getRequestPathMB();
    if ((requestPathMB.startsWithIgnoreCase("/META-INF/", 0))
            || (requestPathMB.equalsIgnoreCase("/META-INF"))
            || (requestPathMB.startsWithIgnoreCase("/WEB-INF/", 0))
            || (requestPathMB.equalsIgnoreCase("/WEB-INF"))) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
    }

    // Select the Wrapper to be used for this Request
    Wrapper wrapper = request.getWrapper();
    if (wrapper == null || wrapper.isUnavailable()) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;
    }

    // Acknowledge the request
    try {
        response.sendAcknowledgement();
    } catch (IOException ioe) {
        container.getLogger().error(sm.getString(
                "standardContextValve.acknowledgeException"), ioe);
        request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, ioe);
        response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        return;
    }
    
    if (request.isAsyncSupported()) {
        request.setAsyncSupported(wrapper.getPipeline().isAsyncSupported());
    }
    wrapper.getPipeline().getFirst().invoke(request, response);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:49,代码来源:StandardContextValve.java

示例5: changeRequestSessionID

import org.apache.catalina.connector.Request; //导入方法依赖的package包/类
/**
 * Change Request Session id
 * 
 * @param request
 *            current request
 * @param sessionId
 *            original session id
 * @param newSessionID
 *            new session id for node migration
 */
protected void changeRequestSessionID(Request request, String sessionId, String newSessionID) {
	request.changeSessionId(newSessionID);

	// set original sessionid at request, to allow application detect the
	// change
	if (sessionIdAttribute != null && !"".equals(sessionIdAttribute)) {
		if (log.isDebugEnabled()) {
			log.debug(sm.getString("jvmRoute.set.orignalsessionid", sessionIdAttribute, sessionId));
		}
		request.setAttribute(sessionIdAttribute, sessionId);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:23,代码来源:JvmRouteBinderValve.java

示例6: invoke

import org.apache.catalina.connector.Request; //导入方法依赖的package包/类
public void invoke(Request request, Response response)
    throws IOException, ServletException {

    /* mod_header converts the '\n' into ' ' so we have to rebuild the client certificate */
    String strcert0 = mygetHeader(request, "ssl_client_cert");
    if (strcert0 != null && strcert0.length()>28) {
        String strcert1 = strcert0.replace(' ', '\n');
        String strcert2 = strcert1.substring(28, strcert1.length()-26);
        String strcert3 = new String("-----BEGIN CERTIFICATE-----\n");
        String strcert4 = strcert3.concat(strcert2);
        String strcerts = strcert4.concat("\n-----END CERTIFICATE-----\n");
        // ByteArrayInputStream bais = new ByteArrayInputStream(strcerts.getBytes("UTF-8"));
        ByteArrayInputStream bais = new ByteArrayInputStream(strcerts.getBytes());
        X509Certificate jsseCerts[] = null;
        try {
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
            X509Certificate cert = (X509Certificate) cf.generateCertificate(bais);
            jsseCerts = new X509Certificate[1];
            jsseCerts[0] = cert;
        } catch (java.security.cert.CertificateException e) {
            System.out.println("SSLValve failed " + strcerts);
            System.out.println("SSLValve failed " + e);
        }
        request.setAttribute("javax.servlet.request.X509Certificate", jsseCerts);
    }
    strcert0 = mygetHeader(request, "ssl_cipher");
    if (strcert0 != null) {
        request.setAttribute("javax.servlet.request.cipher_suite", strcert0);
    }
    strcert0 = mygetHeader(request, "ssl_session_id");
    if (strcert0 != null) {
        request.setAttribute("javax.servlet.request.ssl_session", strcert0);
    }
    strcert0 = mygetHeader(request, "ssl_cipher_usekeysize");
    if (strcert0 != null) {
        request.setAttribute("javax.servlet.request.key_size", strcert0);
    }
    getNext().invoke(request, response);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:SSLValve.java


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