@Override public void shutdown() throws Exception { server.stopServer(); } }, ServerMain.class.getSimpleName(), ShutdownPriority.Server);
private static void initializeServlets(ServerRpcProvider server, Config config) { server.addServlet("/gadget/gadgetlist", GadgetProviderServlet.class); server.addServlet(AttachmentServlet.ATTACHMENT_URL + "/*", AttachmentServlet.class); server.addServlet(AttachmentServlet.THUMBNAIL_URL + "/*", AttachmentServlet.class); server.addServlet(AttachmentInfoServlet.ATTACHMENTS_INFO_URL, AttachmentInfoServlet.class); server.addServlet(SessionManager.SIGN_IN_URL, AuthenticationServlet.class); server.addServlet("/auth/signout", SignOutServlet.class); server.addServlet("/auth/register", UserRegistrationServlet.class); server.addServlet("/locale/*", LocaleServlet.class); server.addServlet("/fetch/*", FetchServlet.class); server.addServlet("/search/*", SearchServlet.class); server.addServlet("/notification/*", NotificationServlet.class); server.addServlet("/robot/dataapi", DataApiServlet.class); server.addServlet(DataApiOAuthServlet.DATA_API_OAUTH_PATH + "/*", DataApiOAuthServlet.class); server.addServlet("/robot/dataapi/rpc", DataApiServlet.class); server.addServlet("/robot/register/*", RobotRegistrationServlet.class); server.addServlet("/robot/rpc", ActiveApiServlet.class); server.addServlet("/webclient/remote_logging", RemoteLoggingServiceImpl.class); server.addServlet("/profile/*", FetchProfilesServlet.class); server.addServlet("/iniavatars/*", InitialsAvatarsServlet.class); server.addServlet("/waveref/*", WaveRefServlet.class); server.addTransparentProxy("/gadgets/*", "http://" + gadgetServerHostname + ":" + gadgetServerPort + "/gadgets", "/gadgets"); server.addServlet("/", WaveClientServlet.class);
private static void initializeFrontend(Injector injector, ServerRpcProvider server, WaveBus waveBus) throws WaveServerException { HashedVersionFactory hashFactory = injector.getInstance(HashedVersionFactory.class); WaveletProvider provider = injector.getInstance(WaveletProvider.class); WaveletInfo waveletInfo = WaveletInfo.create(hashFactory, provider); ClientFrontend frontend = ClientFrontendImpl.create(provider, waveBus, waveletInfo); ProtocolWaveClientRpc.Interface rpcImpl = WaveClientRpcImpl.create(frontend, false); server.registerService(ProtocolWaveClientRpc.newReflectiveService(rpcImpl)); }
@Override public void setUp() throws Exception { super.setUp(); SessionManager sessionManager = Mockito.mock(SessionManager.class); /* * NOTE: Specifying port zero (0) causes the OS to select a random port. * This allows the test to run without clashing with any potentially in-use port. */ server = new ServerRpcProvider(new InetSocketAddress[] {new InetSocketAddress("localhost", 0)}, new String[] {"./war"}, sessionManager, null, null, false, null, null, MoreExecutors.sameThreadExecutor()); final Map<String, Object> props = new HashMap<>(); props.put("network.websocket_max_idle_time", 0); props.put("network.websocket_max_message_size", 2); Injector injector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { bind(ServerRpcProvider.class).toInstance(server); bind(Config.class).toInstance(ConfigFactory.parseMap(props)); } }); server.startWebSocketServer(injector); }
public void startWebSocketServer(final Injector injector) { httpServer = new Server(); List<Connector> connectors = getSelectChannelConnectors(httpAddresses); if (connectors.isEmpty()) { LOG.severe("No valid http end point address provided!"); context.setBaseResource(resources); addWebSocketServlets(); final ServletModule servletModule = getServletModule(); restoreSessions();
server.startWebSocketServer(injector);
private ClientRpcChannel newClient() throws IOException { return new WebSocketClientRpcChannel(server.getWebSocketAddress()); }
private static void initializeRobotAgents(ServerRpcProvider server) { server.addServlet(PasswordRobot.ROBOT_URI + "/*", PasswordRobot.class); server.addServlet(PasswordAdminRobot.ROBOT_URI + "/*", PasswordAdminRobot.class); server.addServlet(WelcomeRobot.ROBOT_URI + "/*", WelcomeRobot.class); server.addServlet(RegistrationRobot.ROBOT_URI + "/*", RegistrationRobot.class); }
server.registerService(WaveClientRpc.ProtocolWaveClientRpc.newReflectiveService(rpcImpl));
@Override public void setUp() throws Exception { super.setUp(); SessionManager sessionManager = Mockito.mock(SessionManager.class); org.eclipse.jetty.server.SessionManager jettySessionManager = Mockito.mock(org.eclipse.jetty.server.SessionManager.class); /* * NOTE: Specifying port zero (0) causes the OS to select a random port. * This allows the test to run without clashing with any potentially in-use port. */ server = new ServerRpcProvider(new InetSocketAddress[] {new InetSocketAddress("localhost", 0)}, new String[] {"./war"}, sessionManager, null, null, false, null, null, MoreExecutors.sameThreadExecutor(), 0, 2, 60, 3600, 3600, "localhost"); final Map<String, Object> props = new HashMap<>(); props.put("network.websocket_max_idle_time", 0); props.put("network.websocket_max_message_size", 2); Injector injector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { bind(ServerRpcProvider.class).toInstance(server); bind(Config.class).toInstance(ConfigFactory.parseMap(props)); bind(SessionManager.class).toInstance(sessionManager); bind(NamingStore.class).toInstance(Mockito.mock(NamingStore.class)); bind(WaveletProvider.class).toInstance(Mockito.mock(WaveletProvider.class)); } }); server.startWebSocketServer(injector); }
private ClientRpcChannel newClient() throws IOException { return new WebSocketClientRpcChannel(server.getWebSocketAddress()); }
/** * Add a servlet to the servlet registry. This servlet will be attached to the * specified URL pattern when the server is started up. * @param urlPattern the URL pattern for paths. Eg, '/foo', '/foo/*'. * @param servlet the servlet class to bind to the specified paths. * @return the {@link ServletHolder} that holds the servlet. */ public ServletHolder addServlet(String urlPattern, Class<? extends HttpServlet> servlet) { return addServlet(urlPattern, servlet, null); }
server.registerService(WaveClientRpc.ProtocolWaveClientRpc.newReflectiveService(rpcImpl));
@Override public void tearDown() throws Exception { server.stopServer(); server = null; client = null; super.tearDown(); }
public void addWebSocketServlets() { // Servlet where the websocket connection is served from. ServletHolder wsholder = addServlet("/socket", WaveWebSocketServlet.class); // TODO(zamfi): fix to let messages span frames. wsholder.setInitParameter("bufferSize", "" + BUFFER_SIZE); // Serve the static content and GWT web client with the default servlet // (acts like a standard file-based web server). addServlet("/static/*", DefaultServlet.class); addServlet("/webclient/*", DefaultServlet.class); }
server.registerService(WaveClientRpc.ProtocolWaveClientRpc.newReflectiveService(rpcImpl));
@Override public void tearDown() throws Exception { server.stopServer(); server = null; client = null; super.tearDown(); }
server.registerService(WaveClientRpc.ProtocolWaveClientRpc.newReflectiveService(rpcImpl));
server.registerService(WaveClientRpc.ProtocolWaveClientRpc.newReflectiveService(rpcImpl));
server.registerService(WaveClientRpc.ProtocolWaveClientRpc.newReflectiveService(rpcImpl));