protected override void service (HttpServletRequest req, HttpServletResponse resp) { const string assemblies = "/assemblies"; const string getping = "getping"; const string setping = "setping"; const string version = "2.2"; string servletPath = req.getServletPath (); if (String.CompareOrdinal (assemblies, 0, servletPath, 0, assemblies.Length) == 0) { if (servletPath.Length == assemblies.Length || servletPath [assemblies.Length] == '/') { string requestURI = req.getRequestURI (); bool getp = requestURI.EndsWith (getping, StringComparison.Ordinal); if (!getp && requestURI.EndsWith (setping, StringComparison.Ordinal)) { getServletContext().setAttribute(getping, version); getp = true; } if (getp) { string ping = (string) getServletContext ().getAttribute (getping); if (ping == null) ping = "0"; resp.getOutputStream ().print (ping); return; } } } resp.setContentType ("text/html"); try { // Very important - to update Virtual Path!!! AppDomain servletDomain = (AppDomain)this.getServletContext().getAttribute(J2EEConsts.APP_DOMAIN); if (!_appVirDirInited) { string appVPath = req.getContextPath (); if (appVPath == null || appVPath.Length == 0) appVPath = "/"; servletDomain.SetData (IAppDomainConfig.APP_VIRT_DIR, appVPath); servletDomain.SetData (".hostingVirtualPath", req.getContextPath ()); _appVirDirInited = true; } // Put to the TLS current AppDomain of the servlet, so anyone can use it. [email protected](servletDomain); // put request to the TLS //Thread.SetData(_servletRequestSlot, req); //// put response to the TLS //Thread.SetData(_servletResponseSlot, resp); //// put the servlet object to the TLS //Thread.SetData(_servletSlot, this); resp.setHeader("X-Powered-By", "ASP.NET"); resp.setHeader("X-AspNet-Version", "1.1.4322"); HttpWorkerRequest gwr = new ServletWorkerRequest (this, req, resp); CultureInfo culture = (CultureInfo) [email protected] (req.getLocale ()); Thread currentTread = Thread.CurrentThread; currentTread.CurrentCulture = culture; currentTread.CurrentUICulture = culture; HttpRuntime.ProcessRequest(gwr); } finally { HttpContext.Current = null; //Thread.SetData(_servletRequestSlot, null); //Thread.SetData(_servletResponseSlot, null); //Thread.SetData(_servletSlot, null); [email protected](); } }
protected override void service(HttpServletRequest req, HttpServletResponse resp) { const string assemblies = "/assemblies"; const string getping = "getping"; const string setping = "setping"; const string version = "2.2"; string servletPath = req.getServletPath(); if (String.CompareOrdinal(assemblies, 0, servletPath, 0, assemblies.Length) == 0) { if (servletPath.Length == assemblies.Length || servletPath [assemblies.Length] == '/') { string requestURI = req.getRequestURI(); bool getp = requestURI.EndsWith(getping, StringComparison.Ordinal); if (!getp && requestURI.EndsWith(setping, StringComparison.Ordinal)) { getServletContext().setAttribute(getping, version); getp = true; } if (getp) { string ping = (string)getServletContext().getAttribute(getping); if (ping == null) { ping = "0"; } resp.getOutputStream().print(ping); return; } } } resp.setContentType("text/html"); try { // Very important - to update Virtual Path!!! AppDomain servletDomain = (AppDomain)this.getServletContext().getAttribute(J2EEConsts.APP_DOMAIN); if (!_appVirDirInited) { string appVPath = req.getContextPath(); if (appVPath == null || appVPath.Length == 0) { appVPath = "/"; } servletDomain.SetData(IAppDomainConfig.APP_VIRT_DIR, appVPath); servletDomain.SetData(".hostingVirtualPath", req.getContextPath()); _appVirDirInited = true; } // Put to the TLS current AppDomain of the servlet, so anyone can use it. [email protected](servletDomain); // put request to the TLS //Thread.SetData(_servletRequestSlot, req); //// put response to the TLS //Thread.SetData(_servletResponseSlot, resp); //// put the servlet object to the TLS //Thread.SetData(_servletSlot, this); resp.setHeader("X-Powered-By", "ASP.NET"); resp.setHeader("X-AspNet-Version", "1.1.4322"); HttpWorkerRequest gwr = new ServletWorkerRequest(this, req, resp); CultureInfo culture = (CultureInfo)[email protected](req.getLocale()); Thread currentTread = Thread.CurrentThread; currentTread.CurrentCulture = culture; currentTread.CurrentUICulture = culture; HttpRuntime.ProcessRequest(gwr); } finally { HttpContext.Current = null; //Thread.SetData(_servletRequestSlot, null); //Thread.SetData(_servletResponseSlot, null); //Thread.SetData(_servletSlot, null); [email protected](); } }