本文整理汇总了Java中org.mortbay.io.Buffer.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Buffer.toString方法的具体用法?Java Buffer.toString怎么用?Java Buffer.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mortbay.io.Buffer
的用法示例。
在下文中一共展示了Buffer.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inferMimeType
import org.mortbay.io.Buffer; //导入方法依赖的package包/类
/**
* Infer the mime type for the response based on the extension of the request
* URI. Returns null if unknown.
*/
private String inferMimeType(ServletRequest request) {
String path = ((HttpServletRequest)request).getRequestURI();
ContextHandler.SContext sContext = (ContextHandler.SContext)config.getServletContext();
MimeTypes mimes = sContext.getContextHandler().getMimeTypes();
Buffer mimeBuffer = mimes.getMimeByExtension(path);
return (mimeBuffer == null) ? null : mimeBuffer.toString();
}
示例2: inferMimeType
import org.mortbay.io.Buffer; //导入方法依赖的package包/类
/**
* Infer the mime type for the response based on the extension of the
* request URI. Returns null if unknown.
*/
private String inferMimeType(ServletRequest request) {
String path = ((HttpServletRequest)request).getRequestURI();
ContextHandler.SContext sContext =
(ContextHandler.SContext)config.getServletContext();
MimeTypes mimes = sContext.getContextHandler().getMimeTypes();
Buffer mimeBuffer = mimes.getMimeByExtension(path);
return (mimeBuffer == null) ? null : mimeBuffer.toString();
}
示例3: onResponseHeader
import org.mortbay.io.Buffer; //导入方法依赖的package包/类
protected void onResponseHeader(Buffer name, Buffer value) throws IOException
{
super.onResponseHeader(name,value);
if (HttpHeaders.CACHE.getOrdinal(name)==HttpHeaders.SET_COOKIE_ORDINAL)
{
String cname=null;
String cvalue=null;
QuotedStringTokenizer tok=new QuotedStringTokenizer(value.toString(),"=;",false,false);
tok.setSingle(false);
if (tok.hasMoreElements())
cname=tok.nextToken();
if (tok.hasMoreElements())
cvalue=tok.nextToken();
Cookie cookie=new Cookie(cname,cvalue);
while (tok.hasMoreTokens())
{
String token=tok.nextToken();
if ("Version".equalsIgnoreCase(token))
cookie.setVersion(Integer.parseInt(tok.nextToken()));
else if ("Comment".equalsIgnoreCase(token))
cookie.setComment(tok.nextToken());
else if ("Path".equalsIgnoreCase(token))
cookie.setPath(tok.nextToken());
else if ("Domain".equalsIgnoreCase(token))
cookie.setDomain(tok.nextToken());
else if ("Expires".equalsIgnoreCase(token))
{
tok.nextToken();
// TODO
}
else if ("Max-Age".equalsIgnoreCase(token))
{
tok.nextToken();
// TODO
}
else if ("Secure".equalsIgnoreCase(token))
cookie.setSecure(true);
}
BayeuxClient.this.setCookie(cookie);
}
}