Java Code Examples for org.mortbay.jetty.servlet.ServletHolder#put()
The following examples show how to use
org.mortbay.jetty.servlet.ServletHolder#put() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VmBoundServiceTest.java From jrpip with Apache License 2.0 | 6 votes |
private void setupServer() throws Exception { this.server = new HttpServer(); SocketListener listener = new SocketListener(); listener.setPort(PORT); this.server.addListener(listener); HttpContext context = new HttpContext(); context.setContextPath("/"); ServletHandler servletHandler = new ServletHandler(); context.addHandler(servletHandler); // Map a servlet onto the container ServletHolder holder = servletHandler.addServlet("JrpipServlet", "/JrpipServlet", "com.gs.jrpip.server.JrpipServlet"); holder.put("serviceInterface.Echo", "com.gs.jrpip.Echo"); holder.put("vmBoundServiceClass.Echo", "com.gs.jrpip.EchoImpl"); holder.setInitOrder(10); this.server.addContext(context); this.server.start(); this.servlet = (JrpipServlet) holder.getServlet(); }
Example 2
Source File: JrpipListenerTest.java From jrpip with Apache License 2.0 | 4 votes |
@Override protected void addCustomConfiguration(ServletHolder holder) { holder.put(LISTENER_NAME, "com.gs.jrpip.FakeListener"); }
Example 3
Source File: JrpipTestCase.java From jrpip with Apache License 2.0 | 4 votes |
protected void setupServerWithHandler( HttpHandler handler, SecurityConstraint constraint, UserRealm realm) throws Exception { this.port = (int) (Math.random() * 10000.0 + 10000.0); this.jrpipUrl = "http://localhost:" + this.port + "/JrpipServlet"; this.server = new HttpServer(); SocketListener listener = new SocketListener(); listener.setPort(this.port); this.server.addListener(listener); HttpContext context = new HttpContext(); context.setContextPath("/"); if (realm != null) { context.setRealm(realm); } if (constraint != null) { context.addSecurityConstraint("/", constraint); } if (handler != null) { context.addHandler(handler); } ServletHandler servletHandler = new ServletHandler(); context.addHandler(servletHandler); ServletHolder holder = servletHandler.addServlet("JrpipServlet", "/JrpipServlet", "com.gs.jrpip.server.JrpipServlet"); holder.put("serviceInterface.Echo", "com.gs.jrpip.Echo"); holder.put("serviceClass.Echo", "com.gs.jrpip.EchoImpl"); this.addCustomConfiguration(holder); holder.setInitOrder(10); this.server.addContext(context); this.server.start(); this.servlet = (JrpipServlet) holder.getServlet(); }
Example 4
Source File: MethodInterceptorTest.java From jrpip with Apache License 2.0 | 4 votes |
@Override protected void addCustomConfiguration(ServletHolder holder) { holder.put("methodInterceptor", TestMethodInterceptor.class.getName()); }