本文整理汇总了Java中org.mortbay.jetty.servlet.Context.SESSIONS属性的典型用法代码示例。如果您正苦于以下问题:Java Context.SESSIONS属性的具体用法?Java Context.SESSIONS怎么用?Java Context.SESSIONS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.mortbay.jetty.servlet.Context
的用法示例。
在下文中一共展示了Context.SESSIONS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServer
private static void startServer() throws Exception, InterruptedException {
Server server = new Server(port);
Context context = new Context(server, "/", Context.SESSIONS);
context.addServlet(DefaultServlet.class, "/*");
context.addEventListener(new ContextLoaderListener(getContext()));
context.addEventListener(new RequestContextListener());
WicketFilter filter = new WicketFilter();
filter.setFilterPath("/");
FilterHolder holder = new FilterHolder(filter);
holder.setInitParameter("applicationFactoryClassName", APP_FACTORY_NAME);
context.addFilter(holder, "/*", Handler.DEFAULT);
server.setHandler(context);
server.start();
server.join();
}
示例2: setupPspMithraService
protected void setupPspMithraService()
{
server = new Server(this.getApplicationPort1());
Context context = new Context (server,"/",Context.SESSIONS);
ServletHolder holder = context.addServlet(PspServlet.class, "/PspServlet");
holder.setInitParameter("serviceInterface.MasterCacheService", "com.gs.fw.common.mithra.cache.offheap.MasterCacheService");
holder.setInitParameter("serviceClass.MasterCacheService", "com.gs.fw.common.mithra.cache.offheap.MasterCacheServiceImpl");
holder.setInitOrder(10);
// System.out.println(holder.getServlet().getClass().getName());
try
{
server.start();
}
catch (Exception e)
{
throw new RuntimeException("could not start server", e);
}
finally
{
}
}
示例3: setupServerWithHandler
protected void setupServerWithHandler(
Handler handler) throws Exception
{
this.port = (int) (Math.random() * 10000.0 + 10000.0);
this.pspUrl = "http://localhost:" + this.port + "/PspServlet";
this.server = new Server(this.port);
Context context = new Context(server, "/", Context.SESSIONS);
if (handler != null)
{
context.addHandler(handler);
}
ServletHolder holder = context.addServlet(PspServlet.class, "/PspServlet");
holder.setInitParameter("serviceInterface.Echo", "com.gs.fw.common.mithra.test.tinyproxy.Echo");
holder.setInitParameter("serviceClass.Echo", "com.gs.fw.common.mithra.test.tinyproxy.EchoImpl");
holder.setInitOrder(10);
this.server.start();
this.servlet = (PspServlet) holder.getServlet();
}
示例4: setupPspMithraService
protected void setupPspMithraService()
{
server = new Server(this.getApplicationPort1());
Context context = new Context (server,"/",Context.SESSIONS);
ServletHolder holder = context.addServlet(PspServlet.class, "/PspServlet");
holder.setInitParameter("serviceInterface.RemoteMithraService", "com.gs.fw.common.mithra.remote.RemoteMithraService");
holder.setInitParameter("serviceClass.RemoteMithraService", "com.gs.fw.common.mithra.remote.RemoteMithraServiceImpl");
holder.setInitOrder(10);
try
{
server.start();
}
catch (Exception e)
{
throw new RuntimeException("could not start server", e);
}
finally
{
}
}
示例5: setup
@BeforeClass
public static void setup() throws Exception {
try {
JobCallbackRequestMaker.initialize(new Props());
jobCBMaker = JobCallbackRequestMaker.getInstance();
contextInfo = new HashMap<String, String>();
contextInfo.put(CONTEXT_SERVER_TOKEN, SERVER_NAME);
contextInfo.put(CONTEXT_PROJECT_TOKEN, PROJECT_NANE);
contextInfo.put(CONTEXT_FLOW_TOKEN, FLOW_NANE);
contextInfo.put(CONTEXT_EXECUTION_ID_TOKEN, EXECUTION_ID);
contextInfo.put(CONTEXT_JOB_TOKEN, JOB_NANE);
contextInfo.put(CONTEXT_JOB_STATUS_TOKEN, JobCallbackStatusEnum.STARTED.name());
embeddedJettyServer = new Server(PORT_NUMBER);
Context context = new Context(embeddedJettyServer, "/", Context.SESSIONS);
context.addServlet(new ServletHolder(new DelayServlet()), "/delay");
System.out.println("Start server");
embeddedJettyServer.start();
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
示例6: createHandler
private Context createHandler(
Map<String, Path> runfiles,
ImmutableList<Route> routes,
ImmutableList<Class<? extends Filter>> filters) {
Context context = new Context(server, CONTEXT_PATH, Context.SESSIONS);
context.addServlet(new ServletHolder(HealthzServlet.class), "/healthz");
for (Map.Entry<String, Path> runfile : runfiles.entrySet()) {
context.addServlet(
StaticResourceServlet.create(runfile.getKey(), runfile.getValue()),
runfile.getKey());
}
for (Route route : routes) {
context.addServlet(
new ServletHolder(wrapServlet(route.servletClass(), filters)), route.path());
}
ServletHolder holder = new ServletHolder(DefaultServlet.class);
holder.setInitParameter("aliases", "1");
context.addServlet(holder, "/*");
return context;
}
示例7: main
public static void main( String[] args )
throws Exception
{
Server server = new Server( 8080 );
WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/xdocreport-webapp" );
ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );
server.setHandler( handlers );
// JSP Servlet + Context
Context jsp_ctx = new Context( servlet_contexts, "/jsp", Context.SESSIONS );
jsp_ctx.addServlet( new ServletHolder( new org.apache.jasper.servlet.JspServlet() ), "*.jsp" );
server.start();
server.join();
}
示例8: startServer
public void startServer(int port, String classBound) throws BindException,
Exception {
sh = new ServletHolder(ServletContainer.class);
sh.setInitParameter(
"com.sun.jersey.config.property.resourceConfigClass",
"com.sun.jersey.api.core.PackagesResourceConfig");
sh.setInitParameter("com.sun.jersey.config.property.packages",
classBound);
// custom parameters
// Map<String, Object> initParameters = getCustomInitParamters(port);
// sh.setInitParameters(initParameters);
Server server = new Server(port);
Context context = new Context(server, "/", Context.SESSIONS);
context.addServlet(sh, "/*");
server.start();
}
示例9: start
public void start() throws Exception {
RealmService realmService = new InMemoryRealmService();
RegistryContext regContext = RegistryContext.getBaseInstance(realmService);
regContext.selectDBConfig("in-memory");
//RegistryContext.setSingleton(regContext);
server = new Server(port);
Context context = new Context(server, null/*RegistryProvider.baseURI*/, Context.SESSIONS);
ServletHolder servletHolder = new ServletHolder(new AbderaServlet());
servletHolder.setInitParameter(ServiceManager.PROVIDER,
RegistryProvider.class.getName());
context.addServlet(servletHolder, "/*");
server.start();
// root.addServlet(new ServletHolder(new RegistryServlet()), "/resources/*");
// root.addServlet(new ServletHolder(new AbderaServlet()), "/atom/*");
// server.start();
}
示例10: setup
@BeforeMethod
public void setup() throws Exception
{
RestEasyApplication.singletonsRef.set(new RestEasySingletons());
ResteasyProviderFactory.setInstance(new ResteasyProviderFactory());
HttpServletDispatcher dispatcher = new HttpServletDispatcher();
port = InstanceSpec.getRandomPort();
server = new Server(port);
Context root = new Context(server, "/", Context.SESSIONS);
root.getInitParams().put("javax.ws.rs.Application", RestEasyApplication.class.getName());
root.addServlet(new ServletHolder(dispatcher), "/*");
root.addEventListener(new ResteasyBootstrap());
server.start();
}
示例11: startServer
/**
* Starts the jetty web server.
* @return true on successful start.
*/
public boolean startServer() {
if (server != null && server.isRunning()) {
return true;
} else {
server = new Server(port);
ContextHandlerCollection contexts = new ContextHandlerCollection();
server.setHandler(contexts);
Context mjpg = new Context(contexts, MPEG, Context.SESSIONS);
mjpg.addServlet(new ServletHolder(new AxisServlet()), "/*");
try {
server.start();
return true;
} catch (Exception e1) {
log.error("Could not start server", e1);
}
}
return false;
}
示例12: MsTeamsNotificationTestServer
public MsTeamsNotificationTestServer(String host, Integer port) {
server = new Server(port);
Context root = new Context(server,"/",Context.SESSIONS);
root.addServlet(new ServletHolder(new MyHttpServlet(HttpServletResponse.SC_OK)), "/200");
root.addServlet(new ServletHolder(new MyHttpServlet(HttpServletResponse.SC_MOVED_TEMPORARILY)), "/302");
root.addServlet(new ServletHolder(new MyHttpServlet(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)), "/500");
}
示例13: main
/**
* Sets up and runs server.
* @param args
*/
public static void main(String[] args)
{
final Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(8080);
server.addConnector(connector);
Context htmlContext = new Context(server, "/", Context.SESSIONS);
ResourceHandler htmlHandler = new ResourceHandler();
htmlHandler.setResourceBase("web");
htmlContext.setHandler(htmlHandler);
Context servletContext = new Context(server, "/", Context.SESSIONS);
GenericWebApplicationContext springContext = new GenericWebApplicationContext();
springContext.setParent(new ClassPathXmlApplicationContext("org/getahead/dwrdemo/cli/spring.xml"));
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, springContext);
ServletHolder holder = new ServletHolder(new DwrSpringServlet());
holder.setInitParameter("pollAndCometEnabled", "true");
holder.setInitParameter("debug", "true");
servletContext.addServlet(holder, "/dwr/*");
try
{
JettyShutdown.addShutdownHook(server);
server.start();
server.join();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
示例14: main
/**
* Sets up and runs server.
* @param args
*/
public static void main(String[] args)
{
Server server = new Server();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(8080);
server.addConnector(connector);
Context htmlContext = new Context(server, "/", Context.SESSIONS);
ResourceHandler htmlHandler = new ResourceHandler();
htmlHandler.setResourceBase("web");
htmlContext.setHandler(htmlHandler);
Context servletContext = new Context(server, "/", Context.SESSIONS);
ServletHolder holder = new ServletHolder(new DwrServlet());
holder.setInitParameter("activeReverseAjaxEnabled", "true");
holder.setInitParameter("debug", "true");
servletContext.addServlet(holder, "/dwr/*");
servletContext.setResourceBase("web");
try
{
JettyShutdown.addShutdownHook(server);
server.start();
server.join();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
示例15: JettyServer
public JettyServer(int port, HttpsConfiguration httpsConf)
{
server = new Server();
SslSelectChannelConnector connector = new SslSelectChannelConnector();
connector.setPort(port);
connector.setKeystore(httpsConf.getServerKeystorePath());
connector.setKeyPassword(httpsConf.getServerKeystorePassword());
if ( httpsConf.isVerifyPeerCert() )
{
connector.setTruststore(httpsConf.getTruststorePath());
connector.setTrustPassword(httpsConf.getTruststorePassword());
connector.setNeedClientAuth(true);
}
connector.setWantClientAuth(httpsConf.isRequireClientCert());
connector.setAcceptors(8);
connector.setMaxIdleTime(5000);
connector.setAcceptQueueSize(32);
server.addConnector(connector);
server.setStopAtShutdown(true);
DefaultResourceConfig config = new DefaultResourceConfig(JettyServer.RestService.class);
ServletContainer container = new ServletContainer(config);
Context context = new Context(server, "/", Context.SESSIONS);
context.addServlet(new ServletHolder(container), "/*");
}