<docbook><section><title>VirtTipsAndTricksHTTPInternalRedirect</title><para> </para>
<title>Performing Internal HTTP redirects</title>Performing Internal HTTP redirects
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">What?</bridgehead>
<para>Virtuoso as opposed to HTTP based redirection.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Why?</bridgehead>
<para>Handling situations where HTTP level redirection is inadequate.
 For example, 303 redirection offered when implementing hashless Linked Data URIs.
 Instead of sending a 303 Virtuoso will redirect to the URL in &quot;Location:&quot;  and return 200 OK.</para>
<para>Basically, this is like curl -iL instead of curl -i, but implemented inside Virtuoso.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">How?</bridgehead>
<para>Directly or via URI template syntax used to construct rewrite rules for Virtuoso virtual directories / web service endpoints for the purposes of which Virtuoso offers the <ulink url="http://http://docs.openlinksw.com/virtuoso/fn_http_internal_redirect.html">http_internal_redirect function</ulink>:</para>
<programlisting>http_internal_redirect 
  ( 
    in full_path varchar,            -- Set new logical path to be redirected to 
    [ in p_full_path varchar ] ,     -- Set physical path to be redirected to 
    [ in long_url varchar ],         -- Reserved for internal usage 
    [ in keep_lpath integer ]        -- Reserved for internal usage 
  )  
</programlisting><bridgehead class="http://www.w3.org/1999/xhtml:h3">Example</bridgehead>
<programlisting>create procedure my_redirect()
{
  declare full_path varchar;
      ...
      full_path := &#39;/DAV/VAD/test/&#39;;
      http_internal_redirect (full_path);
      set_user_id (&#39;demo&#39;);
      set http_charset=&#39;utf-8&#39;;
      http_header (&#39;Content-Type: text/xml; charset=UTF-8\r\n&#39;);
      WS.WS.GET (path, pars, lines);
      return null;
    }
}
</programlisting><bridgehead class="http://www.w3.org/1999/xhtml:h2">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtTipsAndTricksGuide">Virtuoso Tips and Tricks Collection</ulink> </listitem>
<listitem><ulink url="http://docs.openlinksw.com/virtuoso/functions.html">Virtuoso Documentation</ulink> </listitem>
</itemizedlist></section></docbook>