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


Java MessageBytes类代码示例

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


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

示例1: localAddr

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
public MessageBytes localAddr() {
    return localAddrMB;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:Request.java

示例2: value

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/** Allow "set" operations - 
    return a MessageBytes container for the
    header value ( existing header or new
    if this .
 */
public MessageBytes setValue(String name) {
    for (int i = 0; i < count; i++) {
        if (headers[i].getName().equalsIgnoreCase(name)) {
            for (int j = i + 1; j < count; j++) {
                if (headers[j].getName().equalsIgnoreCase(name)) {
                    removeHeader(j--);
                }
            }
            return headers[i].getValue();
        }
    }
    MimeHeaderField mh = createHeader();
    mh.getName().setString(name);
    return mh.getValue();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:MimeHeaders.java

示例3: setValue

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * Allow "set" operations - return a MessageBytes container for the header
 * value ( existing header or new if this .
 */
public MessageBytes setValue(String name) {
	for (int i = 0; i < count; i++) {
		if (headers[i].getName().equalsIgnoreCase(name)) {
			for (int j = i + 1; j < count; j++) {
				if (headers[j].getName().equalsIgnoreCase(name)) {
					removeHeader(j--);
				}
			}
			return headers[i].getValue();
		}
	}
	MimeHeaderField mh = createHeader();
	mh.getName().setString(name);
	return mh.getValue();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:20,代码来源:MimeHeaders.java

示例4: appendBytes

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * Write a MessageBytes out at the current write position. A null
 * MessageBytes is encoded as a string with length 0.
 */
public void appendBytes(MessageBytes mb) {
	if (mb == null) {
		log.error(sm.getString("ajpmessage.null"), new NullPointerException());
		appendInt(0);
		appendByte(0);
		return;
	}
	if (mb.getType() == MessageBytes.T_BYTES) {
		ByteChunk bc = mb.getByteChunk();
		appendByteChunk(bc);
	} else if (mb.getType() == MessageBytes.T_CHARS) {
		CharChunk cc = mb.getCharChunk();
		appendCharChunk(cc);
	} else {
		appendString(mb.toString());
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:22,代码来源:AjpMessage.java

示例5: convertMB

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * Character conversion of the a US-ASCII MessageBytes.
 */
protected void convertMB(MessageBytes mb) {

    // This is of course only meaningful for bytes
    if (mb.getType() != MessageBytes.T_BYTES) {
        return;
    }

    ByteChunk bc = mb.getByteChunk();
    CharChunk cc = mb.getCharChunk();
    int length = bc.getLength();
    cc.allocate(length, -1);

    // Default encoding: fast conversion
    byte[] bbuf = bc.getBuffer();
    char[] cbuf = cc.getBuffer();
    int start = bc.getStart();
    for (int i = 0; i < length; i++) {
        cbuf[i] = (char) (bbuf[i + start] & 0xff);
    }
    mb.setChars(cbuf, 0, length);

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:26,代码来源:CoyoteAdapter.java

示例6: convertMB

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * Character conversion of the a US-ASCII MessageBytes.
 */
protected void convertMB(MessageBytes mb) {

	// This is of course only meaningful for bytes
	if (mb.getType() != MessageBytes.T_BYTES) {
		return;
	}

	ByteChunk bc = mb.getByteChunk();
	CharChunk cc = mb.getCharChunk();
	int length = bc.getLength();
	cc.allocate(length, -1);

	// Default encoding: fast conversion
	byte[] bbuf = bc.getBuffer();
	char[] cbuf = cc.getBuffer();
	int start = bc.getStart();
	for (int i = 0; i < length; i++) {
		cbuf[i] = (char) (bbuf[i + start] & 0xff);
	}
	mb.setChars(cbuf, 0, length);

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

示例7: invoke

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的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:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:49,代码来源:StandardContextValve.java

示例8: value

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/** Allow "set" operations -
    return a MessageBytes container for the
    header value ( existing header or new
    if this .
*/
public MessageBytes setValue( String name ) {
    for ( int i = 0; i < count; i++ ) {
        if(headers[i].getName().equalsIgnoreCase(name)) {
            for ( int j=i+1; j < count; j++ ) {
                if(headers[j].getName().equalsIgnoreCase(name)) {
                    removeHeader(j--);
                }
            }
            return headers[i].getValue();
        }
    }
    MimeHeaderField mh = createHeader();
    mh.getName().setString(name);
    return mh.getValue();
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:21,代码来源:MimeHeaders.java

示例9: convertMB

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * Character conversion of the a US-ASCII MessageBytes.
 */
protected void convertMB(MessageBytes mb) {

    // This is of course only meaningful for bytes
    if (mb.getType() != MessageBytes.T_BYTES)
        return;
    
    ByteChunk bc = mb.getByteChunk();
    CharChunk cc = mb.getCharChunk();
    int length = bc.getLength();
    cc.allocate(length, -1);

    // Default encoding: fast conversion
    byte[] bbuf = bc.getBuffer();
    char[] cbuf = cc.getBuffer();
    int start = bc.getStart();
    for (int i = 0; i < length; i++) {
        cbuf[i] = (char) (bbuf[i + start] & 0xff);
    }
    mb.setChars(cbuf, 0, length);

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

示例10: decodedURI

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
public MessageBytes decodedURI() {
	return decodedUriMB;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:4,代码来源:Request.java

示例11: getUniqueValue

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * Finds and returns a unique header field with the given name. If no such
 * field exists, null is returned. If the specified header field is not
 * unique then an {@link IllegalArgumentException} is thrown. 
 */
public MessageBytes getUniqueValue(String name) {
    MessageBytes result = null;
    for (int i = 0; i < count; i++) {
        if (headers[i].getName().equalsIgnoreCase(name)) {
            if (result == null) {
                result = headers[i].getValue();
            } else {
                throw new IllegalArgumentException();
            }
        }
    }
    return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:MimeHeaders.java

示例12: isCompressable

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * Check if the resource could be compressed, if the client supports it.
 */
private boolean isCompressable() {

    // Check if content is not already gzipped
    MessageBytes contentEncodingMB =
        response.getMimeHeaders().getValue("Content-Encoding");

    if ((contentEncodingMB != null)
        && (contentEncodingMB.indexOf("gzip") != -1)) {
        return false;
    }

    // If force mode, always compress (test purposes only)
    if (compressionLevel == 2) {
        return true;
    }

    // Check if sufficient length to trigger the compression
    long contentLength = response.getContentLengthLong();
    if ((contentLength == -1)
        || (contentLength > compressionMinSize)) {
        // Check for compatible MIME-TYPE
        if (compressableMimeTypes != null) {
            return (startsWithStringArray(compressableMimeTypes,
                                          response.getContentType()));
        }
    }

    return false;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:33,代码来源:AbstractHttp11Processor.java

示例13: isConnectionClose

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
private boolean isConnectionClose(MimeHeaders headers) {
    MessageBytes connection = headers.getValue(Constants.CONNECTION);
    if (connection == null) {
        return false;
    }
    return connection.equals(Constants.CLOSE);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:8,代码来源:AbstractHttp11Processor.java

示例14: write

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * This method will write the contents of the specified message bytes 
 * buffer to the output stream, without filtering. This method is meant to
 * be used to write the response header.
 * 
 * @param mb data to be written
 */
protected void write(MessageBytes mb) {

    if (mb.getType() == MessageBytes.T_BYTES) {
        ByteChunk bc = mb.getByteChunk();
        write(bc);
    } else if (mb.getType() == MessageBytes.T_CHARS) {
        CharChunk cc = mb.getCharChunk();
        write(cc);
    } else {
        write(mb.toString());
    }

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

示例15: sendHeader

import org.apache.tomcat.util.buf.MessageBytes; //导入依赖的package包/类
/**
 * Send a header.
 * 
 * @param name
 *            Header name
 * @param value
 *            Header value
 */
public void sendHeader(MessageBytes name, MessageBytes value) {

	write(name);
	buf[pos++] = Constants.COLON;
	buf[pos++] = Constants.SP;
	write(value);
	buf[pos++] = Constants.CR;
	buf[pos++] = Constants.LF;

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


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