NotebookServer extends WebSocketServlet implements NotebookSocketListener,
        AngularObjectRegistryListener,
        RemoteInterpreterProcessListener,
        ApplicationEventListener,
        ParagraphJobListener,
        NoteEventListener,
        ClusterEventListener { public boolean checkOrigin(HttpServletRequest request, String origin) { try { return CorsUtils.isValidOrigin(origin, ZeppelinConfiguration.create()); } catch (UnknownHostException | URISyntaxException e) { LOG.error(e.toString(), e); } return false; } NotebookServer(); @Inject void setServiceLocator(ServiceLocator serviceLocator); @Inject void setNotebook(Provider<Notebook> notebookProvider); @Inject void setNotebookService(
      Provider<NotebookService> notebookServiceProvider); @Inject void setAuthorizationServiceProvider(Provider<AuthorizationService>
                                                      authorizationServiceProvider); @Inject void setConnectionManagerProvider(Provider<ConnectionManager> connectionManagerProvider); @Inject void setConfigurationService(
      Provider<ConfigurationService> configurationServiceProvider); @Inject void setJobManagerService(
      Provider<JobManagerService> jobManagerServiceProvider); static NotebookServer getInstance(); Notebook getNotebook(); ConnectionManager getConnectionManager(); NotebookService getNotebookService(); ConfigurationService getConfigurationService(); synchronized JobManagerService getJobManagerService(); AuthorizationService getNotebookAuthorizationService(); @Override void configure(WebSocketServletFactory factory); boolean checkOrigin(HttpServletRequest request, String origin); @Override void onOpen(NotebookSocket conn); @Override void onMessage(NotebookSocket conn, String msg); @Override void onClose(NotebookSocket conn, int code, String reason); void broadcast(Message m); void unicastNoteJobInfo(NotebookSocket conn, Message fromMessage); void broadcastUpdateNoteJobInfo(Note note, long lastUpdateUnixTime); void unsubscribeNoteJobInfo(NotebookSocket conn); void getInterpreterBindings(NotebookSocket conn, Message fromMessage); void saveInterpreterBindings(NotebookSocket conn, Message fromMessage); void broadcastNote(Note note); void broadcastParagraph(Note note, Paragraph p, String msgId); void inlineBroadcastNoteList(AuthenticationInfo subject, Set<String> userAndRoles); void broadcastNoteList(AuthenticationInfo subject, Set<String> userAndRoles); @Override void onClusterEvent(String msg); void listNotesInfo(NotebookSocket conn, Message message); void broadcastReloadedNoteList(NotebookSocket conn, ServiceContext context); @Override void onOutputAppend(String noteId, String paragraphId, int index, String output); @Override void onOutputUpdated(String noteId, String paragraphId, int index,
                              InterpreterResult.Type type, String output); @Override void onOutputClear(String noteId, String paragraphId); @Override void onOutputAppend(String noteId, String paragraphId, int index, String appId,
                             String output); @Override void onOutputUpdated(String noteId, String paragraphId, int index, String appId,
                              InterpreterResult.Type type, String output); @Override void onLoad(String noteId, String paragraphId, String appId, HeliumPackage pkg); @Override void onStatusChange(String noteId, String paragraphId, String appId, String status); @Override void runParagraphs(String noteId,
                            List<Integer> paragraphIndices,
                            List<String> paragraphIds,
                            String curParagraphId); @Override void onParagraphRemove(Paragraph p); @Override void onNoteRemove(Note note, AuthenticationInfo subject); @Override void onParagraphCreate(Paragraph p); @Override void onParagraphUpdate(Paragraph p); @Override void onNoteCreate(Note note, AuthenticationInfo subject); @Override void onNoteUpdate(Note note, AuthenticationInfo subject); @Override void onParagraphStatusChange(Paragraph p, Status status); @Override void onProgressUpdate(Paragraph p, int progress); @Override void onStatusChange(Paragraph p, Status before, Status after); @Override void checkpointOutput(String noteId, String paragraphId); @Override void noteRunningStatusChange(String noteId, boolean newStatus); @Override void onAddAngularObject(String interpreterGroupId, AngularObject angularObject); @Override void onUpdateAngularObject(String interpreterGroupId, AngularObject angularObject); @Override void onRemoveAngularObject(String interpreterGroupId, AngularObject angularObject); @Override void onParaInfosReceived(String noteId, String paragraphId,
                                  String interpreterSettingId, Map<String, String> metaInfos); @Override List<ParagraphInfo> getParagraphList(String user, String noteId); @ManagedAttribute Set<String> getConnectedUsers(); @ManagedOperation void sendMessage(String message);  }
@Test public void checkOrigin() throws UnknownHostException { String origin = "http: assertTrue("Origin " + origin + " is not allowed. Please check your hostname.", notebookServer.checkOrigin(mockRequest, origin)); }
@Test public void checkInvalidOrigin(){ assertFalse(notebookServer.checkOrigin(mockRequest, "http: }