<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cutter-Convenience-HTTP-server-API">
<refmeta>
<refentrytitle role="top_of_page" id="cutter-Convenience-HTTP-server-API.top_of_page">Convenience HTTP server API</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  CUTTER Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Convenience HTTP server API</refname>
<refpurpose>API to work as HTTP server.</refpurpose>
</refnamediv>

<refsynopsisdiv id="cutter-Convenience-HTTP-server-API.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>const <link linkend="gchar"><returnvalue>gchar</returnvalue></link> *       <link linkend="soupcut-server-build-uri">soupcut_server_build_uri</link>            (<parameter><link linkend="SoupServer"><type>SoupServer</type></link> *server</parameter>,
                                                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *path</parameter>);
<link linkend="SoupServer"><returnvalue>SoupServer</returnvalue></link> *        <link linkend="soupcut-server-take">soupcut_server_take</link>                 (<parameter><link linkend="SoupServer"><type>SoupServer</type></link> *server</parameter>);
<link linkend="SoupServer"><returnvalue>SoupServer</returnvalue></link> *        <link linkend="soupcut-server-take-new">soupcut_server_take_new</link>             (<parameter><link linkend="GMainContext"><type>GMainContext</type></link> *context</parameter>);
</synopsis>
</refsynopsisdiv>

<refsect1 id="cutter-Convenience-HTTP-server-API.description" role="desc">
<title role="desc.title">Description</title>
<para>
Useful wrappers for <link linkend="SoupServer"><type>SoupServer</type></link> are provided.
</para>
</refsect1>
<refsect1 id="cutter-Convenience-HTTP-server-API.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="soupcut-server-build-uri" role="function" condition="since:1.0.8">
<title>soupcut_server_build_uri ()</title>
<indexterm zone="soupcut-server-build-uri" role="1.0.8"><primary>soupcut_server_build_uri</primary></indexterm>
<programlisting>const <link linkend="gchar"><returnvalue>gchar</returnvalue></link> *       soupcut_server_build_uri            (<parameter><link linkend="SoupServer"><type>SoupServer</type></link> *server</parameter>,
                                                         <parameter>const <link linkend="gchar"><type>gchar</type></link> *path</parameter>);</programlisting>
<para>
an URI is built and returned with the base uri of <parameter>server</parameter> and <parameter>path</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>server</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="SoupServer"><type>SoupServer</type></link>.</simpara></listitem></varlistentry>
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara>a path.</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>a new uri string owned by Cutter. Don't free it.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0.8</para></refsect2>
<refsect2 id="soupcut-server-take" role="function" condition="since:1.0.8">
<title>soupcut_server_take ()</title>
<indexterm zone="soupcut-server-take" role="1.0.8"><primary>soupcut_server_take</primary></indexterm>
<programlisting><link linkend="SoupServer"><returnvalue>SoupServer</returnvalue></link> *        soupcut_server_take                 (<parameter><link linkend="SoupServer"><type>SoupServer</type></link> *server</parameter>);</programlisting>
<para>
<parameter>server</parameter> is shut down and unref when tear down.
</para><variablelist role="params">
<varlistentry><term><parameter>server</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="SoupServer"><type>SoupServer</type></link>.</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara><parameter>server</parameter> owned by Cutter. Don't <link linkend="g-object-unref"><function>g_object_unref()</function></link> it.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0.8</para></refsect2>
<refsect2 id="soupcut-server-take-new" role="function" condition="since:1.0.8">
<title>soupcut_server_take_new ()</title>
<indexterm zone="soupcut-server-take-new" role="1.0.8"><primary>soupcut_server_take_new</primary></indexterm>
<programlisting><link linkend="SoupServer"><returnvalue>SoupServer</returnvalue></link> *        soupcut_server_take_new             (<parameter><link linkend="GMainContext"><type>GMainContext</type></link> *context</parameter>);</programlisting>
<para>
Creates and returns a new <link linkend="SoupServer"><type>SoupServer</type></link>, whose context is <parameter>context</parameter>.
The server is shut down and unref when tear down.
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GMainContext"><type>GMainContext</type></link> for the main loop of a new server.</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>a new <link linkend="SoupServer"><type>SoupServer</type></link> owned by Cutter. Don't <link linkend="g-object-unref"><function>g_object_unref()</function></link> it.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0.8</para></refsect2>

</refsect1>
<refsect1 id="cutter-Convenience-HTTP-server-API.see-also">
<title>See Also</title>
<link
           linkend="cutter-Assertions-for-HTTP-client-and-server">
           Assertions for HTTP client and server</link>
</refsect1>

</refentry>
