Class AbstractHttpTransport

  • All Implemented Interfaces:
    org.cometd.bayeux.server.ServerTransport, org.cometd.bayeux.Transport, org.eclipse.jetty.util.component.Dumpable
    Direct Known Subclasses:
    AbstractStreamHttpTransport, AsyncJSONTransport

    public abstract class AbstractHttpTransport
    extends AbstractServerTransport

    HTTP ServerTransport base class, used by ServerTransports that use HTTP as transport or to initiate a transport connection.

    • Field Detail

      • JSON_DEBUG_OPTION

        public static final java.lang.String JSON_DEBUG_OPTION
        See Also:
        Constant Field Values
      • BROWSER_COOKIE_NAME_OPTION

        public static final java.lang.String BROWSER_COOKIE_NAME_OPTION
        See Also:
        Constant Field Values
      • BROWSER_COOKIE_DOMAIN_OPTION

        public static final java.lang.String BROWSER_COOKIE_DOMAIN_OPTION
        See Also:
        Constant Field Values
      • BROWSER_COOKIE_PATH_OPTION

        public static final java.lang.String BROWSER_COOKIE_PATH_OPTION
        See Also:
        Constant Field Values
      • BROWSER_COOKIE_SECURE_OPTION

        public static final java.lang.String BROWSER_COOKIE_SECURE_OPTION
        See Also:
        Constant Field Values
      • BROWSER_COOKIE_HTTP_ONLY_OPTION

        public static final java.lang.String BROWSER_COOKIE_HTTP_ONLY_OPTION
        See Also:
        Constant Field Values
      • MAX_SESSIONS_PER_BROWSER_OPTION

        public static final java.lang.String MAX_SESSIONS_PER_BROWSER_OPTION
        See Also:
        Constant Field Values
      • HTTP2_MAX_SESSIONS_PER_BROWSER_OPTION

        public static final java.lang.String HTTP2_MAX_SESSIONS_PER_BROWSER_OPTION
        See Also:
        Constant Field Values
      • MULTI_SESSION_INTERVAL_OPTION

        public static final java.lang.String MULTI_SESSION_INTERVAL_OPTION
        See Also:
        Constant Field Values
      • TRUST_CLIENT_SESSION

        public static final java.lang.String TRUST_CLIENT_SESSION
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractHttpTransport

        protected AbstractHttpTransport​(BayeuxServerImpl bayeux,
                                        java.lang.String name)
    • Method Detail

      • getMultiSessionInterval

        protected long getMultiSessionInterval()
      • accept

        public abstract boolean accept​(javax.servlet.http.HttpServletRequest request)
      • handle

        public abstract void handle​(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)
                             throws java.io.IOException,
                                    javax.servlet.ServletException
        Throws:
        java.io.IOException
        javax.servlet.ServletException
      • write

        protected abstract void write​(AbstractHttpTransport.Context context,
                                      java.util.List<org.cometd.bayeux.server.ServerMessage> messages,
                                      org.cometd.bayeux.Promise<java.lang.Void> promise)
      • processMessages

        protected void processMessages​(AbstractHttpTransport.Context context,
                                       org.cometd.bayeux.server.ServerMessage.Mutable[] messages,
                                       org.cometd.bayeux.Promise<java.lang.Void> promise)
      • findCurrentSessions

        protected java.util.Collection<ServerSessionImpl> findCurrentSessions​(javax.servlet.http.HttpServletRequest request)
      • isHTTP2

        protected boolean isHTTP2​(javax.servlet.http.HttpServletRequest request)
      • resume

        protected void resume​(AbstractHttpTransport.Context context,
                              org.cometd.bayeux.server.ServerMessage.Mutable message,
                              org.cometd.bayeux.Promise<java.lang.Void> promise)
      • sendError

        protected void sendError​(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 int code,
                                 java.lang.Throwable failure)
      • findBrowserId

        protected java.lang.String findBrowserId​(javax.servlet.http.HttpServletRequest request)
      • setBrowserId

        protected java.lang.String setBrowserId​(javax.servlet.http.HttpServletRequest request,
                                                javax.servlet.http.HttpServletResponse response)
      • incBrowserId

        protected boolean incBrowserId​(ServerSessionImpl session,
                                       boolean http2)
        Increments the count of sessions for the given browser identifier.
        Parameters:
        session - the session that increments the count
        http2 - whether the HTTP protocol is HTTP/2
        Returns:
        true if the count is below the max sessions per browser value. If false is returned, the count is not incremented.
        See Also:
        decBrowserId(ServerSessionImpl, boolean)
      • decBrowserId

        protected void decBrowserId​(ServerSessionImpl session,
                                    boolean http2)
      • handleJSONParseException

        protected void handleJSONParseException​(javax.servlet.http.HttpServletRequest request,
                                                javax.servlet.http.HttpServletResponse response,
                                                java.lang.String json,
                                                java.lang.Throwable failure)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • handleMessage

        protected void handleMessage​(AbstractHttpTransport.Context context,
                                     org.cometd.bayeux.server.ServerMessage.Mutable message,
                                     org.cometd.bayeux.Promise<org.cometd.bayeux.server.ServerMessage.Mutable> promise)