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


Java Request类代码示例

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


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

示例1: sessionDestroyed

import org.apache.catalina.connector.Request; //导入依赖的package包/类
@Override
public void sessionDestroyed(HttpSessionEvent se) {
	// Close all Comet connections associated with this session
	Request[] reqs = (Request[]) se.getSession().getAttribute(cometRequestsAttribute);
	if (reqs != null) {
		for (int i = 0; i < reqs.length; i++) {
			Request req = reqs[i];
			try {
				CometEventImpl event = req.getEvent();
				event.setEventType(CometEvent.EventType.END);
				event.setEventSubType(CometEvent.EventSubType.SESSION_END);
				((CometProcessor) req.getWrapper().getServlet()).event(event);
				event.close();
			} catch (Exception e) {
				req.getWrapper().getParent().getLogger()
						.warn(sm.getString("cometConnectionManagerValve.listenerEvent"), e);
			}
		}
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:CometConnectionManagerValve.java

示例2: resetReplicationRequest

import org.apache.catalina.connector.Request; //导入依赖的package包/类
/**
 * Fix memory leak for long sessions with many changes, when no backup member exists!
 * @param request current request after response is generated
 * @param isCrossContext check crosscontext threadlocal
 */
protected void resetReplicationRequest(Request request, boolean isCrossContext) {
    Session contextSession = request.getSessionInternal(false);
    if(contextSession instanceof DeltaSession){
        resetDeltaRequest(contextSession);
        ((DeltaSession)contextSession).setPrimarySession(true);
    }
    if(isCrossContext) {
        List<DeltaSession> sessions = crossContextSessions.get();
        if(sessions != null && sessions.size() >0) {
            Iterator<DeltaSession> iter = sessions.iterator();
            for(; iter.hasNext() ;) {          
                Session session = iter.next();
                resetDeltaRequest(session);
                if(session instanceof DeltaSession)
                    ((DeltaSession)contextSession).setPrimarySession(true);

            }
        }
    }                     
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:26,代码来源:ReplicationValve.java

示例3: invoke

import org.apache.catalina.connector.Request; //导入依赖的package包/类
/**
 * Select the appropriate child Host to process this request,
 * based on the requested server name.  If no matching Host 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 final void invoke(Request request, Response response)
    throws IOException, ServletException {

    // Select the Host to be used for this Request
    Host host = request.getHost();
    if (host == null) {
        response.sendError
            (HttpServletResponse.SC_BAD_REQUEST,
             sm.getString("standardEngine.noHost", 
                          request.getServerName()));
        return;
    }

    // Ask this Host to process this request
    host.getPipeline().getFirst().invoke(request, response);

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

示例4: addElement

import org.apache.catalina.connector.Request; //导入依赖的package包/类
@Override
public void addElement(StringBuilder buf, Date date, Request request, Response response, long time) {
	// Don't need to flush since trigger for log message is after the
	// response has been committed
	long length = response.getBytesWritten(false);
	if (length <= 0) {
		// Protect against nulls and unexpected types as these values
		// may be set by untrusted applications
		Object start = request.getAttribute(Globals.SENDFILE_FILE_START_ATTR);
		if (start instanceof Long) {
			Object end = request.getAttribute(Globals.SENDFILE_FILE_END_ATTR);
			if (end instanceof Long) {
				length = ((Long) end).longValue() - ((Long) start).longValue();
			}
		}
	}
	if (length <= 0 && conversion) {
		buf.append('-');
	} else {
		buf.append(length);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:23,代码来源:AccessLogValve.java

示例5: buildRedirect

import org.apache.catalina.connector.Request; //导入依赖的package包/类
private String buildRedirect(Request request) {
    StringBuffer location =
        new StringBuffer(request.getRequestURL().length());
    location.append(request.getScheme());
    location.append("://");
    location.append(request.getHost().getName());
    location.append(':');
    // If we include the port, even if it is 80, then MS clients will use
    // a WebDAV client that works rather than the MiniRedir that has
    // problems with BASIC authentication
    location.append(request.getServerPort());
    location.append(request.getRequestURI());
    return location.toString();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:WebdavFixValve.java

示例6: sendSessionReplicationMessage

import org.apache.catalina.connector.Request; //导入依赖的package包/类
/**
 * Send Cluster Replication Request
 * @param request current request
 * @param manager session manager
 * @param cluster replication cluster
 */
protected void sendSessionReplicationMessage(Request request,
        ClusterManager manager, CatalinaCluster cluster) {
    Session session = request.getSessionInternal(false);
    if (session != null) {
        String uri = request.getDecodedRequestURI();
        // request without session change
        if (!isRequestWithoutSessionChange(uri)) {
            if (log.isDebugEnabled())
                log.debug(sm.getString("ReplicationValve.invoke.uri", uri));
            sendMessage(session,manager,cluster);
        } else
            if(doStatistics())
                nrOfFilterRequests++;
    }

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:23,代码来源:ReplicationValve.java

示例7: invoke

import org.apache.catalina.connector.Request; //导入依赖的package包/类
/**
 * Select the appropriate child Host to process this request, based on the
 * requested server name. If no matching Host 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 {

	// Select the Host to be used for this Request
	Host host = request.getHost();
	if (host == null) {
		response.sendError(HttpServletResponse.SC_BAD_REQUEST,
				sm.getString("standardEngine.noHost", request.getServerName()));
		return;
	}
	if (request.isAsyncSupported()) {
		request.setAsyncSupported(host.getPipeline().isAsyncSupported());
	}

	// Ask this Host to process this request
	host.getPipeline().getFirst().invoke(request, response);

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:34,代码来源:StandardEngineValve.java

示例8: invoke

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

    CometEventImpl event = new CometEventImpl(request, response);

    getNext().invoke(request, response);

    if (request.isComet()) {
        Thread t = new AsyncCometCloseThread(event);
        t.start();
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:TestCometProcessor.java

示例9: setUserRolesFromStaticToken

import org.apache.catalina.connector.Request; //导入依赖的package包/类
private void setUserRolesFromStaticToken(final Request request, final Token token) {
    final List<String> roles = token.getRoles();
    roles.add("islandora");
    final String name = token.getUser();
    final GenericPrincipal principal = new GenericPrincipal(name, null, roles);
    request.setUserPrincipal(principal);
}
 
开发者ID:Islandora-CLAW,项目名称:Syn,代码行数:8,代码来源:SynValve.java

示例10: sendSessionIDClusterBackup

import org.apache.catalina.connector.Request; //导入依赖的package包/类
/**
 * Send the changed Sessionid to all clusternodes.
 * 
 * @see JvmRouteSessionIDBinderListener#messageReceived(
 *            org.apache.catalina.ha.ClusterMessage)
 * @param sessionId
 *            current failed sessionid
 * @param newSessionID
 *            new session id, bind to the new cluster node
 */
protected void sendSessionIDClusterBackup(Request request, String sessionId,
        String newSessionID) {
    CatalinaCluster c = getCluster();
    if (c != null && !(getManager(request) instanceof BackupManager)) {
        SessionIDMessage msg = new SessionIDMessage();
        msg.setOrignalSessionID(sessionId);
        msg.setBackupSessionID(newSessionID);
        Context context = request.getContext();
        msg.setContextName(context.getName());
        msg.setHost(context.getParent().getName());
        c.send(msg);
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:24,代码来源:JvmRouteBinderValve.java

示例11: addElement

import org.apache.catalina.connector.Request; //导入依赖的package包/类
@Override
public void addElement(StringBuilder buf, Date date, Request request,
        Response response, long time) {
    if (requestAttributesEnabled) {
        Object proto = request.getAttribute(PROTOCOL_ATTRIBUTE);
        if (proto == null) {
            buf.append(request.getProtocol());
        } else {
            buf.append(proto);
        }
    } else {
        buf.append(request.getProtocol());
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:15,代码来源:AccessLogValve.java

示例12: matchRequest

import org.apache.catalina.connector.Request; //导入依赖的package包/类
/**
 * Does this request match the saved one (so that it must be the redirect
 * we signaled after successful authentication?
 *
 * @param request The request to be verified
 */
protected boolean matchRequest(Request request) {

  // Has a session been created?
  Session session = request.getSessionInternal(false);
  if (session == null) {
    return (false);
}

  // Is there a saved request?
  SavedRequest sreq = (SavedRequest)
      session.getNote(Constants.FORM_REQUEST_NOTE);
  if (sreq == null) {
    return (false);
}

  // Is there a saved principal?
  if (session.getNote(Constants.FORM_PRINCIPAL_NOTE) == null) {
    return (false);
}

  // Does the request URI match?
  String decodedRequestURI = request.getDecodedRequestURI();
  if (decodedRequestURI == null) {
    return (false);
}
  return (decodedRequestURI.equals(sreq.getDecodedRequestURI()));
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:34,代码来源:FormAuthenticator.java

示例13: 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:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:49,代码来源:StandardContextValve.java

示例14: invoke

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

    if (threshold <= 0) {
        // short-circuit if not monitoring stuck threads
        getNext().invoke(request, response);
        return;
    }

    // Save the thread/runnable
    // Keeping a reference to the thread object here does not prevent
    // GC'ing, as the reference is removed from the Map in the finally clause

    Long key = Long.valueOf(Thread.currentThread().getId());
    StringBuffer requestUrl = request.getRequestURL();
    if(request.getQueryString()!=null) {
        requestUrl.append("?");
        requestUrl.append(request.getQueryString());
    }
    MonitoredThread monitoredThread = new MonitoredThread(Thread.currentThread(),
        requestUrl.toString(), interruptThreadThreshold > 0);
    activeThreads.put(key, monitoredThread);

    try {
        getNext().invoke(request, response);
    } finally {
        activeThreads.remove(key);
        if (monitoredThread.markAsDone() == MonitoredThreadState.STUCK) {
            if(monitoredThread.wasInterrupted()) {
                interruptedThreadsCount.incrementAndGet();
            }
            completedStuckThreadsQueue.add(
                    new CompletedStuckThread(monitoredThread.getThread(),
                        monitoredThread.getActiveTimeInMillis()));
        }
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:42,代码来源:StuckThreadDetectionValve.java

示例15: logout

import org.apache.catalina.connector.Request; //导入依赖的package包/类
@Override
public void logout(Request request) throws ServletException {
	Principal p = request.getPrincipal();
	if (p instanceof GenericPrincipal) {
		try {
			((GenericPrincipal) p).logout();
		} catch (Throwable t) {
			ExceptionUtils.handleThrowable(t);
			log.debug(sm.getString("authenticator.tomcatPrincipalLogoutFail"), t);
		}
	}

	register(request, request.getResponse(), null, null, null, null);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:15,代码来源:AuthenticatorBase.java


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