コード例 #1
0
 public ServletWorkerRequest(HttpServlet servlet, HttpServletRequest req, HttpServletResponse resp)
     : base(req.getContextPath(), req.getServletPath(), req.getRequestURI())
 {
     _HttpServlet         = servlet;
     _HttpServletRequest  = req;
     _HttpServletResponse = resp;
 }
コード例 #2
0
ファイル: ServletWorkerRequest.cs プロジェクト: nlhepler/mono
		public ServletWorkerRequest (HttpServlet servlet, HttpServletRequest req, HttpServletResponse resp)
			: base (req.getContextPath(), req.getServletPath (), req.getRequestURI ()) {

			_HttpServlet = servlet;
			_HttpServletRequest = req;
			_HttpServletResponse = resp;

		}
コード例 #3
0
ファイル: BaseHttpServlet.cs プロジェクト: pmq20/mono_forked
    override protected void service(HttpServletRequest req, HttpServletResponse resp)
    {
        string pathInfo    = req.getRequestURI();
        string contextPath = req.getContextPath();

        if (pathInfo.Equals(contextPath) ||
            ((pathInfo.Length - contextPath.Length) == 1) &&
            pathInfo [pathInfo.Length - 1] == '/' && pathInfo.StartsWith(contextPath))
        {
            pathInfo = contextPath + req.getServletPath();
        }
        if (pathInfo.EndsWith(".aspx") ||
            pathInfo.EndsWith(".asmx") ||
            pathInfo.EndsWith(".invoke"))
        {
            base.service(req, resp);
        }
        else
        {
            staticServlet.service(req, resp);
        }
    }
コード例 #4
0
ファイル: BaseHttpServlet.cs プロジェクト: nlhepler/mono
	override protected void service (HttpServletRequest req, HttpServletResponse resp) {
		string pathInfo = req.getRequestURI ();
		string contextPath = req.getContextPath ();
		if (pathInfo.Equals (contextPath) ||
			((pathInfo.Length - contextPath.Length) == 1) &&
			pathInfo [pathInfo.Length - 1] == '/' && pathInfo.StartsWith (contextPath))
			pathInfo = contextPath + req.getServletPath ();
		if (pathInfo.EndsWith (".aspx") ||
			pathInfo.EndsWith (".asmx") ||
			pathInfo.EndsWith (".invoke")) {
			base.service (req, resp);
		}
		else {
			staticServlet.service (req, resp);
		}
	}
コード例 #5
0
ファイル: BaseHttpServlet.cs プロジェクト: nlhepler/mono
		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]();
			}
		}
 public override string getContextPath()
 {
     return(_request.getContextPath());
 }
コード例 #7
0
ファイル: BaseHttpServlet.cs プロジェクト: pmq20/mono_forked
        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]();
            }
        }