Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail / Castle.MonoRail.Framework / Services / DefaultEngineContextFactory.cs
blobde1ad7d31f056ecc719406cbc626f344639302d0
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Framework.Services
17 using System.Collections;
18 using System.Web;
19 using System.Web.SessionState;
20 using Castle.MonoRail.Framework.Adapters;
21 using Castle.MonoRail.Framework.Container;
22 using Routing;
24 /// <summary>
25 /// Pendent
26 /// </summary>
27 public class DefaultEngineContextFactory : IEngineContextFactory
29 /// <summary>
30 /// Pendent.
31 /// </summary>
32 /// <param name="container"></param>
33 /// <param name="urlInfo"></param>
34 /// <param name="context"></param>
35 /// <param name="routeMatch"></param>
36 /// <returns></returns>
37 public IEngineContext Create(IMonoRailContainer container, UrlInfo urlInfo, HttpContext context, RouteMatch routeMatch)
39 IDictionary session = ResolveRequestSession(container, urlInfo, context);
41 IUrlBuilder urlBuilder = container.UrlBuilder;
43 ServerUtilityAdapter serverUtility = new ServerUtilityAdapter(context.Server);
45 string referrer = context.Request.Headers["Referer"];
47 return new DefaultEngineContext(container, urlInfo, context,
48 serverUtility,
49 new RequestAdapter(context.Request),
50 new ResponseAdapter(context.Response, urlInfo, urlBuilder, serverUtility, routeMatch, referrer),
51 new TraceAdapter(context.Trace), session);
54 /// <summary>
55 /// Resolves the request session.
56 /// </summary>
57 protected virtual IDictionary ResolveRequestSession(IMonoRailContainer container, UrlInfo urlInfo, HttpContext context)
59 return null;