<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Jaggery - Delicious Javascript</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le styles -->
    <link href="../css/bootstrap.css" rel="stylesheet">
    <style type="text/css">
        body {
            padding-top: 60px;
        }
    </style>
    <link href="../css/prettify.css" rel="stylesheet">
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../images/favicon.ico">
    <link rel="apple-touch-icon" href="../images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72"
          href="../images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114"
          href="../images/apple-touch-icon-114x114.png">
</head>

<body>

<%
include('/includes/topnavi.jag');
%>

<div class="container-fluid" style="width: 960px; margin: auto;">
    <div class="row">
        <div class="span16">
            <div class="page-header">
                <h1>
                    Documentation
                    <small>API documentation for Jaggery.js</small>
                </h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="span4">
            <div class="well">
                <%
                include('/includes/navi.jag');
                %>

            </div>

        </div>
        <div class="span12">
            <div class="content" id="email" name="email">
                <h3>request</h3>
        <pre class="prettyprint linenums">
&lt%
    print("&lthtml&gt&ltbody&gt");
    print("Method : " + request.getMethod() + "&ltbr/&gt");
    print("Protocol : " + request.getProtocol() + "&ltbr/&gt");
    print("User-Agent : " + request.getHeader("User-Agent"));
    print("&lt/body&gt&lt/html&gt");
%&gt
</pre>
                <%
                var reqCode = '&lt%'
                + '\n print("&lthtml&gt&ltbody&gt");'
                + '\n print("Method : " + request.getMethod() + "&lt;br/&gt");'
                + '\n print("Protocol : " + request.getProtocol() + "&lt;br/&gt");'
                + '\n print("User-Agent : " + request.getHeader("User-Agent"));'
                + '\n print("&lt/body&gt&lt/html&gt");'
                + '\n %&gt';

                var codeSnip = encodeURIComponent(reqCode);
                var urlString = '../tryitframe.jag?code='+codeSnip;

                include('/includes/tryit_but.jag');
                %>

 <% hasMembers = false; %>
<div id="pageLinks">
<a class="navilink" href="#overview">Overview</a>
    <%if(hasMembers) {%>
<a class="navilink" href="#members">Members</a>
        <%}%>
        <%if(hasOps) {%>
<a class="navilink" href="#operations">Operations</a>
            <%}%>
</div>
<section id="overview">

                   <h4>Overview</h4>
                   <p class="description">
                Object that provides the properties and functions of HTTP Request</p>
               </section>
                <section id="operations">

                    <h4>Operations</h4>
                <table class="clsStd operations-table">

                    <tbody>

                    <tr>

                        <th>Operation</th>
                        <th>Returns</th>
                        <th>Description</th>

                    </tr>
                      <tr>

                        <td><code>getMethod()</code></td>
                        <td>String</td>
                        <td>
                           <pre class="prettyprint">request.getMethod()</pre>
                            Returns the HTTP method of the request

                        </td>

                    </tr>
                     <tr>

                        <td><code>getProtocol()</code></td>
                        <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getProtocol()</pre>
                            Returns the protocol of the request
                        </td>

                    </tr>
                    <tr>

                        <td><code>getQueryString()</code></td>
                          <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getQueryString()</pre>
                            Returns the query String of the request
                        </td>

                    </tr>
                    <tr>

                        <td><code>getContent()</code></td>
                        <td>String | Object</td>
                        <td><pre class="prettyprint">request.getContent()</pre>
                            <p>Returns the content of the request.</p><p>If the request content type is either
                            <code>application/json</code> or <code>application/json/badgerfish</code>,
                            then content is returned as an object. Otherwise, it is
                            returned as a String.</p>
                        </td>

                    </tr>
                    <tr>

                        <td><code>getContentType()</code></td>
                        <td>String</td>
                        <td><pre class="prettyprint">request.getContentType()</pre>
                            Returns the content Type of the request

                        </td>

                    </tr>

                    <tr>

                        <td><code>getContentLength()</code>
                        </td>
                        <td>Number</td>
                        <td>
                            <pre class="prettyprint">request.getContentLength()</pre>
                            Returns the content length of the request
                        </td>

                    </tr>
                    <tr>

                        <td><code>getRequestURI()</code>
                        </td>
                        <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getRequestURI()</pre>
                            Returns the part of this request's URL from the protocol name up to the query String in the first line of the HTTP request
                        </td>

                    </tr>
                    <tr>

                        <td><code>getRequestURL()</code>
                        </td>
                        <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getRequestURL()</pre>
                            Reconstructs the URL the client used to make the request
                        </td>

                    </tr>


		     <tr>

                        <td><code>getPathTranslated()</code>
                        </td>
                           <td>Object</td>
                        <td>
                            <pre class="prettyprint">request.getPathTranslated()</pre>
                            Returns any extra path information before the query String, and translates it to a real path.
If the URL does not have any extra path information, this method returns null.<br/><br/>

                        </td>

                    </tr>

					<tr>

                        <td><code>isSecure()</code>
                        </td>
                        <td>Boolean</td>
                        <td>
                            <pre class="prettyprint">request.isSecure()</pre>
                            Returns a Boolean indicating whether this request was made using a secure channel, such as HTTPS.
                        </td>

                    </tr>
                    <tr>

                        <td><code>getRemoteAddr()</code>
                        </td>
                        <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getRemoteAddr()</pre>
                            Returns the Internet Protocol (IP) address of the client that sent the request.
                        </td>

                    </tr>
                    <tr>

                        <td><code>getContextPath()</code>
                        </td>
                        <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getContextPath()</pre>
                            Returns the portion of the request URI that indicates the context of the request
                        </td>

                    </tr>
                    <tr>

                        <td><code>getLocalPort()</code>
                        </td>
                        <td>Number</td>
                        <td>
                            <pre class="prettyprint">request.getLocalPort()</pre>
                            Returns the request local port number
                        </td>

                    </tr>

                    <tr>

                        <td><code>getHeader(headerName) </code>
                        </td>
                         <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getHeader("User-Agent")</pre>
                            Returns the Header properties
                            
                        </td>

                    </tr>
                    <tr>

                        <td><code>getAllHeaders() </code>
                        </td>
                         <td>Object</td>
                        <td>
                            <pre class="prettyprint">request.getAllHeaders()</pre>
                            Returns all request headers as an object.<br/><br/>
<pre class="prettyprint">{
    "Content-Type": "application/json",
    "User-Agent": "Mozilla/5.0",
    "Cookie": "JSESSIONID=4DA02FE19BA086964227"
}</pre>

                        </td>

                    </tr>

                    <tr>

                        <td><code>getParameter(paramname [,charset]) </code>
                        </td>
                           <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getParameter("action")</pre>
                            Returns the request parameter. For <code>multipart/form-data</code> requests, an optional
                            <code>charset</code> parameter can be passed to get the encoded value.
                            <br/>
                        </td>

                    </tr>

                    <tr>

                        <td><code>getAllParameters([charset]) </code>
                        </td>
                           <td>Object</td>
                        <td>
                            <pre class="prettyprint">request.getAllParameters("UTF-8")</pre>
                            Returns all request parameters as an object. For <code>multipart/form-data</code> requests,
                            an optional <code>charset</code> parameter can be passed to get the encoded values.
                            <br/>
                        </td>

                    </tr>

					<tr>

                        <td><code>getLocale() </code>
                        </td>
                           <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getLocale()</pre>
                            Returns the preferred Locale that the client will accept 
                            content in, based on the Accept-Language header. 
                            <br/>
                        </td>

                    </tr>
                    
                    <tr>

                        <td><code>getAllLocales() </code>
                        </td>
                           <td>Object</td>
                        <td>
                            <pre class="prettyprint">request.getAllLocales()</pre> Returns an Enumeration of Locale objects indicating, in decreasing order 
                            starting with the preferred locale,If the client request doesn't 
                            provide an Accept-Language header, this method returns an Enumeration 
                            containing one Locale, the default locale for the server.
                            <br/>
                        </td>

                    </tr>
                    <tr>

                        <td><code>getMappedPath() </code>
                        </td>
                           <td>Object</td>
                        <td>
                            <pre class="prettyprint">getMappedPath()</pre> 
                            If file is mapped and request came through mapping.<code>getMappedPathURL()</code> will return file. If file is not mapped It will return null.
                            <br/>
                        </td>

                    </tr>
                    <tr>

                        <td><code>getFile(formFeildName)</code>
                        </td>
                           <td>File</td>
                        <td>
                            <pre class="prettyprint">request.getFile("fieldName")</pre>
                            Returns a file object when the content type is <code>multipart/form-data</code>
                                                        <br/><br/>
<pre class="prettyprint">var file = request.getFile("userfile");
file.saveAs(file.getName());</pre>
                        </td>

                    </tr>

                    <tr>

                        <td><code>getAllFiles()</code>
                        </td>
                           <td>Object</td>
                        <td>
                            <pre class="prettyprint">request.getAllFiles()</pre>
                            Returns an object of files when the content type is <code>multipart/form-data</code>
                                                        <br/><br/>
<pre class="prettyprint">var files = request.getAllFiles();
for(var name in files) {
    if(files.hasOwnProperty(file)) {
        var file = files[name];
        file.saveAs(name);
    }
}</pre>
                        </td>

                    </tr>

                    <tr>

                        <td><code>getCookie(name)</code>
                        </td>
                           <td>String</td>
                        <td>
                            <pre class="prettyprint">request.getCookie(name)</pre>
                            Returns a cookie object.<br/><br/>
<pre class="prettyprint">{
    "name": "user",
    "value": "ruchira",
    "domain": "jaggeryjs.org",
    "maxAge": 100000,
    "secure": true,
    "path": "/",
    "comment": "Authenticated user"
}
</pre>
                        </td>

                    </tr>

                    <tr>

                        <td><code>getAllCookies()</code>
                        </td>
                           <td>Object</td>
                        <td>
                            <pre class="prettyprint">request.getAllCookies()</pre>
                            Returns an object with cookies.<br/><br/>
<pre class="prettyprint">{
    "user" : {
        "name": "user",
        .....
    },
    "remember" : {
        "name": "remember",
        .....
    }
}
</pre>
                        </td>

                    </tr>

		         

                    </tbody>
                </table>
                </section>
                    
            </div>
            <br>
            <br>
        </div>

    </div>
    <%
    include('/includes/footer.jag');
    %>

</div>

<!-- /container -->
<%
include('/includes/scripts.jag')
%>
	<script>	
		
		$(document).ready(function(){
        $('#req').toggleClass('active')
        $('#docs').addClass('active')
        })
	</script>
</body>
</html>
