本文整理匯總了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);
}
}
}
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
}
示例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();
}
示例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++;
}
}
示例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);
}
示例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();
}
}
示例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);
}
示例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);
}
}
示例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());
}
}
示例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()));
}
示例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);
}
示例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);
}