-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFluentWebContextHandler.cs
More file actions
49 lines (44 loc) · 1.71 KB
/
FluentWebContextHandler.cs
File metadata and controls
49 lines (44 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using Common.Logging;
using Spring.Context;
using Spring.Context.Support;
using Spring.Core.IO;
namespace Spring.FluentContext.Web
{
public class FluentWebContextHandler : WebContextHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(WebContextHandler));
private readonly string _configurator;
public FluentWebContextHandler()
{
_configurator = ConfigurationManager.AppSettings["SpringConfigurator"];
}
/// <summary>
/// Sets default context type to <see cref="FluentWebApplicationContext"/>
/// </summary>
protected override Type DefaultApplicationContextType
{
get { return typeof(FluentWebApplicationContext); }
}
/// <summary>
/// Handles web specific details of context instantiation.
/// </summary>
protected override IApplicationContext InstantiateContext(IApplicationContext parent, object configContext,
string contextName, Type contextType, bool caseSensitive, IList<string> resources)
{
string[] resourcesArray = resources.Union(
string.IsNullOrWhiteSpace(_configurator)
? new string[0]
: new[]
{
FluentWebApplicationContext.SpringConfiguratorKey +
ConfigurableResourceLoader.ProtocolSeparator + _configurator
}).ToArray();
return base.InstantiateContext(parent, configContext, contextName, contextType, caseSensitive,
resourcesArray);
}
}
}