本文整理了Java中org.eclipse.jetty.server.Server.getHandler()
方法的一些代码示例,展示了Server.getHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getHandler()
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Server
类名称:Server
方法名:getHandler
暂无
代码示例来源:origin: 4thline/cling
@Override
synchronized public void registerServlet(String contextPath, Servlet servlet) {
if (server.getHandler() != null) {
return;
}
log.info("Registering UPnP servlet under context path: " + contextPath);
ServletContextHandler servletHandler =
new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
if (contextPath != null && contextPath.length() > 0)
servletHandler.setContextPath(contextPath);
ServletHolder s = new ServletHolder(servlet);
servletHandler.addServlet(s, "/*");
server.setHandler(servletHandler);
}
代码示例来源:origin: apache/nifi
public void addHandler(Handler handler) {
((HandlerCollection) jetty.getHandler()).addHandler(handler);
}
代码示例来源:origin: apache/nifi
public void clearHandlers() {
HandlerCollection hc = (HandlerCollection) jetty.getHandler();
Handler[] ha = hc.getHandlers();
if (ha != null) {
for (Handler h : ha) {
hc.removeHandler(h);
}
}
}
代码示例来源:origin: neo4j/neo4j
private void loadRequestLogging()
{
// This makes the request log handler decorate whatever other handlers are already set up
final RequestLogHandler requestLogHandler = new HttpChannelOptionalRequestLogHandler();
requestLogHandler.setRequestLog( requestLog );
requestLogHandler.setServer( jetty );
requestLogHandler.setHandler( jetty.getHandler() );
jetty.setHandler( requestLogHandler );
}
代码示例来源:origin: spotify/helios
private void setUpRequestLogging(final Path stateDirectory) {
// Set up request logging
final Handler originalHandler = server.getHandler();
final HandlerCollection handlerCollection;
if (originalHandler instanceof HandlerCollection) {
handlerCollection = (HandlerCollection) originalHandler;
} else {
handlerCollection = new HandlerCollection();
handlerCollection.addHandler(originalHandler);
}
final RequestLogHandler requestLogHandler = new RequestLogHandler();
final RequestLogImpl requestLog = new RequestLogImpl();
requestLog.setQuiet(true);
if (stateDirectory.resolve(LOGBACK_ACCESS_CONFIG).toFile().exists()) {
requestLog.setFileName(stateDirectory.resolve(LOGBACK_ACCESS_CONFIG).toString());
} else if (this.getClass().getResource(LOGBACK_ACCESS_RESOURCE) != null) {
requestLog.setResource(LOGBACK_ACCESS_RESOURCE);
}
requestLogHandler.setRequestLog(requestLog);
handlerCollection.addHandler(requestLogHandler);
server.setHandler(handlerCollection);
}
代码示例来源:origin: apache/geode
webapp.setTempDirectory(tmpPath);
logger.info("Adding webapp " + webAppContext);
((HandlerCollection) httpServer.getHandler()).addHandler(webapp);
代码示例来源:origin: kingthy/TVRemoteIME
@Override
synchronized public void registerServlet(String contextPath, Servlet servlet) {
if (server.getHandler() != null) {
return;
}
log.info("Registering UPnP servlet under context path: " + contextPath);
ServletContextHandler servletHandler =
new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
if (contextPath != null && contextPath.length() > 0)
servletHandler.setContextPath(contextPath);
ServletHolder s = new ServletHolder(servlet);
servletHandler.addServlet(s, "/*");
server.setHandler(servletHandler);
}
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http-jetty
private void initializeContexts() {
if (contexts == null) {
contexts = new ContextHandlerCollection();
if (server != null) {
if (server.getHandler() instanceof ContextHandlerCollection) {
contexts = (ContextHandlerCollection) server.getHandler();
} else {
server.setHandler(contexts);
}
}
}
}
代码示例来源:origin: apache/cxf
private void initializeContexts() {
if (contexts == null) {
contexts = new ContextHandlerCollection();
if (server != null) {
if (server.getHandler() instanceof ContextHandlerCollection) {
contexts = (ContextHandlerCollection) server.getHandler();
} else {
server.setHandler(contexts);
}
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
private void initializeContexts() {
if (contexts == null) {
contexts = new ContextHandlerCollection();
if (server != null) {
if (server.getHandler() instanceof ContextHandlerCollection) {
contexts = (ContextHandlerCollection) server.getHandler();
} else {
server.setHandler(contexts);
}
}
}
}
代码示例来源:origin: apache/jena
/** Get the {@link ServletContext}.
* Adding new servlets is possible with care.
*/
public ServletContext getServletContext() {
return ((ServletContextHandler)server.getHandler()).getServletContext();
}
代码示例来源:origin: org.apache.jena/jena-fuseki-main
/** Get the {@link ServletContext}.
* Adding new servlets is possible with care.
*/
public ServletContext getServletContext() {
return ((ServletContextHandler)server.getHandler()).getServletContext();
}
代码示例来源:origin: eclipse-jetty/eclipse-jetty-plugin
/**
* {@inheritDoc}
*
* @see net.sourceforge.eclipsejetty.starter.common.ServerAdapter#getContextPaths()
*/
@Override
public Collection<String> getContextPaths()
{
return getContextPaths(new LinkedHashSet<String>(), server.getHandler());
}
代码示例来源:origin: com.graphaware.neo4j/server
private HandlerList findHandlerList(FilterConfig filterConfig) {
Server server = ((ContextHandler.Context) filterConfig.getServletContext()).getContextHandler().getServer();
if (RequestLogHandler.class.isAssignableFrom(server.getHandler().getClass())) {
return (HandlerList) ((RequestLogHandler) server.getHandler()).getHandler();
}
return (HandlerList) server.getHandler();
}
代码示例来源:origin: com.graphaware.neo4j/server-common
private HandlerList findHandlerList() {
//If http logging is turned on, the jetty handler is a RequestLogHandler with a different type hierarchy than
//the HandlerList returned when http logging is off
if (getJetty().getHandler().getClass().equals(RequestLogHandler.class)) {
return (HandlerList) ((RequestLogHandler) getJetty().getHandler()).getHandler();
}
return (HandlerList) getJetty().getHandler();
}
代码示例来源:origin: org.apache.isis.core/isis-core-webserver
private String baseFor(final Server jettyServer) {
final ServerConnector connector = (ServerConnector) jettyServer.getConnectors()[0];
final String scheme = "http";
final String host = ArrayExtensions.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();
try(final Formatter formatter = new Formatter(buf)) {
formatter.format("%s://%s:%d/%s", scheme, host, port, contextPath);
}
return appendSlashIfRequired(buf).toString();
}
代码示例来源:origin: apache/jena
private JettyFusekiWebapp(JettyServerConfig config) {
this.serverConfig = config ;
buildServerWebapp(serverConfig.contextPath, serverConfig.jettyConfigFile) ;
if ( mgtConnector == null )
mgtConnector = serverConnector ;
if ( config.enableCompression ) {
GzipHandler gzipHandler = new GzipHandler();
gzipHandler.setHandler(server.getHandler());
server.setHandler(gzipHandler);
}
}
代码示例来源:origin: org.activecomponents.jadex/jadex-platform-extension-webservice-desktop-jetty
/**
* Unpublish a service.
* @param sid The service identifier.
*/
public IFuture<Void> unpublishService(IServiceIdentifier sid)
{
Tuple2<Server,ContextHandler> unpublish = unpublishinfos.remove(sid);
if (unpublish != null)
((ContextHandlerCollection)unpublish.getFirstEntity().getHandler()).removeHandler(unpublish.getSecondEntity());
// throw new UnsupportedOperationException();
return IFuture.DONE;
}
代码示例来源:origin: org.neo4j.app/neo4j-server
private void loadRequestLogging()
{
// This makes the request log handler decorate whatever other handlers are already set up
final RequestLogHandler requestLogHandler = new HttpChannelOptionalRequestLogHandler();
requestLogHandler.setRequestLog( requestLog );
requestLogHandler.setServer( jetty );
requestLogHandler.setHandler( jetty.getHandler() );
jetty.setHandler( requestLogHandler );
}
代码示例来源:origin: net.rakugakibox.springbootext/spring-boot-ext-logback-access
/** {@inheritDoc} */
@Override
public void customize(Server server) {
LogbackAccessRequestLog requestLog = new LogbackAccessRequestLog();
requestLog.setProperties(properties);
requestLog.setConfigurator(configurator);
RequestLogHandler requestLogHandler = new RequestLogHandler();
requestLogHandler.setHandler(server.getHandler());
requestLogHandler.setRequestLog(requestLog);
server.setHandler(requestLogHandler);
log.debug("Set the Jetty handler: handler=[{}] to server=[{}]", requestLogHandler, server);
}
内容来源于网络,如有侵权,请联系作者删除!