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


Java MimeHeaders.getName方法代码示例

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


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

示例1: prepareResponse

import org.apache.tomcat.util.http.MimeHeaders; //导入方法依赖的package包/类
/**
 * When committing the response, we have to validate the set of headers, as
 * well as setup the response filters.
 */
protected void prepareResponse()
    throws IOException {

    response.setCommitted(true);

    responseHeaderMessage.reset();
    responseHeaderMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);

    // HTTP header contents
    responseHeaderMessage.appendInt(response.getStatus());
    String message = null;
    if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER) {
        message = response.getMessage();
    }
    if (message == null){
        message = HttpMessages.getMessage(response.getStatus());
    } else {
        message = message.replace('\n', ' ').replace('\r', ' ');
    }
    if (message == null) {
        // Many httpd 2.x wants a non empty status message
        message = Integer.toString(response.getStatus());
    }
    tmpMB.setString(message);
    responseHeaderMessage.appendBytes(tmpMB);

    // Special headers
    MimeHeaders headers = response.getMimeHeaders();
    String contentType = response.getContentType();
    if (contentType != null) {
        headers.setValue("Content-Type").setString(contentType);
    }
    String contentLanguage = response.getContentLanguage();
    if (contentLanguage != null) {
        headers.setValue("Content-Language").setString(contentLanguage);
    }
    int contentLength = response.getContentLength();
    if (contentLength >= 0) {
        headers.setValue("Content-Length").setInt(contentLength);
    }

    // Other headers
    int numHeaders = headers.size();
    responseHeaderMessage.appendInt(numHeaders);
    for (int i = 0; i < numHeaders; i++) {            
        MessageBytes hN = headers.getName(i);
        int hC = Constants.getResponseAjpIndex(hN.toString());
        if (hC > 0) {
            responseHeaderMessage.appendInt(hC);
        }
        else {
            responseHeaderMessage.appendBytes(hN);
        }
        MessageBytes hV=headers.getValue(i);
        responseHeaderMessage.appendBytes(hV);
    }

    // Write to buffer
    responseHeaderMessage.end();
    outputBuffer.put(responseHeaderMessage.getBuffer(), 0, responseHeaderMessage.getLen());

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

示例2: prepareResponse

import org.apache.tomcat.util.http.MimeHeaders; //导入方法依赖的package包/类
/**
 * When committing the response, we have to validate the set of headers, as
 * well as setup the response filters.
 */
protected void prepareResponse()
    throws IOException {

    response.setCommitted(true);

    responseHeaderMessage.reset();
    responseHeaderMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);

    // HTTP header contents
    responseHeaderMessage.appendInt(response.getStatus());
    String message = null;
    if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER) {
        message = response.getMessage();
    }
    if (message == null){
        message = HttpMessages.getMessage(response.getStatus());
    } else {
        message = message.replace('\n', ' ').replace('\r', ' ');
    }
    if (message == null) {
        // Many httpd 2.x wants a non empty status message
        message = Integer.toString(response.getStatus());
    }
    tmpMB.setString(message);
    responseHeaderMessage.appendBytes(tmpMB);

    // Special headers
    MimeHeaders headers = response.getMimeHeaders();
    String contentType = response.getContentType();
    if (contentType != null) {
        headers.setValue("Content-Type").setString(contentType);
    }
    String contentLanguage = response.getContentLanguage();
    if (contentLanguage != null) {
        headers.setValue("Content-Language").setString(contentLanguage);
    }
    int contentLength = response.getContentLength();
    if (contentLength >= 0) {
        headers.setValue("Content-Length").setInt(contentLength);
    }

    // Other headers
    int numHeaders = headers.size();
    responseHeaderMessage.appendInt(numHeaders);
    for (int i = 0; i < numHeaders; i++) {
        MessageBytes hN = headers.getName(i);
        int hC = Constants.getResponseAjpIndex(hN.toString());
        if (hC > 0) {
            responseHeaderMessage.appendInt(hC);
        }
        else {
            responseHeaderMessage.appendBytes(hN);
        }
        MessageBytes hV=headers.getValue(i);
        responseHeaderMessage.appendBytes(hV);
    }

    // Write to buffer
    responseHeaderMessage.end();
    output.write(responseHeaderMessage.getBuffer(), 0, responseHeaderMessage.getLen());

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

示例3: prepareResponse

import org.apache.tomcat.util.http.MimeHeaders; //导入方法依赖的package包/类
/**
 * When committing the response, we have to validate the set of headers, as
 * well as setup the response filters.
 */
protected void prepareResponse() throws IOException {

	response.setCommitted(true);

	responseMessage.reset();
	responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);

	// Responses with certain status codes are not permitted to include a
	// response body.
	int statusCode = response.getStatus();
	if (statusCode < 200 || statusCode == 204 || statusCode == 205 || statusCode == 304) {
		// No entity body
		swallowResponse = true;
	}

	// Responses to HEAD requests are not permitted to incude a response
	// body.
	MessageBytes methodMB = request.method();
	if (methodMB.equals("HEAD")) {
		// No entity body
		swallowResponse = true;
	}

	// HTTP header contents
	responseMessage.appendInt(statusCode);
	String message = null;
	if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER
			&& HttpMessages.isSafeInHttpHeader(response.getMessage())) {
		message = response.getMessage();
	}
	if (message == null) {
		message = HttpMessages.getInstance(response.getLocale()).getMessage(response.getStatus());
	}
	if (message == null) {
		// mod_jk + httpd 2.x fails with a null status message - bug 45026
		message = Integer.toString(response.getStatus());
	}
	tmpMB.setString(message);
	responseMessage.appendBytes(tmpMB);

	// Special headers
	MimeHeaders headers = response.getMimeHeaders();
	String contentType = response.getContentType();
	if (contentType != null) {
		headers.setValue("Content-Type").setString(contentType);
	}
	String contentLanguage = response.getContentLanguage();
	if (contentLanguage != null) {
		headers.setValue("Content-Language").setString(contentLanguage);
	}
	long contentLength = response.getContentLengthLong();
	if (contentLength >= 0) {
		headers.setValue("Content-Length").setLong(contentLength);
	}

	// Other headers
	int numHeaders = headers.size();
	responseMessage.appendInt(numHeaders);
	for (int i = 0; i < numHeaders; i++) {
		MessageBytes hN = headers.getName(i);
		int hC = Constants.getResponseAjpIndex(hN.toString());
		if (hC > 0) {
			responseMessage.appendInt(hC);
		} else {
			responseMessage.appendBytes(hN);
		}
		MessageBytes hV = headers.getValue(i);
		responseMessage.appendBytes(hV);
	}

	// Write to buffer
	responseMessage.end();
	output(responseMessage.getBuffer(), 0, responseMessage.getLen());
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:79,代码来源:AbstractAjpProcessor.java

示例4: prepareResponse

import org.apache.tomcat.util.http.MimeHeaders; //导入方法依赖的package包/类
/**
 * When committing the response, we have to validate the set of headers, as
 * well as setup the response filters.
 */
protected void prepareResponse() throws IOException {

    response.setCommitted(true);

    responseMessage.reset();
    responseMessage.appendByte(Constants.JK_AJP13_SEND_HEADERS);

    // HTTP header contents
    responseMessage.appendInt(response.getStatus());
    String message = null;
    if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER &&
            HttpMessages.isSafeInHttpHeader(response.getMessage())) {
        message = response.getMessage();
    }
    if (message == null){
        message = HttpMessages.getMessage(response.getStatus());
    }
    if (message == null) {
        // mod_jk + httpd 2.x fails with a null status message - bug 45026
        message = Integer.toString(response.getStatus());
    }
    tmpMB.setString(message);
    responseMessage.appendBytes(tmpMB);

    // Special headers
    MimeHeaders headers = response.getMimeHeaders();
    String contentType = response.getContentType();
    if (contentType != null) {
        headers.setValue("Content-Type").setString(contentType);
    }
    String contentLanguage = response.getContentLanguage();
    if (contentLanguage != null) {
        headers.setValue("Content-Language").setString(contentLanguage);
    }
    long contentLength = response.getContentLengthLong();
    if (contentLength >= 0) {
        headers.setValue("Content-Length").setLong(contentLength);
    }

    // Other headers
    int numHeaders = headers.size();
    responseMessage.appendInt(numHeaders);
    for (int i = 0; i < numHeaders; i++) {
        MessageBytes hN = headers.getName(i);
        int hC = Constants.getResponseAjpIndex(hN.toString());
        if (hC > 0) {
            responseMessage.appendInt(hC);
        }
        else {
            responseMessage.appendBytes(hN);
        }
        MessageBytes hV=headers.getValue(i);
        responseMessage.appendBytes(hV);
    }

    // Write to buffer
    responseMessage.end();
    output(responseMessage.getBuffer(), 0,
            responseMessage.getLen());
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:65,代码来源:AbstractAjpProcessor.java


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