当前位置: 首页>>代码示例>>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;未经允许,请勿转载。