本文整理汇总了Java中org.mortbay.jetty.handler.ContextHandler.SContext方法的典型用法代码示例。如果您正苦于以下问题:Java ContextHandler.SContext方法的具体用法?Java ContextHandler.SContext怎么用?Java ContextHandler.SContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mortbay.jetty.handler.ContextHandler
的用法示例。
在下文中一共展示了ContextHandler.SContext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inferMimeType
import org.mortbay.jetty.handler.ContextHandler; //导入方法依赖的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: getVirtualHost
import org.mortbay.jetty.handler.ContextHandler; //导入方法依赖的package包/类
/**
* Get the first virtual host for the context.
*
* Used to help identify the exact session/contextPath.
*
* @return 0.0.0.0 if no virtual host is defined
*/
private String getVirtualHost (ContextHandler.SContext context)
{
String vhost = "0.0.0.0";
if (context==null)
return vhost;
String [] vhosts = context.getContextHandler().getVirtualHosts();
if (vhosts==null || vhosts.length==0 || vhosts[0]==null)
return vhost;
return vhosts[0];
}
示例3: virtualHostFrom
import org.mortbay.jetty.handler.ContextHandler; //导入方法依赖的package包/类
private String virtualHostFrom(ContextHandler.SContext context)
{
String result = "0.0.0.0";
if (context == null) return result;
String[] vhosts = context.getContextHandler().getVirtualHosts();
if (vhosts == null || vhosts.length == 0 || vhosts[0] == null) return result;
return vhosts[0];
}
示例4: inferMimeType
import org.mortbay.jetty.handler.ContextHandler; //导入方法依赖的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();
}