def startStream(self, msg):
     try: 
         connection = self.channel_set.connection_manager.getConnection(msg.headers.get(msg.FLEX_CLIENT_ID_HEADER))
     except (KeyboardInterrupt, SystemExit):
         raise
     except Exception, exc:
         amfast.log_exc(exc)
         raise ChannelError('Http streaming operation unknown: %s' % msg.operation)
Exemple #2
0
 def decode(self, *args, **kwargs):
     """Decode a raw request."""
     try:
         return self.endpoint.decodePacket(*args, **kwargs)
     except amfast.AmFastError, exc:
         # Not much we can do if packet is not decoded properly
         amfast.log_exc(exc)
         raise exc
Exemple #3
0
 def decode(self, *args, **kwargs):
     """Decode a raw request."""
     try:
         return self.endpoint.decodePacket(*args, **kwargs)
     except amfast.AmFastError, exc:
         # Not much we can do if packet is not decoded properly
         amfast.log_exc(exc)
         raise exc
Exemple #4
0
    def startStream(self, environ, start_response, msg):
        """Start streaming response."""

        try:
            connection = self.channel_set.connection_manager.getConnection(msg.headers.get(msg.FLEX_CLIENT_ID_HEADER))
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            return self.badServer(start_response, self.getBadServerMsg())
Exemple #5
0
 def startStream(self, msg):
     try:
         connection = self.channel_set.connection_manager.getConnection(
             msg.headers.get(msg.FLEX_CLIENT_ID_HEADER))
     except (KeyboardInterrupt, SystemExit):
         raise
     except Exception, exc:
         amfast.log_exc(exc)
         raise ChannelError('Http streaming operation unknown: %s' %
                            msg.operation)
Exemple #6
0
    def startStream(self, environ, start_response, msg):
        """Start streaming response."""

        try:
            connection = self.channel_set.connection_manager.getConnection(
                msg.headers.get(msg.FLEX_CLIENT_ID_HEADER))
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            return self.badServer(start_response, self.getBadServerMsg())
 def __call__(self, http_request):
     if http_request.META['CONTENT_TYPE'] == self.CONTENT_TYPE:
         return DjangoChannel.__call__(self, http_request)
         
     try:
         body = http_request.raw_post_data
         msg = messaging.StreamingMessage()
         msg.parseBody(body)
         #django has a well wrapped http_request object which contents all the wsgi options
         msg.parseParams(http_request.META['QUERY_STRING'])
     except (KeyboardInterrupt, SystemExit):
         raise
     except Exception, exc:
         amfast.log_exc(exc)
Exemple #8
0
    def __call__(self, http_request):
        if http_request.META['CONTENT_TYPE'] == self.CONTENT_TYPE:
            return DjangoChannel.__call__(self, http_request)

        try:
            body = http_request.raw_post_data
            msg = messaging.StreamingMessage()
            msg.parseBody(body)
            #django has a well wrapped http_request object which contents all the wsgi options
            msg.parseParams(http_request.META['QUERY_STRING'])
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
Exemple #9
0
    def __call__(self, environ, start_response):
        if environ['CONTENT_TYPE'] == self.CONTENT_TYPE:
            # Regular AMF message
            return WsgiChannel.__call__(self, environ, start_response)

        # Create streaming message command
        try:
            msg = messaging.StreamingMessage()
            msg.parseParams(environ['QUERY_STRING'])

            body = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH']))
            msg.parseBody(body)
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            return self.badServer(start_response, self.getBadServerMsg())
Exemple #10
0
    def __call__(self, environ, start_response):
        if environ['CONTENT_TYPE'] == self.CONTENT_TYPE:
            # Regular AMF message
            return WsgiChannel.__call__(self, environ, start_response)

        # Create streaming message command
        try:
            msg = messaging.StreamingMessage()
            msg.parseParams(environ['QUERY_STRING'])

            body = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH']))
            msg.parseBody(body)
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            return self.badServer(start_response, self.getBadServerMsg())
    def __call__(self, command=None, version=None):
        if cherrypy.request.headers['Content-Type'] == self.CONTENT_TYPE:
            # Regular AMF message
            return CherryPyChannel.__call__(self)

        # Create streaming message command
        cherrypy.response.headers['Content-Type'] = self.CONTENT_TYPE
        cherrypy.response.stream = True
        try:
            msg = messaging.StreamingMessage()
            msg.parseParams(cherrypy.request.query_string)

            c_len = int(cherrypy.request.headers['Content-Length'])
            body = cherrypy.request.rfile.read(c_len)
            msg.parseBody(body)
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            raise ChannelError("AMF server error.")
    def __call__(self, command=None, version=None):
        if cherrypy.request.headers['Content-Type'] == self.CONTENT_TYPE:
            # Regular AMF message
            return CherryPyChannel.__call__(self)

        # Create streaming message command
        cherrypy.response.headers['Content-Type'] = self.CONTENT_TYPE
        cherrypy.response.stream = True
        try:
            msg = messaging.StreamingMessage()
            msg.parseParams(cherrypy.request.query_string)

            c_len = int(cherrypy.request.headers['Content-Length'])
            body = cherrypy.request.rfile.read(c_len)
            msg.parseBody(body)
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            raise ChannelError("AMF server error.")
Exemple #13
0
    # be accessed from a target.
    DJANGO_REQUEST = '_django_request'

    def __call__(self, http_request):
        if http_request.method != 'POST':
            return http.HttpResponseNotAllowed(['POST'])

        try:
            request_packet = self.decode(http_request.raw_post_data)
            setattr(request_packet, self.DJANGO_REQUEST, http_request)
        except amfast.AmFastError, exc:
            return http.HttpResponseBadRequest(mimetype='text/plain', content=self.getBadEncodingMsg())
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            return http.HttpResponseServerError(mimetype='text/plain', content=self.getBadServerMsg())

        try:
            response_packet = self.invoke(request_packet)
            raw_response = self.encode(response_packet)

            http_response = http.HttpResponse(mimetype=self.CONTENT_TYPE)
            http_response['Content-Length'] = str(len(raw_response))
            http_response.write(raw_response)
            return http_response
        except amfast.AmFastError, exc:
            return http.HttpResponseServerError(mimetype='text/plain', content=self.getBadServerMsg())
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
Exemple #14
0
    DJANGO_REQUEST = '_django_request'

    def __call__(self, http_request):
        if http_request.method != 'POST':
            return http.HttpResponseNotAllowed(['POST'])

        try:
            request_packet = self.decode(http_request.raw_post_data)
            setattr(request_packet, self.DJANGO_REQUEST, http_request)
        except amfast.AmFastError, exc:
            return http.HttpResponseBadRequest(
                mimetype='text/plain', content=self.getBadEncodingMsg())
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            return http.HttpResponseServerError(mimetype='text/plain',
                                                content=self.getBadServerMsg())

        try:
            response_packet = self.invoke(request_packet)
            raw_response = self.encode(response_packet)

            http_response = http.HttpResponse(mimetype=self.CONTENT_TYPE)
            http_response['Content-Length'] = str(len(raw_response))
            http_response.write(raw_response)
            return http_response
        except amfast.AmFastError, exc:
            return http.HttpResponseServerError(mimetype='text/plain',
                                                content=self.getBadServerMsg())
        except (KeyboardInterrupt, SystemExit):