本文整理了Java中org.mortbay.jetty.Server.addListener()
方法的一些代码示例,展示了Server.addListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.addListener()
方法的具体详情如下:
包路径:org.mortbay.jetty.Server
类名称:Server
方法名:addListener
暂无
代码示例来源:origin: stackoverflow.com
class Test {
public static void main(String[] args) {
Server server = new Initiater();
GuiImplementation gui = new Responder();
//register gui as a listener for incoming/outgoing messages
server.addListener(gui);
//this will trigger the gui method to process incoming message
server.sendMessage();
}
}
代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core
/**
* Configure an ssl listener on the server.
* @param addr address to listen on
* @param keystore location of the keystore
* @param storPass password for the keystore
* @param keyPass password for the key
*/
public void addSslListener(InetSocketAddress addr, String keystore,
String storPass, String keyPass) throws IOException {
if (sslListener != null || webServer.isStarted()) {
throw new IOException("Failed to add ssl listener");
}
sslListener = new SslListener();
sslListener.setHost(addr.getHostName());
sslListener.setPort(addr.getPort());
sslListener.setKeystore(keystore);
sslListener.setPassword(storPass);
sslListener.setKeyPassword(keyPass);
webServer.addListener(sslListener);
}
代码示例来源:origin: com.opensymphony/webwork
public static void startServer(int port, String context, List pathPriority, Map paths, String resolver) throws Exception {
try {
Server server = new Server();
SocketListener socketListener = new SocketListener();
socketListener.setPort(port);
server.addListener(socketListener);
WebApplicationContext ctx;
if (resolver == null) {
ctx = new MultiWebApplicationContext(pathPriority, paths);
} else {
ctx = new MultiWebApplicationContext(pathPriority, paths, resolver);
}
ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
ctx.setContextPath(context);
server.addContext(null, ctx);
// Add in extra webapps dir (see WW-1319)
String webappsDir = System.getProperty(WEBAPPS_DIR_PROPERTY);
if (webappsDir != null && new File(webappsDir).exists()) {
server.addWebApplications(webappsDir);
}
server.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: mx4j/mx4j-tools
protected void configureListener(JMXServiceURL url, Map environment) throws IOException
{
Logger logger = getLogger();
if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Configuring Jetty with a default listener on port " + url.getPort());
getServer().addListener(":" + url.getPort());
}
代码示例来源:origin: org.apache.axis2.transport/axis2-transport-testkit
@Setup @SuppressWarnings("unused")
private void setUp(HttpTestEnvironment env) throws Exception {
server = new Server();
SocketListener listener = new SocketListener();
listener.setPort(env.getServerPort());
server.addListener(listener);
context = new HttpContext(server, Channel.CONTEXT_PATH + "/*");
server.start();
}
代码示例来源:origin: apache/axis2-java
@Setup @SuppressWarnings("unused")
private void setUp(HttpTestEnvironment env) throws Exception {
server = new Server();
SocketListener listener = new SocketListener();
listener.setPort(env.getServerPort());
server.addListener(listener);
context = new HttpContext(server, Channel.CONTEXT_PATH + "/*");
server.start();
}
代码示例来源:origin: org.apache.axis2/axis2-transport-testkit
@Setup @SuppressWarnings("unused")
private void setUp(HttpTestEnvironment env) throws Exception {
server = new Server();
SocketListener listener = new SocketListener();
listener.setPort(env.getServerPort());
server.addListener(listener);
context = new HttpContext(server, Channel.CONTEXT_PATH + "/*");
server.start();
}
代码示例来源:origin: org.testatoo.openqa/selenium-server
protected void createJettyServer(boolean slowResources) {
final SocketListener socketListener;
server = new Server();
socketListener = new SocketListener();
socketListener.setMaxIdleTimeMs(60000);
socketListener.setMaxThreads(jettyThreads);
socketListener.setPort(getPort());
server.addListener(socketListener);
assembleHandlers(slowResources, configuration);
}
代码示例来源:origin: org.testatoo.openqa/selenium-server
public static void main(String[] args) throws Exception {
Server server = new Server();
HttpContext httpContext = new HttpContext();
httpContext.setContextPath("/");
ProxyHandler proxy = new ProxyHandler(true, "", "", false, false);
proxy.useCyberVillains = false;
httpContext.addHandler(proxy);
server.addContext(httpContext);
SocketListener listener = new SocketListener();
listener.setPort(4444);
server.addListener(listener);
server.start();
}
代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core
/**
* Create a status server on the given port.
* The jsp scripts are taken from src/webapps/<name>.
* @param name The name of the server
* @param port The port to use on the server
* @param findPort whether the server should start at the given port and
* increment by 1 until it finds a free port.
* @param conf Configuration
*/
public HttpServer(String name, String bindAddress, int port,
boolean findPort, Configuration conf) throws IOException {
webServer = new org.mortbay.jetty.Server();
this.findPort = findPort;
listener = new SocketListener();
listener.setPort(port);
listener.setHost(bindAddress);
webServer.addListener(listener);
final String appDir = getWebAppsPath();
webAppContext = webServer.addWebApplication("/", appDir + "/" + name);
addDefaultApps(appDir);
final FilterInitializer[] initializers = getFilterInitializers(conf);
if (initializers != null) {
for(FilterInitializer c : initializers) {
c.initFilter(this);
}
}
addDefaultServlets();
}
内容来源于网络,如有侵权,请联系作者删除!