Exemplo n.º 1
0
        private void OnEncode(ISession session, object data, System.IO.Stream stream)
        {
            PipeStream    pstream      = stream.ToPipeStream();
            IDataResponse dataResponse = data as IDataResponse;

            if (dataResponse != null)
            {
                dataResponse.Write(pstream);
            }
            else
            {
                if (session.Server.EnableLog(LogType.Error))
                {
                    session.Server.Log(LogType.Error, session, $"{session.RemoteEndPoint} response {data} no impl  IDataResponse");
                }
            }
            //StaticResurce.FileBlock fb = data as StaticResurce.FileBlock;
            //if (fb != null)
            //{
            //    fb.Write(pstream);
            //}
            //else
            //{
            //    DataFrame dataPacket = data as DataFrame;
            //    if (dataPacket != null)
            //    {
            //        dataPacket.Write(pstream);
            //    }
            //    else
            //    {
            //        HttpResponse response = (HttpResponse)data;
            //        response.Write(pstream);
            //    }
            //}
        }
Exemplo n.º 2
0
        private void OnEncode(ISession session, object data, System.IO.Stream stream)
        {
            PipeStream    pstream      = stream.ToPipeStream();
            IDataResponse dataResponse = data as IDataResponse;

            if (dataResponse != null)
            {
                dataResponse.Write(pstream);
            }
            else
            {
                if (session.Server.EnableLog(LogType.Error))
                {
                    session.Server.Log(LogType.Error, session, $"HTTP {session.RemoteEndPoint} response {data} no impl  IDataResponse");
                }
            }
        }