Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Configuration/Bvn404HandlerConfiguration.csd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<configurationSectionModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="d0ed9acb-0435-4532-afdd-b5115bc4d562" namespace="BVNetwork.NotFound.Configuration" xmlSchemaNamespace="BVNetwork404HandlerConfiguration" assemblyName="BVNetwork.NotFound.Configuration" xmlns="http://schemas.microsoft.com/dsltools/ConfigurationSectionDesigner">
<configurationSectionModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="d0ed9acb-0435-4532-afdd-b5115bc4d562" namespace="BVNetwork.NotFound.Configuration" xmlSchemaNamespace="BVNetwork404HandlerConfiguration" xmlns="http://schemas.microsoft.com/dsltools/ConfigurationSectionDesigner">
<typeDefinitions>
<externalType name="String" namespace="System" />
<externalType name="Boolean" namespace="System" />
Expand Down Expand Up @@ -43,6 +43,11 @@
<externalTypeMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/String" />
</type>
</attributeProperty>
<attributeProperty name="IgnoredResourceExtensions" isRequired="false" isKey="false" isDefaultCollection="false" xmlName="ignoredResourceExtensions" isReadOnly="false">
<type>
<externalTypeMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/String" />
</type>
</attributeProperty>
</attributeProperties>
<elementProperties>
<elementProperty name="Bvn404HandlerProviders" isRequired="false" isKey="false" isDefaultCollection="true" xmlName="providers" isReadOnly="false">
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Bvn404HandlerConfiguration.csd.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
-->
<configuration>
<configSections>
<section name="bvn404Handler" type="BVNetwork.NotFound.Configuration.Bvn404HandlerConfiguration, BVNetwork.NotFound.Configuration"/>
<section name="bvn404Handler" type="BVNetwork.NotFound.Configuration.Bvn404HandlerConfiguration, BVNetwork.FileNotFound.Configuration, Version=, Culture=neutral, PublicKeyToken=null"/>
</configSections>
<bvn404Handler xmlns="BVNetwork404HandlerConfiguration">
<!--
Expand Down
128 changes: 80 additions & 48 deletions src/Configuration/Bvn404HandlerConfiguration.csd.cs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/Configuration/Bvn404HandlerConfiguration.csd.diagram
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<minimalLanguageDiagram dslVersion="1.0.0.0" Id="6e974b3c-55cf-45df-b54b-11e3818a3486" absoluteBounds="0, 0, 11, 8.5" name="ConfigurationSection">
<configurationSectionModelMoniker Id="d0ed9acb-0435-4532-afdd-b5115bc4d562" />
<nestedChildShapes>
<configurationSectionShape Id="4e9076e6-b7d0-48d4-8fed-219aa3816648" absoluteBounds="4, 2.25, 2, 2.3648893229166665" outlineDashStyle="Solid" outlineThickness="0.015625">
<configurationSectionShape Id="4e9076e6-b7d0-48d4-8fed-219aa3816648" absoluteBounds="4, 2.25, 2, 2.5571907552083317" outlineDashStyle="Solid" outlineThickness="0.015625">
<configurationSectionMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/Bvn404HandlerConfiguration" />
<nestedChildShapes>
<elementListCompartment Id="4c7416b8-1881-48ed-8dd4-f8cb2eb21497" absoluteBounds="4.015, 2.66, 1.9700000000000002, 1.4031982421875" name="AttributeProperties" titleTextColor="Black" itemTextColor="Black" />
<elementListCompartment Id="8b43feba-2879-4bb7-9661-e6b86a45d31e" absoluteBounds="4.015, 4.0731982421875, 1.9700000000000002, 0.44169108072916674" name="ElementProperties" titleTextColor="Black" itemTextColor="Black" />
<elementPropertyHasTypeConnector edgePoints="[(5.25 : 4.61488932291667); (5.25 : 5.125)]" fixedFrom="Algorithm" fixedTo="Algorithm" TargetRelationshipDomainClassId="817738b5-f315-4a74-9d4f-6ec5e726ddef">
<elementListCompartment Id="4c7416b8-1881-48ed-8dd4-f8cb2eb21497" absoluteBounds="4.015, 2.66, 1.9700000000000002, 1.5954996744791665" name="AttributeProperties" titleTextColor="Black" itemTextColor="Black" />
<elementListCompartment Id="8b43feba-2879-4bb7-9661-e6b86a45d31e" absoluteBounds="4.015, 4.265499674479166, 1.9700000000000002, 0.44169108072916652" name="ElementProperties" titleTextColor="Black" itemTextColor="Black" />
<elementPropertyHasTypeConnector edgePoints="[(5.25 : 4.80719075520833); (5.25 : 5.125)]" fixedFrom="Algorithm" fixedTo="Algorithm" TargetRelationshipDomainClassId="817738b5-f315-4a74-9d4f-6ec5e726ddef">
<relativeChildShapes />
<nodes>
<configurationSectionShapeMoniker Id="4e9076e6-b7d0-48d4-8fed-219aa3816648" />
Expand Down
15 changes: 9 additions & 6 deletions src/Configuration/Bvn404HandlerConfiguration.csd.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
<xs:schema xmlns:tns="BVNetwork404HandlerConfiguration" elementFormDefault="qualified" targetNamespace="BVNetwork404HandlerConfiguration" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="bvn404Handler" type="tns:BVNetwork.NotFound.Configuration.Bvn404HandlerConfigurationCT" />
<xs:complexType name="BVNetwork.NotFound.Configuration.Bvn404HandlerConfigurationCT">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element minOccurs="0" name="providers" type="tns:BVNetwork.NotFound.Configuration.Bvn404HandlerProvidersCT">
<xs:annotation>
<xs:documentation>The Bvn404HandlerProviders.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:choice>
<xs:attribute name="redirectsXmlFile" use="optional" type="xs:string">
<xs:annotation>
<xs:documentation>The RedirectsXmlFile.</xs:documentation>
Expand Down Expand Up @@ -47,19 +47,22 @@
<xs:documentation>The Logging.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ignoredResourceExtensions" use="optional" type="xs:string">
<xs:annotation>
<xs:documentation>The IgnoredResourceExtensions.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="BVNetwork.NotFound.Configuration.Bvn404HandlerProvidersCT">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element minOccurs="0" maxOccurs="unbounded" name="add" type="tns:BVNetwork.NotFound.Configuration.Bvn404HandlerProviderCT">
<xs:annotation>
<xs:documentation>The Bvn404HandlerProvider Configuration Element.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:choice>
</xs:complexType>
<xs:complexType name="BVNetwork.NotFound.Configuration.Bvn404HandlerProviderCT">
<xs:sequence>
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>The Name.</xs:documentation>
Expand Down
23 changes: 22 additions & 1 deletion src/Core/Configuration/Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using BVNetwork.NotFound.Configuration;

Expand Down Expand Up @@ -43,6 +44,8 @@ public class Configuration
private static bool _handlerMode_IsRead = false;
private static bool _fallbackToEPiServerError = false;
private static bool _fallbackToEPiServerError_IsRead = false;
private const string DEF_IGNORED_EXTENSIONS = "jpg,gif,png,css,js,ico,swf,woff";
private static List<string> _ignoredResourceExtensions;

public const int CURRENT_VERSION = 3;

Expand Down Expand Up @@ -73,6 +76,24 @@ public static bool FallbackToEPiServerErrorExceptionManager
}
}

/// <summary>
/// Resource extensions to be ignored.
/// </summary>
public static List<string> IgnoredResourceExtensions
{
get
{
if (_ignoredResourceExtensions == null)
{
_ignoredResourceExtensions = new List<string>( string.IsNullOrEmpty(Bvn404HandlerConfiguration.Instance.IgnoredResourceExtensions) ?
DEF_IGNORED_EXTENSIONS.Split(',') :
Bvn404HandlerConfiguration.Instance.IgnoredResourceExtensions.Split(','));
}

return _ignoredResourceExtensions;
}
}

/// <summary>
/// The mode to use for the 404 handler
/// </summary>
Expand Down Expand Up @@ -174,7 +195,7 @@ public static int BufferSize
if (Bvn404HandlerConfiguration.Instance != null && Bvn404HandlerConfiguration.Instance.BufferSize != -1)
{
return Bvn404HandlerConfiguration.Instance.BufferSize;
}
}

return DEF_BUFFER_SIZE;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Core/Custom404Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
namespace BVNetwork.NotFound.Core
{
public class Custom404Handler
{

private static readonly List<string> _ignoredResourceExtensions = new List<string> { "jpg", "gif", "png", "css", "js", "ico", "swf", "woff" };
{
private static readonly List<string> _ignoredResourceExtensions = Configuration.Configuration.IgnoredResourceExtensions;

private static readonly ILogger Logger = LogManager.GetLogger();

Expand Down