public void AddPage(IServletPage aPage)
        {
            string sName = aPage.Address;

            if (!m_isCaseSensitive)
            {
                sName = sName.ToLower();
            }
            m_pages[sName] = aPage;
        }
        //http://localhost:8080/DirectoryTree.xsp
        public void Answer(WebRequest aRequest)
        {
            IServletPage page = getPage(aRequest.File);

            if (page != null)
            {
                try
                {
                    if (page.IsBuffered && !aRequest.Response.IsInMemoryStreamMode)
                    {
                        aRequest.Response.SwitchToMemoryStream();
                    }

                    page.Answer(aRequest);
                }
                catch (Exception ex)
                {
                    if (page.IsBuffered)
                    {
                        try
                        {
                            string sNewPage = page.getExceptionPage(aRequest);
                            if (sNewPage == null)
                            {
                                throw new Exception("No error page defined");
                            }

                            aRequest.Response.Reset();
                            ExceptionWebRequest exRequest = new ExceptionWebRequest(sNewPage, aRequest, ex);
                            aRequest.Server.InvokeRequest(exRequest);
                        }
                        catch (Exception innerEx)
                        {
                            try
                            {
                                aRequest.Response.Reset();
                                aRequest.Response.SendContent("text/html");
                                aRequest.Response.WriteLine("<html><body><pre>");
                                Util.WriteExceptionToResponse(innerEx, aRequest.Response);
                                aRequest.Response.WriteLine("</pre><br>Original exeception was:<pre>");
                                Util.WriteExceptionToResponse(ex, aRequest.Response);
                                aRequest.Response.WriteLine("</pre></body></html>");
                            }
                            catch (Exception innerEx2)
                            {
                                Util.WriteException(innerEx2);
                            }
                        }
                    }
                }
            }
        }
        public void AddAllPages(Assembly aAssembly)
        {
            foreach (Type tp in aAssembly.GetTypes())
            {
                if (tp.IsClass && !tp.IsAbstract && tp.IsPublic && tp.GetCustomAttributes(typeof(ServletPage), false).Length > 0)
                {
                    try
                    {
                        object       obj   = tp.GetConstructor(new Type[] {}).Invoke(new object[] {});
                        IServletPage aPage = (IServletPage)obj;
                        //some servlets might need initialization

                        aPage.Initialize();
                        //TODO://
                        AddPage(aPage);
                    }
                    catch (Exception ex)
                    {
                        Util.WriteException(ex);
                    }
                }
            }
        }