當前位置: 首頁>>代碼示例>>Java>>正文


Java Response類代碼示例

本文整理匯總了Java中org.apache.catalina.connector.Response的典型用法代碼示例。如果您正苦於以下問題:Java Response類的具體用法?Java Response怎麽用?Java Response使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Response類屬於org.apache.catalina.connector包,在下文中一共展示了Response類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addElement

import org.apache.catalina.connector.Response; //導入依賴的package包/類
@Override
public void addElement(StringBuilder buf, Date date, Request request, Response response, long time) {
	if (requestAttributesEnabled && portType == PortType.LOCAL) {
		Object port = request.getAttribute(SERVER_PORT_ATTRIBUTE);
		if (port == null) {
			buf.append(request.getServerPort());
		} else {
			buf.append(port);
		}
	} else {
		if (portType == PortType.LOCAL) {
			buf.append(Integer.toString(request.getServerPort()));
		} else {
			buf.append(Integer.toString(request.getRemotePort()));
		}
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:18,代碼來源:AccessLogValve.java

示例2: addElement

import org.apache.catalina.connector.Response; //導入依賴的package包/類
@Override
public void addElement(StringBuilder buf, Date date, Request request,
        Response response, long time) {
    if (request != null) {
        String method = request.getMethod();
        if (method == null) {
            // No method means no request line
            buf.append('-');
        } else {
            buf.append(request.getMethod());
            buf.append(' ');
            buf.append(request.getRequestURI());
            if (request.getQueryString() != null) {
                buf.append('?');
                buf.append(request.getQueryString());
            }
            buf.append(' ');
            buf.append(request.getProtocol());
        }
    } else {
        buf.append('-');
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:24,代碼來源:AccessLogValve.java

示例3: addElement

import org.apache.catalina.connector.Response; //導入依賴的package包/類
public void addElement(StringBuffer buf, Date date, Request request,
        Response response, long time) {
    String query = null;
    if (request != null)
        query = request.getQueryString();
    if (query != null) {
        buf.append('?');
        buf.append(query);
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:AccessLogValve.java

示例4: invoke

import org.apache.catalina.connector.Response; //導入依賴的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:liaokailin,項目名稱:tomcat7,代碼行數:33,代碼來源:StandardEngineValve.java

示例5: invoke

import org.apache.catalina.connector.Response; //導入依賴的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

示例6: addElement

import org.apache.catalina.connector.Response; //導入依賴的package包/類
@Override
public void addElement(StringBuilder buf, Date date, Request request,
        Response response, long time) {
    if (request == null) {
        buf.append('-');
    } else {
        Session session = request.getSessionInternal(false);
        if (session == null) {
            buf.append('-');
        } else {
            buf.append(session.getIdInternal());
        }
    }
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:15,代碼來源:AccessLogValve.java

示例7: denyRequest

import org.apache.catalina.connector.Response; //導入依賴的package包/類
/**
 * Reject the request that was denied by this valve.
 * <p>If <code>invalidAuthenticationWhenDeny</code> is true
 * and the context has <code>preemptiveAuthentication</code>
 * set, set an invalid authorization header to trigger basic auth.
 *
 * @param request The servlet request to be processed
 * @param response The servlet response to be processed
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
protected void denyRequest(Request request, Response response)
        throws IOException, ServletException {
    if (invalidAuthenticationWhenDeny) {
        Context context = request.getContext();
        if (context != null && context.getPreemptiveAuthentication()) {
            if (request.getCoyoteRequest().getMimeHeaders().getValue("authorization") == null) {
                request.getCoyoteRequest().getMimeHeaders().addValue("authorization").setString("invalid");
            }
            getNext().invoke(request, response);
            return;
        }
    }
    response.sendError(denyStatus);
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:26,代碼來源:RequestFilterValve.java

示例8: addElement

import org.apache.catalina.connector.Response; //導入依賴的package包/類
@Override
public void addElement(StringBuilder buf, Date date, Request request,
        Response response, long time) {
    if (null != response) {
        Iterator<String> iter = response.getHeaders(header).iterator();
        if (iter.hasNext()) {
            StringBuilder buffer = new StringBuilder();
            boolean first = true;
            while (iter.hasNext()) {
                if (first) {
                    first = false;
                } else {
                    buffer.append(",");
                }
                buffer.append(iter.next());
            }
            buf.append(wrap(buffer.toString()));
        }
        return ;
    }
    buf.append("-");
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:23,代碼來源:ExtendedAccessLogValve.java

示例9: storeSession

import org.apache.catalina.connector.Response; //導入依賴的package包/類
private void storeSession(Request request, Response response) throws IOException {
	Session sessionInternal = request.getSessionInternal();
	if (sessionInternal != null) {
		MongoPersistentManager manager = (MongoPersistentManager) request.getContext().getManager();
		if (sessionInternal.isValid()) {
			log.debug(String.format("Request with session completed, saving session %s", sessionInternal.getId()));
			manager.getStore().save(sessionInternal);
		} else {
			log.debug(String.format("HTTP Session has been invalidated, removing %s", sessionInternal.getId()));
			manager.remove(sessionInternal);
		}
	}
}
 
開發者ID:appNG,項目名稱:appng-tomcat-session,代碼行數:14,代碼來源:MongoSessionTrackerValve.java

示例10: addElement

import org.apache.catalina.connector.Response; //導入依賴的package包/類
@Override
public void addElement(StringBuilder buf, Date date, Request request,
        Response response, long time) {
    HttpSession session = null;
    if (request != null) {
        session = request.getSession(false);
        if (session != null) {
            buf.append(wrap(session.getAttribute(attribute)));
        }
    }
}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:12,代碼來源:ExtendedAccessLogValve.java

示例11: invoke

import org.apache.catalina.connector.Response; //導入依賴的package包/類
/**
 * Register requests for tracking, whenever needed.
 *
 * @param request The servlet request to be processed
 * @param response The servlet response to be created
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
@Override
public void invoke(Request request, Response response)
    throws IOException, ServletException {
    // Perform the request
    getNext().invoke(request, response);

    if (request.isComet() && !response.isClosed()) {
        // Start tracking this connection, since this is a
        // begin event, and Comet mode is on
        HttpSession session = request.getSession(true);

        // Track the connection for webapp reload
        cometRequests.add(request);

        // Track the connection for session expiration
        synchronized (session) {
            Request[] requests = (Request[])
                    session.getAttribute(cometRequestsAttribute);
            if (requests == null) {
                requests = new Request[1];
                requests[0] = request;
                session.setAttribute(cometRequestsAttribute,
                        requests);
            } else {
                Request[] newRequests =
                    new Request[requests.length + 1];
                for (int i = 0; i < requests.length; i++) {
                    newRequests[i] = requests[i];
                }
                newRequests[requests.length] = request;
                session.setAttribute(cometRequestsAttribute, newRequests);
            }
        }
    }

}
 
開發者ID:sunmingshuai,項目名稱:apache-tomcat-7.0.73-with-comment,代碼行數:46,代碼來源:CometConnectionManagerValve.java

示例12: invoke

import org.apache.catalina.connector.Response; //導入依賴的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

示例13: logAccess

import org.apache.catalina.connector.Response; //導入依賴的package包/類
/**
 * Check this container for an access log and if none is found, look to the
 * parent. If there is no parent and still none is found, use the NoOp
 * access log.
 */
@Override
public void logAccess(Request request, Response response, long time,
        boolean useDefault) {
    
    boolean logged = false;
    
    if (getAccessLog() != null) {
        getAccessLog().log(request, response, time);
        logged = true;
    }
    
    if (getParent() != null) {
        // No need to use default logger once request/response has been logged
        // once
        getParent().logAccess(request, response, time, (useDefault && !logged));
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:23,代碼來源:ContainerBase.java

示例14: invoke

import org.apache.catalina.connector.Response; //導入依賴的package包/類
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
    this.remoteHost = request.getRemoteHost();
    this.remoteAddr = request.getRemoteAddr();
    this.scheme = request.getScheme();
    this.secure = request.isSecure();
    this.serverPort = request.getServerPort();
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:9,代碼來源:TestRemoteIpValve.java

示例15: invoke

import org.apache.catalina.connector.Response; //導入依賴的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


注:本文中的org.apache.catalina.connector.Response類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。