本文整理汇总了Java中org.apache.tomcat.util.buf.CharChunk.getOffset方法的典型用法代码示例。如果您正苦于以下问题:Java CharChunk.getOffset方法的具体用法?Java CharChunk.getOffset怎么用?Java CharChunk.getOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tomcat.util.buf.CharChunk
的用法示例。
在下文中一共展示了CharChunk.getOffset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internalMapExtensionWrapper
import org.apache.tomcat.util.buf.CharChunk; //导入方法依赖的package包/类
/**
* Extension mappings.
*
* @param wrappers Set of wrappers to check for matches
* @param path Path to map
* @param mappingData Mapping data for result
* @param resourceExpected Is this mapping expecting to find a resource
*/
private final void internalMapExtensionWrapper(Wrapper[] wrappers,
CharChunk path, MappingData mappingData, boolean resourceExpected) {
char[] buf = path.getBuffer();
int pathEnd = path.getEnd();
int servletPath = path.getOffset();
int slash = -1;
for (int i = pathEnd - 1; i >= servletPath; i--) {
if (buf[i] == '/') {
slash = i;
break;
}
}
if (slash >= 0) {
int period = -1;
for (int i = pathEnd - 1; i > slash; i--) {
if (buf[i] == '.') {
period = i;
break;
}
}
if (period >= 0) {
path.setOffset(period + 1);
path.setEnd(pathEnd);
Wrapper wrapper = exactFind(wrappers, path);
if (wrapper != null
&& (resourceExpected || !wrapper.resourceOnly)) {
mappingData.wrapperPath.setChars(buf, servletPath, pathEnd
- servletPath);
mappingData.requestPath.setChars(buf, servletPath, pathEnd
- servletPath);
mappingData.wrapper = wrapper.object;
}
path.setOffset(servletPath);
path.setEnd(pathEnd);
}
}
}
示例2: for
import org.apache.tomcat.util.buf.CharChunk; //导入方法依赖的package包/类
/**
* Extension mappings.
*/
private final void internalMapExtensionWrapper
(Wrapper[] wrappers, CharChunk path, MappingData mappingData) {
char[] buf = path.getBuffer();
int pathEnd = path.getEnd();
int servletPath = path.getOffset();
int slash = -1;
for (int i = pathEnd - 1; i >= servletPath; i--) {
if (buf[i] == '/') {
slash = i;
break;
}
}
if (slash >= 0) {
int period = -1;
for (int i = pathEnd - 1; i > slash; i--) {
if (buf[i] == '.') {
period = i;
break;
}
}
if (period >= 0) {
path.setOffset(period + 1);
path.setEnd(pathEnd);
int pos = find(wrappers, path);
if ((pos != -1)
&& (path.equals(wrappers[pos].name))) {
mappingData.wrapperPath.setChars
(buf, servletPath, pathEnd - servletPath);
mappingData.requestPath.setChars
(buf, servletPath, pathEnd - servletPath);
mappingData.wrapper = wrappers[pos].object;
}
path.setOffset(servletPath);
path.setEnd(pathEnd);
}
}
}
示例3: internalMapExtensionWrapper
import org.apache.tomcat.util.buf.CharChunk; //导入方法依赖的package包/类
/**
* Extension mappings.
*
* @param wrappers
* Set of wrappers to check for matches
* @param path
* Path to map
* @param mappingData
* Mapping data for result
* @param resourceExpected
* Is this mapping expecting to find a resource
*/
private final void internalMapExtensionWrapper(Wrapper[] wrappers, CharChunk path, MappingData mappingData,
boolean resourceExpected) {
char[] buf = path.getBuffer();
int pathEnd = path.getEnd();
int servletPath = path.getOffset();
int slash = -1;
for (int i = pathEnd - 1; i >= servletPath; i--) {
if (buf[i] == '/') {
slash = i;
break;
}
}
if (slash >= 0) {
int period = -1;
for (int i = pathEnd - 1; i > slash; i--) {
if (buf[i] == '.') {
period = i;
break;
}
}
if (period >= 0) {
path.setOffset(period + 1);
path.setEnd(pathEnd);
Wrapper wrapper = exactFind(wrappers, path);
if (wrapper != null && (resourceExpected || !wrapper.resourceOnly)) {
mappingData.wrapperPath.setChars(buf, servletPath, pathEnd - servletPath);
mappingData.requestPath.setChars(buf, servletPath, pathEnd - servletPath);
mappingData.wrapper = wrapper.object;
}
path.setOffset(servletPath);
path.setEnd(pathEnd);
}
}
}
示例4: internalMapExtensionWrapper
import org.apache.tomcat.util.buf.CharChunk; //导入方法依赖的package包/类
/**
* Extension mappings.
*
* @param wrappers Set of wrappers to check for matches
* @param path Path to map
* @param mappingData Mapping data for result
* @param resourceExpected Is this mapping expecting to find a resource
*/
private final void internalMapExtensionWrapper(Wrapper[] wrappers,
CharChunk path, MappingData mappingData, boolean resourceExpected) {
char[] buf = path.getBuffer();
int pathEnd = path.getEnd();
int servletPath = path.getOffset();
int slash = -1;
for (int i = pathEnd - 1; i >= servletPath; i--) {
if (buf[i] == '/') {
slash = i;
break;
}
}
if (slash >= 0) {
int period = -1;
for (int i = pathEnd - 1; i > slash; i--) {
if (buf[i] == '.') {
period = i;
break;
}
}
if (period >= 0) {
path.setOffset(period + 1);
path.setEnd(pathEnd);
int pos = find(wrappers, path);
if ((pos != -1) && (path.equals(wrappers[pos].name)) &&
(resourceExpected || !wrappers[pos].resourceOnly)) {
mappingData.wrapperPath.setChars
(buf, servletPath, pathEnd - servletPath);
mappingData.requestPath.setChars
(buf, servletPath, pathEnd - servletPath);
mappingData.wrapper = wrappers[pos].object;
}
path.setOffset(servletPath);
path.setEnd(pathEnd);
}
}
}
示例5: internalMapExtensionWrapper
import org.apache.tomcat.util.buf.CharChunk; //导入方法依赖的package包/类
/**
* Extension mappings.
*
* @param wrappers Set of wrappers to check for matches
* @param path Path to map
* @param mappingData Mapping data for result
* @param resourceExpected Is this mapping expecting to find a resource
*/
private final void internalMapExtensionWrapper(Wrapper[] wrappers,
CharChunk path, MappingData mappingData, boolean resourceExpected) {
char[] buf = path.getBuffer();
int pathEnd = path.getEnd();
int servletPath = path.getOffset();
int slash = -1;
for (int i = pathEnd - 1; i >= servletPath; i--) {
if (buf[i] == '/') {
slash = i;
break;
}
}
if (slash >= 0) {
int period = -1;
for (int i = pathEnd - 1; i > slash; i--) {
if (buf[i] == '.') {
period = i;
break;
}
}
if (period >= 0) {
path.setOffset(period + 1);
path.setEnd(pathEnd);
int pos = find(wrappers, path);
if ((pos != -1) && (path.equals(wrappers[pos].name)) &&
(resourceExpected || !wrappers[pos].resourceOnly)) {
mappingData.wrapperPath.setChars
(buf, servletPath, pathEnd - servletPath);
mappingData.requestPath.setChars
(buf, servletPath, pathEnd - servletPath);
mappingData.wrapper = wrappers[pos].object;
}
path.setOffset(servletPath);
path.setEnd(pathEnd);
}
}
}
示例6: find
import org.apache.tomcat.util.buf.CharChunk; //导入方法依赖的package包/类
/**
* Wildcard mapping.
*/
private final void internalMapWildcardWrapper
(Wrapper[] wrappers, int nesting, CharChunk path,
MappingData mappingData) {
int pathEnd = path.getEnd();
int pathOffset = path.getOffset();
int lastSlash = -1;
int length = -1;
int pos = find(wrappers, path);
if (pos != -1) {
boolean found = false;
while (pos >= 0) {
if (path.startsWith(wrappers[pos].name)) {
length = wrappers[pos].name.length();
if (path.getLength() == length) {
found = true;
break;
} else if (path.startsWithIgnoreCase("/", length)) {
found = true;
break;
}
}
if (lastSlash == -1) {
lastSlash = nthSlash(path, nesting + 1);
} else {
lastSlash = lastSlash(path);
}
path.setEnd(lastSlash);
pos = find(wrappers, path);
}
path.setEnd(pathEnd);
if (found) {
mappingData.wrapperPath.setString(wrappers[pos].name);
if (path.getLength() > length) {
mappingData.pathInfo.setChars
(path.getBuffer(),
path.getOffset() + length,
path.getLength() - length);
}
mappingData.requestPath.setChars
(path.getBuffer(), path.getOffset(), path.getLength());
mappingData.wrapper = wrappers[pos].object;
mappingData.jspWildCard = wrappers[pos].jspWildCard;
}
}
}