本文整理汇总了Java中org.apache.tomcat.util.buf.UDecoder类的典型用法代码示例。如果您正苦于以下问题:Java UDecoder类的具体用法?Java UDecoder怎么用?Java UDecoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UDecoder类属于org.apache.tomcat.util.buf包,在下文中一共展示了UDecoder类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nextSlash
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
private int nextSlash(char[] uri, int startPos) {
int len = uri.length;
int pos = startPos;
while (pos < len) {
if (uri[pos] == '/') {
return pos;
} else if (UDecoder.ALLOW_ENCODED_SLASH && uri[pos] == '%' && pos + 2 < len &&
uri[pos+1] == '2' && (uri[pos + 2] == 'f' || uri[pos + 2] == 'F')) {
return pos;
}
pos++;
}
return -1;
}
示例2: doGet
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
Integer countObj = (Integer) req.getAttribute("count");
int count = 0;
if (countObj != null) {
count = countObj.intValue();
}
count++;
req.setAttribute("count", Integer.valueOf(count));
String encodedUri = req.getRequestURI();
UDecoder uDecoder = new UDecoder();
String decodedUri = uDecoder.convert(encodedUri, false);
try {
// Just here to trigger the error
@SuppressWarnings("unused")
URI u = new URI(encodedUri);
} catch (URISyntaxException e) {
throw new ServletException(e);
}
if (count > 3) {
resp.setContentType("text/plain");
resp.getWriter().print("OK");
} else {
AsyncContext ac = req.startAsync();
ac.dispatch(decodedUri);
}
}
示例3: nextSlash
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
private int nextSlash(char[] uri, int startPos) {
int len = uri.length;
int pos = startPos;
while (pos < len) {
if (uri[pos] == '/') {
return pos;
} else if (UDecoder.ALLOW_ENCODED_SLASH && uri[pos] == '%' && pos + 2 < len && uri[pos + 1] == '2'
&& (uri[pos + 2] == 'f' || uri[pos + 2] == 'F')) {
return pos;
}
pos++;
}
return -1;
}
示例4: addURLPattern
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
public void addURLPattern(String urlPattern) {
if ("*".equals(urlPattern)) {
this.matchAllUrlPatterns = true;
} else {
String[] results = new String[urlPatterns.length + 1];
System.arraycopy(urlPatterns, 0, results, 0, urlPatterns.length);
results[urlPatterns.length] = UDecoder.URLDecode(urlPattern);
urlPatterns = results;
}
}
示例5: setLocation
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
/**
* Set the location.
*
* @param location The new location
*/
public void setLocation(String location) {
// if ((location == null) || !location.startsWith("/"))
// throw new IllegalArgumentException
// ("Error Page Location must start with a '/'");
this.location = UDecoder.URLDecode(location);
}
示例6: addPattern
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
/**
* Add a URL pattern to be part of this web resource collection.
*/
public void addPattern(String pattern) {
if (pattern == null)
return;
String decodedPattern = UDecoder.URLDecode(pattern);
String results[] = new String[patterns.length + 1];
for (int i = 0; i < patterns.length; i++) {
results[i] = patterns[i];
}
results[patterns.length] = decodedPattern;
patterns = results;
}
示例7: getURLDecoder
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
public UDecoder getURLDecoder() {
return urlDecoder;
}
示例8: setURLDecoder
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
public void setURLDecoder( UDecoder u ) {
urlDec=u;
}
示例9: setURLDecoder
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
public void setURLDecoder(UDecoder u) {
urlDec = u;
}
示例10: getURLDecoder
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
public UDecoder getURLDecoder() {
return urlDecoder;
}
示例11: setURLDecoder
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
public void setURLDecoder(UDecoder u) {
urlDec = u;
}
示例12: setErrorPage
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
public void setErrorPage(String errorPage) {
// if ((errorPage == null) || !errorPage.startsWith("/"))
// throw new IllegalArgumentException
// ("Error Page resource path must start with a '/'");
this.errorPage = UDecoder.URLDecode(errorPage);
}
示例13: setLoginPage
import org.apache.tomcat.util.buf.UDecoder; //导入依赖的package包/类
public void setLoginPage(String loginPage) {
// if ((loginPage == null) || !loginPage.startsWith("/"))
// throw new IllegalArgumentException
// ("Login Page resource path must start with a '/'");
this.loginPage = UDecoder.URLDecode(loginPage);
}