bokeh.server.views

autoload_js_handler

Provide a request handler that returns a page displaying a document.

class AutoloadJsHandler(tornado_app, *args, **kw)[source]

Implements a custom Tornado handler for the autoload JS chunk

doc_handler

Provide a request handler that returns a page displaying a document.

class DocHandler(tornado_app, *args, **kw)[source]

Implements a custom Tornado handler for document display page

autoload_metadata_handler

Provide a request handler that returns a json with metadata information from the application

class MetadataHandler(tornado_app, *args, **kw)[source]

Implements a custom Tornado handler for document display page

root_handler

Provide a Request handler that lists the application (if more than one) or (if only one) redirects to the route of that applications.

class RootHandler(application, request, **kwargs)[source]

Implements a custom Tornado handler to display the available applications If only one application it redirects to that application route

initialize(*args, **kw)[source]

Hook for subclass initialization. Called for each request.

A dictionary passed as the third argument of a url spec will be supplied as keyword arguments to initialize().

Example:

class ProfileHandler(RequestHandler):
    def initialize(self, database):
        self.database = database

    def get(self, username):
        ...

app = Application([
    (r'/user/(.*)', ProfileHandler, dict(database=database)),
    ])

session_handler

Abstract request handler that handles bokeh-session-id

class SessionHandler(tornado_app, *args, **kw)[source]

Implements a custom Tornado handler for document display page

initialize(*args, **kw)[source]

Hook for subclass initialization. Called for each request.

A dictionary passed as the third argument of a url spec will be supplied as keyword arguments to initialize().

Example:

class ProfileHandler(RequestHandler):
    def initialize(self, database):
        self.database = database

    def get(self, username):
        ...

app = Application([
    (r'/user/(.*)', ProfileHandler, dict(database=database)),
    ])

static_handler

Provide a request handler that returns a page displaying a document.

class StaticHandler(tornado_app, *args, **kw)[source]

Implements a custom Tornado static file handler for BokehJS JavaScript and CSS resources.

ws

Provide a web socket handler for the Bokeh Server application.

class WSHandler(tornado_app, *args, **kw)[source]

Implements a custom Tornado WebSocketHandler for the Bokeh Server.

check_origin(origin)[source]

Implement a check_origin policy for Tornado to call.

The suplied origin will be compared to the Bokeh server whitelist. If the origin is not allow, an error will be logged and False will be returned.

Parameters:origin (str) – The URL of the connection origin
Returns:bool, True if the connection is allowed, False otherwise
initialize(application_context, bokeh_websocket_path)[source]

Hook for subclass initialization. Called for each request.

A dictionary passed as the third argument of a url spec will be supplied as keyword arguments to initialize().

Example:

class ProfileHandler(RequestHandler):
    def initialize(self, database):
        self.database = database

    def get(self, username):
        ...

app = Application([
    (r'/user/(.*)', ProfileHandler, dict(database=database)),
    ])
on_close()[source]

Clean up when the connection is closed.

on_message(fragment)[source]

Process an individual wire protocol fragment.

The websocket RFC specifies opcodes for distinguishing text frames from binary frames. Tornado passes us either a text or binary string depending on that opcode, we have to look at the type of the fragment to see what we got.

Parameters:fragment (unicode or bytes) – wire fragment to process
on_pong(data)[source]

Invoked when the response to a ping frame is received.

open()[source]

Initialize a connection to a client.

Returns:None
send_message(message)[source]

Send a Bokeh Server protocol message to the connected client.

Parameters:message (Message) – a message to send
write_message(message, binary=False, locked=True)[source]

Override parent write_message with a version that acquires a write lock before writing.