Exemple #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void handle(String target, org.eclipse.jetty.server.Request baseRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
        public override void Handle(string target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
        {
            HttpChannel httpChannel = baseRequest.HttpChannel;

            if (httpChannel != null)                 // if the channel is not null, all good, you handle yourself.
            {
                base.Handle(target, baseRequest, request, response);
            }
            else               // if we do not have a real channel, then we just log ourselves
            {
                try
                {
                    if (_handler != null)
                    {
                        _handler.handle(target, baseRequest, request, response);
                    }
                }
                finally
                {
                    RequestLog requestLog = RequestLog;
                    if (requestLog != null && baseRequest.DispatcherType == DispatcherType.REQUEST)
                    {
                        requestLog.log(baseRequest, ( Response )response);
                    }
                }
            }
        }
Exemple #2
0
        private static Request NewRequest()
        {
            HttpChannel channel  = mock(typeof(HttpChannel));
            Response    response = new Response(channel, mock(typeof(HttpOutput)));
            Request     request  = new Request(channel, mock(typeof(HttpInput)));

            when(channel.Request).thenReturn(request);
            when(channel.Response).thenReturn(response);
            return(request);
        }