<?xml version="1.0" encoding="utf-8"?>
<KScriptSetting>
  <Name>response</Name>
  <Description>The http response object that is used to set  data into http resposne stream</Description>
  <Example><![CDATA[
    <script engine="kscript">
    var value="value";
	
    k.response.write(value);

    k.response.setHeader("server", "powerful kooboo server");

    k.response.redirect("http://www.kooboo.com");

    var obj = {name: "myname", fieldtwo:"second value"};

    k.response.Json(obj);

    </script>
	]]></Example>
  <Props />
  <Methods>
    <Method>
      <Name>write</Name>
      <Description>Print the input on output page. If it is not a value type object, it will print Json format of that object. </Description>
      <Example><![CDATA[
        <script engine="kscript">

        k.response.write("hello world");
        k.response.write(1234);
        var obj = {name:"myname"};
        k.response.write(obj);

        </script>
		]]></Example>
      <Params>
        <Param>
          <Name>value</Name>
          <Description>The object that will be printed</Description>
          <Type>object</Type>
        </Param>
      </Params>
    </Method>
    <Method>
      <Name>setHeader</Name>
      <Description>set header value on output html page.</Description>
      <Example><![CDATA[
        <script engine="kscript">
        k.response.setHeader("ServerTwo", "powerful kooboo server");
        k.response.setHeader("Access-Control-Allow-Origin", "*"); 
        </script>
		]]></Example>
      <Params>
        <Param>
          <Name>key</Name>
          <Description>Header key</Description>
          <Type>string</Type>
        </Param>
        <Param>
          <Name>value</Name>
          <Description>Header Value</Description>
          <Type>string</Type>
        </Param>
      </Params>
    </Method>
    <Method>
      <Name>redirect</Name>
      <Description>Redirect user to another url, url can be relative or absolute</Description>
      <Example><![CDATA[
        <script engine="kscript">

        // relative
        k.response.redirect("/relativepath");

        // absolute
        k.response.redirect("http://www.kooboo.com");

        </script>
		]]></Example>
      <Params>
        <Param>
          <Name>url</Name>
          <Description>The destination url</Description>
          <Type>string</Type>
        </Param>
      </Params>
    </Method>
    <Method>
      <Name>json</Name>
      <Description>
        Print the object in Json format, if the object is a value type like string, or number, it will print the string format of that value.
      </Description>
      <Example><![CDATA[
        <script engine="kscript">

        var obj = {fieldone:"valueone", fieldtwo:"valuetwo"};
        k.response.json(obj);

        </script>
		]]></Example>
      <Params>
        <Param>
          <Name>value</Name>
          <Description>Object to be printed</Description>
          <Type>object</Type>
        </Param>
      </Params>
    </Method>
  </Methods>
</KScriptSetting>