1
// Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
;
19 using System
.Web
.SessionState
;
20 using Castle
.MonoRail
.Framework
.Adapters
;
21 using Castle
.MonoRail
.Framework
.Container
;
26 public class DefaultEngineContextFactory
: IEngineContextFactory
31 /// <param name="container"></param>
32 /// <param name="urlInfo"></param>
33 /// <param name="context"></param>
34 /// <returns></returns>
35 public IEngineContext
Create(IMonoRailContainer container
, UrlInfo urlInfo
, HttpContext context
)
37 IDictionary session
= ResolveRequestSession(container
, urlInfo
, context
);
39 IUrlBuilder urlBuilder
= container
.UrlBuilder
;
41 return new DefaultEngineContext(container
, urlInfo
, context
,
42 new ServerUtilityAdapter(context
.Server
),
43 new RequestAdapter(context
.Request
),
44 new ResponseAdapter(context
.Response
, urlInfo
, urlBuilder
),
45 new TraceAdapter(context
.Trace
), session
);
49 /// Resolves the request session.
51 protected virtual IDictionary
ResolveRequestSession(IMonoRailContainer container
, UrlInfo urlInfo
, HttpContext context
)