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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-->
<refentry id="fn_urlrewrite_create_regex_rule">
<refmeta>
<refentrytitle>URLREWRITE_CREATE_REGEX_RULE</refentrytitle>
<refmiscinfo>ws</refmiscinfo>
</refmeta>
<refnamediv>
<refname>URLREWRITE_CREATE_REGEX_RULE</refname>
<refpurpose>Creates regex rules.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_urlrewrite_create_regex_rule">
<funcprototype id="fproto_urlrewrite_create_regex_rule">
<funcdef><function>URLREWRITE_CREATE_REGEX_RULE</function></funcdef>
<paramdef>in <parameter>rule_iri</parameter> varchar</paramdef>
<paramdef>in <parameter>allow_update</parameter> integer</paramdef>
<paramdef>in <parameter>nice_match</parameter> varchar</paramdef>
<paramdef>in <parameter>nice_params</parameter> any</paramdef>
<paramdef>in <parameter>nice_min_params</parameter> integer</paramdef>
<paramdef>in <parameter>target_compose</parameter> varchar</paramdef>
<paramdef>in <parameter>target_params</parameter> any</paramdef>
<paramdef>in <parameter>target_expn</parameter> varchar</paramdef>
<paramdef>in <parameter>accept_pattern</parameter> varchar</paramdef>
<paramdef>in <parameter>do_not_continue</parameter> integer</paramdef>
<paramdef>in <parameter>http_redirect_code</parameter> integer</paramdef>
<paramdef>in <parameter>http_header_lines</parameter> varchar</paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_urlrewrite_create_regex_rule">
<title>Description</title>
<para>Creates regex rules.</para>
</refsect1>
<refsect1 id="params_urlrewrite_create_regex_rule">
<title>Parameters</title>
<refsect2><title><parameter>rule_iri</parameter></title>
<para>The rule's name / identifier</para>
</refsect2>
<refsect2><title><parameter>allow_update</parameter></title>
<para>Indicates whether the rule can be updated. 1 indicates yes; 0 indicates no. The update is subject to the following rules:</para>
<para>If the given rule_iri is already in use as a rule list identifier, an error is signaled.</para>
<para>If the given rule_iri is already in use as a rule identifier and allow_update for the existing rule is zero, an error is signalled.</para>
<para>If the given rule_iri is already in use as a rule identifier and allow_update for the existing rule is non-zero, the existing rule is updated.</para>
</refsect2>
<refsect2><title><parameter>nice_match</parameter></title>
<para>A regex match expression to parse the URL into a vector of occurrences.</para>
</refsect2>
<refsect2><title><parameter>nice_params</parameter></title>
<para>A vector of the names of the parsed parameters. The length of the vector should be equal to the number of '(...)' specifiers in the format string.</para>
</refsect2>
<refsect2><title><parameter>nice_min_params</parameter></title>
<para>Used to specify the minimum number of sprintf format patterns to be matched in order to trigger the given rule. In existing versions of Virtuoso it only affects sprintf rules and has no effect for regex rules.</para>
</refsect2>
<refsect2><title><parameter>target_compose</parameter></title>
<para>A regex compose expression for the URL of the destination page.</para>
</refsect2>
<refsect2><title><parameter>target_params</parameter></title>
<para>A vector of names of parameters that should be passed to the compose expression (target_compose) as $1, $2 and so on.</para>
<para>Special names can be used in addition to names from <parameter>nice_params</parameter>. That names start and end with asterisk.
Name '*accept*' is for required MIME type string, other names of the sort refer to values from HTTP request header lines.
Note that '*Accept*' will return the whole "Accept:" line whereas '*accept*' is for the part that matches <parameter>accept_pattern</parameter>.</para>
</refsect2>
<refsect2><title><parameter>target_expn</parameter></title>
<para>Optional SQL text that should be executed instead of a regex compose call.</para>
</refsect2>
<refsect2><title><parameter>accept_pattern</parameter></title>
<para>A regex expression to match the HTTP Accept header</para>
</refsect2>
<refsect2><title><parameter>do_not_continue</parameter></title>
<para>If the given rule satisfies the match conditions, 1 signifies do not try the next rule from same rule list, and 0 signifies try the next rule.</para>
</refsect2>
<refsect2><title><parameter>http_redirect_code</parameter></title>
<para>NULL or the integer values 301, 302, 303, or 406, are currently allowed. If a 3xx redirect code is given, an HTTP redirect response will be sent back to client. If NULL is specified, the server will process the redirect internally.</para>
</refsect2>
<refsect2><title><parameter>http_header_lines</parameter></title>
<para>Additional header lines to be added to the return value.</para>
</refsect2>
</refsect1>
<refsect1 id="ret_urlrewrite_create_regex_rule"><title>Return Types</title>
<para>The return value is not specified.</para>
</refsect1>
<!-- <refsect1 id="errors_urlrewrite_create_regex_rule">
<title>Errors</title>
<para>This function can generate the following errors:</para>
<errorcode></errorcode>
</refsect1>
-->
<refsect1 id="examples_urlrewrite_create_regex_rule">
<title>Examples</title>
<example id="ex_urlrewrite_create_regex_rule1"><title>Example 1</title>
<programlisting><![CDATA[
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'demo_nw_rule1',
1,
'(/[^#]*)',
vector('path'),
1,
'/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/Northwind%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
vector('path', 'path', '*accept*'),
null,
'(text/rdf.n3)|(application/rdf.xml)',
0,
null
);
]]></programlisting>
</example>
<example id="ex_urlrewrite_create_regex_rule2"><title>Example 2</title>
<programlisting><![CDATA[
DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
'demo_nw_rule2',
1,
'^/~(.*)',
vector('uname'),
1,
'/home/%s',
vector('uname'),
null,
null,
2,
null,
'MS-Author-Via: DAV'
);
]]></programlisting>
</example>
</refsect1>
</refentry>
|