/// <summary> /// Parses the condition. /// </summary> /// <param name="node">The node to parse.</param> /// <returns>The condition parsed, or null if nothing parsed.</returns> public IRewriteCondition Parse(XmlNode node) { if (node == null) { throw new ArgumentNullException("node"); } string method = node.GetOptionalAttribute(Constants.AttrMethod); if (method == null) { return null; } return new MethodCondition(method); }
/// <summary> /// Parses the condition. /// </summary> /// <param name="node">The node to parse.</param> /// <returns>The condition parsed, or null if nothing parsed.</returns> public IRewriteCondition Parse(XmlNode node) { if (node == null) { throw new ArgumentNullException("node"); } string exists = node.GetOptionalAttribute(Constants.AttrExists); if (exists == null) { return null; } return new ExistsCondition(exists); }
/// <summary> /// Parses the condition. /// </summary> /// <param name="node">The node to parse.</param> /// <returns>The condition parsed, or null if nothing parsed.</returns> public IRewriteCondition Parse(XmlNode node) { if (node == null) { throw new ArgumentNullException("node"); } string urlPattern = node.GetOptionalAttribute(Constants.AttrUrl); if (urlPattern == null) { return null; } return new UrlMatchCondition(urlPattern); }
/// <summary> /// Parses the condition. /// </summary> /// <param name="node">The node to parse.</param> /// <returns>The condition parsed, or null if nothing parsed.</returns> public IRewriteCondition Parse(XmlNode node) { if (node == null) { throw new ArgumentNullException("node"); } string header = node.GetOptionalAttribute(Constants.AttrHeader); if (header == null) { return null; } string match = node.GetRequiredAttribute(Constants.AttrMatch, true); return new PropertyMatchCondition(header, match); }
/// <summary> /// Parses the node. /// </summary> /// <param name="node">The node to parse.</param> /// <param name="config">The rewriter configuration.</param> /// <returns>The parsed action, or null if no action parsed.</returns> public override IRewriteAction Parse(XmlNode node, IRewriterConfiguration config) { if (node == null) { throw new ArgumentNullException("node"); } if (config == null) { throw new ArgumentNullException("config"); } string headerName = node.GetOptionalAttribute(Constants.AttrHeader); if (headerName == null) { return null; } string headerValue = node.GetRequiredAttribute(Constants.AttrValue, true); return new AddHeaderAction(headerName, headerValue); }
/// <summary> /// Parses the node. /// </summary> /// <param name="node">The node to parse.</param> /// <param name="config">The rewriter configuration.</param> /// <returns>The parsed action, or null if no action parsed.</returns> public override IRewriteAction Parse(XmlNode node, IRewriterConfiguration config) { if (node == null) { throw new ArgumentNullException("node"); } if (config == null) { throw new ArgumentNullException("config"); } string cookieName = node.GetOptionalAttribute(Constants.AttrCookie); if (String.IsNullOrEmpty(cookieName)) { return null; } string cookieValue = node.GetRequiredAttribute(Constants.AttrValue, true); return new SetCookieAction(cookieName, cookieValue); }
private RewriteProcessing ParseProcessing(XmlNode node) { string processing = node.GetOptionalAttribute(Constants.AttrProcessing); if (processing == null) { // Default to ContinueProcessing if processing attribute is missing. return RewriteProcessing.ContinueProcessing; } switch (processing) { case Constants.AttrValueRestart: return RewriteProcessing.RestartProcessing; case Constants.AttrValueStop: return RewriteProcessing.StopProcessing; case Constants.AttrValueContinue: return RewriteProcessing.ContinueProcessing; default: throw new ConfigurationErrorsException(MessageProvider.FormatString(Message.ValueOfProcessingAttribute, processing, Constants.AttrValueContinue, Constants.AttrValueRestart, Constants.AttrValueStop), node); } }