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


Java HttpMessages类代码示例

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


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

示例1: InternalAprOutputBuffer

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
/**
 * Default constructor.
 */
public InternalAprOutputBuffer(Response response, int headerBufferSize) {

    this.response = response;

    buf = new byte[headerBufferSize];
    if (headerBufferSize < (8 * 1024)) {
        bbuf = ByteBuffer.allocateDirect(6 * 1500);
    } else {
        bbuf = ByteBuffer.allocateDirect((headerBufferSize / 1500 + 1) * 1500);
    }

    outputStreamOutputBuffer = new SocketOutputBuffer();

    filterLibrary = new OutputFilter[0];
    activeFilters = new OutputFilter[0];
    lastActiveFilter = -1;

    committed = false;
    finished = false;

    // Cause loading of HttpMessages
    HttpMessages.getInstance(response.getLocale()).getMessage(200);

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

示例2: AjpProcessor

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
public AjpProcessor(int packetSize, JIoEndpoint endpoint) {

        this.endpoint = endpoint;

        request = new Request();
        request.setInputBuffer(new SocketInputBuffer());

        response = new Response();
        response.setHook(this);
        response.setOutputBuffer(new SocketOutputBuffer());
        request.setResponse(response);

        requestHeaderMessage = new AjpMessage(packetSize);
        responseHeaderMessage = new AjpMessage(packetSize);
        bodyMessage = new AjpMessage(packetSize);
        
        // Set the get body message buffer
        AjpMessage getBodyMessage = new AjpMessage(16);
        getBodyMessage.reset();
        getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
        getBodyMessage.appendInt(packetSize - Constants.READ_HEAD_LEN);
        getBodyMessage.end();
        getBodyMessageArray = new byte[getBodyMessage.getLen()];
        System.arraycopy(getBodyMessage.getBuffer(), 0, getBodyMessageArray, 
                0, getBodyMessage.getLen());

        // Cause loading of HexUtils
        int foo = HexUtils.DEC[0];

        // Cause loading of HttpMessages
        HttpMessages.getMessage(200);

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

示例3: InternalAprOutputBuffer

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
/**
 * Default constructor.
 */
public InternalAprOutputBuffer(Response response, int headerBufferSize) {

	this.response = response;

	buf = new byte[headerBufferSize];
	if (headerBufferSize < (8 * 1024)) {
		bbuf = ByteBuffer.allocateDirect(6 * 1500);
	} else {
		bbuf = ByteBuffer.allocateDirect((headerBufferSize / 1500 + 1) * 1500);
	}

	outputStreamOutputBuffer = new SocketOutputBuffer();

	filterLibrary = new OutputFilter[0];
	activeFilters = new OutputFilter[0];
	lastActiveFilter = -1;

	committed = false;
	finished = false;

	// Cause loading of HttpMessages
	HttpMessages.getInstance(response.getLocale()).getMessage(200);

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

示例4: InternalAprOutputBuffer

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
/**
 * Default constructor.
 */
public InternalAprOutputBuffer(Response response, int headerBufferSize) {

    this.response = response;

    buf = new byte[headerBufferSize];
    if (headerBufferSize < (8 * 1024)) {
        bbuf = ByteBuffer.allocateDirect(6 * 1500);
    } else {
        bbuf = ByteBuffer.allocateDirect((headerBufferSize / 1500 + 1) * 1500);
    }

    outputStreamOutputBuffer = new SocketOutputBuffer();

    filterLibrary = new OutputFilter[0];
    activeFilters = new OutputFilter[0];
    lastActiveFilter = -1;

    committed = false;
    finished = false;

    // Cause loading of HttpMessages
    HttpMessages.getMessage(200);

}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:28,代码来源:InternalAprOutputBuffer.java

示例5: encode

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
protected String encode(String value, String encoding) {
    String retVal = null;
    if (encoding.equalsIgnoreCase("url")) {
        retVal = urlEncoder.encode(value, "UTF-8");
    } else if (encoding.equalsIgnoreCase("none")) {
        retVal = value;
    } else if (encoding.equalsIgnoreCase("entity")) {
        retVal = HttpMessages.filter(value);
    } else {
        //This shouldn't be possible
        throw new IllegalArgumentException("Unknown encoding: " + encoding);
    }
    return retVal;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:SSIMediator.java

示例6: encode

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
protected String encode(String value, String encoding) {
    String retVal = null;
    if (encoding.equalsIgnoreCase("url")) {
        retVal = urlEncoder.encode(value);
    } else if (encoding.equalsIgnoreCase("none")) {
        retVal = value;
    } else if (encoding.equalsIgnoreCase("entity")) {
        retVal = HttpMessages.filter(value);
    } else {
        //This shouldn't be possible
        throw new IllegalArgumentException("Unknown encoding: " + encoding);
    }
    return retVal;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:SSIMediator.java

示例7: AjpAprProcessor

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
public AjpAprProcessor(int packetSize, AprEndpoint endpoint) {

        this.endpoint = endpoint;

        request = new Request();
        request.setInputBuffer(new SocketInputBuffer());

        response = new Response();
        response.setHook(this);
        response.setOutputBuffer(new SocketOutputBuffer());
        request.setResponse(response);

        requestHeaderMessage = new AjpMessage(packetSize);
        responseHeaderMessage = new AjpMessage(packetSize);
        bodyMessage = new AjpMessage(packetSize);
        
        // Allocate input and output buffers
        inputBuffer = ByteBuffer.allocateDirect(packetSize * 2);
        inputBuffer.limit(0);
        outputBuffer = ByteBuffer.allocateDirect(packetSize * 2);

        // Set the get body message buffer
        AjpMessage getBodyMessage = new AjpMessage(16);
        getBodyMessage.reset();
        getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
        getBodyMessage.appendInt(packetSize - Constants.READ_HEAD_LEN);
        getBodyMessage.end();
        getBodyMessageBuffer =
            ByteBuffer.allocateDirect(getBodyMessage.getLen());
        getBodyMessageBuffer.put(getBodyMessage.getBuffer(), 0,
                getBodyMessage.getLen());

        // Cause loading of HexUtils
        int foo = HexUtils.DEC[0];

        // Cause loading of HttpMessages
        HttpMessages.getMessage(200);

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

示例8: getMessage

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
private String getMessage(final int message){
    if (org.apache.coyote.Constants.IS_SECURITY_ENABLED){
       return (String)AccessController.doPrivileged(
            new PrivilegedAction(){
                public Object run(){
                    return HttpMessages.getMessage(message); 
                }
            }
       );
    } else {
        return HttpMessages.getMessage(message);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:InternalOutputBuffer.java

示例9: InternalAprOutputBuffer

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
/**
 * Alternate constructor.
 */
public InternalAprOutputBuffer(Response response, int headerBufferSize, AprEndpoint endpoint) {

    this.response = response;
    this.endpoint = endpoint;
    headers = response.getMimeHeaders();

    buf = new byte[headerBufferSize];
    if (headerBufferSize < (8 * 1024)) {
        bbuf = ByteBuffer.allocateDirect(6 * 1500);
    } else {
        bbuf = ByteBuffer.allocateDirect((headerBufferSize / 1500 + 1) * 1500);
    }

    outputStreamOutputBuffer = new SocketOutputBuffer();

    filterLibrary = new OutputFilter[0];
    activeFilters = new OutputFilter[0];
    lastActiveFilter = -1;

    committed = false;
    finished = false;

    leftover = new ByteChunk();
    nonBlocking = false;
    
    // Cause loading of HttpMessages
    HttpMessages.getMessage(200);

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

示例10: encode

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
protected String encode(String value, String encoding) {
	String retVal = null;
	if (encoding.equalsIgnoreCase("url")) {
		retVal = urlEncoder.encode(value, "UTF-8");
	} else if (encoding.equalsIgnoreCase("none")) {
		retVal = value;
	} else if (encoding.equalsIgnoreCase("entity")) {
		retVal = HttpMessages.filter(value);
	} else {
		// This shouldn't be possible
		throw new IllegalArgumentException("Unknown encoding: " + encoding);
	}
	return retVal;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:15,代码来源:SSIMediator.java

示例11: sendStatus

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
/**
 * Send the response status line.
 */
public void sendStatus() {

    // Write protocol name
    write(Constants.HTTP_11_BYTES);
    buf[pos++] = Constants.SP;

    // Write status code
    int status = response.getStatus();
    switch (status) {
    case 200:
        write(Constants._200_BYTES);
        break;
    case 400:
        write(Constants._400_BYTES);
        break;
    case 404:
        write(Constants._404_BYTES);
        break;
    default:
        write(status);
    }

    buf[pos++] = Constants.SP;

    // Write message
    String message = null;
    if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER &&
            HttpMessages.isSafeInHttpHeader(response.getMessage())) {
        message = response.getMessage();
    }
    if (message == null) {
        write(HttpMessages.getInstance(
                response.getLocale()).getMessage(status));
    } else {
        write(message);
    }

    // End the response status line
    if (org.apache.coyote.Constants.IS_SECURITY_ENABLED){
       AccessController.doPrivileged(
            new PrivilegedAction<Void>(){
                @Override
                public Void run(){
                    buf[pos++] = Constants.CR;
                    buf[pos++] = Constants.LF;
                    return null;
                }
            }
       );
    } else {
        buf[pos++] = Constants.CR;
        buf[pos++] = Constants.LF;
    }

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

示例12: InternalNioOutputBuffer

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
/**
 * Default constructor.
 */
public InternalNioOutputBuffer(Response response, int headerBufferSize) {

    this.response = response;

    buf = new byte[headerBufferSize];

    outputStreamOutputBuffer = new SocketOutputBuffer();

    filterLibrary = new OutputFilter[0];
    activeFilters = new OutputFilter[0];
    lastActiveFilter = -1;

    committed = false;
    finished = false;

    // Cause loading of HttpMessages
    HttpMessages.getInstance(response.getLocale()).getMessage(200);

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

示例13: prepareResponse

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的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

示例14: prepareResponse

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的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

示例15: sendStatus

import org.apache.tomcat.util.http.HttpMessages; //导入依赖的package包/类
/**
 * Send the response status line.
 */
public void sendStatus() {

    // Write protocol name
    write(Constants.HTTP_11_BYTES);
    buf[pos++] = Constants.SP;

    // Write status code
    int status = response.getStatus();
    switch (status) {
    case 200:
        write(Constants._200_BYTES);
        break;
    case 400:
        write(Constants._400_BYTES);
        break;
    case 404:
        write(Constants._404_BYTES);
        break;
    default:
        write(status);
    }

    buf[pos++] = Constants.SP;

    // Write message
    String message = null;
    if (org.apache.coyote.Constants.USE_CUSTOM_STATUS_MSG_IN_HEADER) {
        message = response.getMessage();
    }
    if (message == null) {
        write(HttpMessages.getMessage(status));
    } else {
        write(message.replace('\n', ' ').replace('\r', ' '));
    }

    // End the response status line
    buf[pos++] = Constants.CR;
    buf[pos++] = Constants.LF;

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


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