本文整理了Java中org.mortbay.jetty.Server.getHandler()
方法的一些代码示例,展示了Server.getHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getHandler()
方法的具体详情如下:
包路径:org.mortbay.jetty.Server
类名称:Server
方法名:getHandler
暂无
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
/**
*/
public void removeHandler(Handler handler)
{
if (getHandler() instanceof HandlerCollection)
((HandlerCollection)getHandler()).removeHandler(handler);
}
代码示例来源:origin: net.disy.legato/legato-testing
@Override
public ServletContext getServletContext(final String contextPath) {
final Iterable<Handler> handlers = (server.getHandlers() == null ? Collections
.singletonList(server.getHandler()) : Arrays.asList(server.getHandlers()));
for (final Handler handler : handlers) {
if (handler instanceof ContextHandler) {
final ContextHandler contextHandler = (ContextHandler) handler;
if (ObjectUtils.equals(contextPath, contextHandler.getContextPath())) {
return contextHandler.getServletContext();
}
}
}
return null;
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
/**
*/
public Handler[] getHandlers()
{
if (getHandler() instanceof HandlerCollection)
return ((HandlerCollection)getHandler()).getHandlers();
return null;
}
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
Handler handler = server.getHandler();
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
/**
* {@inheritDoc}
*
* @see net.sourceforge.eclipsejetty.starter.common.ServerAdapter#getContextPaths()
*/
public Collection<String> getContextPaths()
{
return getContextPaths(new LinkedHashSet<String>(), server.getHandler());
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
/**
*/
public void addHandler(Handler handler)
{
if (getHandler() == null)
setHandler(handler);
else if (getHandler() instanceof HandlerCollection)
((HandlerCollection)getHandler()).addHandler(handler);
else
{
HandlerCollection collection=new HandlerCollection();
collection.setHandlers(new Handler[]{getHandler(),handler});
setHandler(collection);
}
}
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
/**
* {@inheritDoc}
*
* @see net.sourceforge.eclipsejetty.starter.common.AbstractServerAdapter#getClassPathDescription()
*/
@Override
protected String getClassPathDescription()
{
StringBuilder builder = new StringBuilder();
List<String> classPathEntries =
new ArrayList<String>(getClassPathDescription(new LinkedHashSet<String>(), server.getHandler()));
Collections.sort(classPathEntries);
for (String entry : classPathEntries)
{
if (builder.length() > 0)
{
builder.append("\n");
}
builder.append(entry);
}
return builder.toString();
}
代码示例来源:origin: org.mortbay.jetty/com.springsource.org.mortbay.jetty.server
/**
*/
public void setHandlers(Handler[] handlers)
{
HandlerCollection collection;
if (getHandler() instanceof HandlerCollection)
collection=(HandlerCollection)getHandler();
else
{
collection=new HandlerCollection();
setHandler(collection);
}
collection.setHandlers(handlers);
}
代码示例来源:origin: co.cask.hbase/hbase
new Context((ContextHandlerCollection)this.webServer.getHandler(),
logsContextPath);
logContext.setResourceBase(logDir);
代码示例来源:origin: org.apache.isis.runtimes.dflt/webserver
private String baseFor(final Server jettyServer) {
final Connector connector = jettyServer.getConnectors()[0];
final String scheme = "http";
final String host = StringUtils.coalesce(connector.getHost(), "localhost");
final int port = connector.getPort();
final WebAppContext handler = (WebAppContext) jettyServer.getHandler();
final String contextPath = handler.getContextPath();
final StringBuilder buf = new StringBuilder();
final Formatter formatter = new Formatter(buf);
formatter.format("%s://%s:%d/%s", scheme, host, port, contextPath);
return appendSlashIfRequired(buf).toString();
}
代码示例来源:origin: alibaba/wasp
new Context((ContextHandlerCollection)this.webServer.getHandler(),
logsContextPath);
logContext.setResourceBase(logDir);
代码示例来源:origin: org.jboss.weld.servlet/weld-servlet-shaded
protected static WebAppContext findWAC(ServletContext context) {
if (context instanceof ContextHandler.SContext) {
ContextHandler.SContext sContext = (ContextHandler.SContext) context;
ContextHandler contextHandler = sContext.getContextHandler();
Handler handler = contextHandler.getHandler();
if (handler instanceof ServletHandler) {
ServletHandler servletHandler = (ServletHandler) handler;
Server server = servletHandler.getServer();
Handler serverHandler = server.getHandler();
if (serverHandler instanceof HandlerCollection) {
HandlerCollection hc = (HandlerCollection) serverHandler;
for (Handler h : hc.getHandlers()) {
if (h instanceof WebAppContext) {
WebAppContext wac = (WebAppContext) h;
if (wac.getServletHandler() == servletHandler) {
return wac;
}
}
}
}
}
}
return null;
}
}
代码示例来源:origin: weld/core
protected static WebAppContext findWAC(ServletContext context) {
if (context instanceof ContextHandler.SContext) {
ContextHandler.SContext sContext = (ContextHandler.SContext) context;
ContextHandler contextHandler = sContext.getContextHandler();
Handler handler = contextHandler.getHandler();
if (handler instanceof ServletHandler) {
ServletHandler servletHandler = (ServletHandler) handler;
Server server = servletHandler.getServer();
Handler serverHandler = server.getHandler();
if (serverHandler instanceof HandlerCollection) {
HandlerCollection hc = (HandlerCollection) serverHandler;
for (Handler h : hc.getHandlers()) {
if (h instanceof WebAppContext) {
WebAppContext wac = (WebAppContext) h;
if (wac.getServletHandler() == servletHandler) {
return wac;
}
}
}
}
}
}
return null;
}
}
代码示例来源:origin: weld/core
protected static WebAppContext findWAC(ServletContext context) {
if (context instanceof ContextHandler.SContext) {
ContextHandler.SContext sContext = (ContextHandler.SContext) context;
ContextHandler contextHandler = sContext.getContextHandler();
Handler handler = contextHandler.getHandler();
if (handler instanceof ServletHandler) {
ServletHandler servletHandler = (ServletHandler) handler;
Server server = servletHandler.getServer();
Handler serverHandler = server.getHandler();
if (serverHandler instanceof HandlerCollection) {
HandlerCollection hc = (HandlerCollection) serverHandler;
for (Handler h : hc.getHandlers()) {
if (h instanceof WebAppContext) {
WebAppContext wac = (WebAppContext) h;
if (wac.getServletHandler() == servletHandler) {
return wac;
}
}
}
}
}
}
return null;
}
}
内容来源于网络,如有侵权,请联系作者删除!