Namespace Response
Wrapper object for the HTTP response
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
Response.addCookie(options)
Add a cookie on the browser
|
<static> |
Response.addCSS(css)
Add raw CSS to the head of the document if the document contains a
<head> element. |
<static> |
Response.addHeadString(str)
Add an arbitrary string to the
<head> element
of a document if it contains one. |
<static> |
Response.addJavaScript(script)
Add a script tag to the head of the document if the document contains a
<head> element and script has not previously
been added using an addJavaScript call. |
<static> |
Response.addStyleSheet(stylesheet, media, conditional)
Add a stylesheet link tag to the head of the document if the document contains a
<head> element and stylesheet has not previously
been added using an addStyleSheet call. |
<static> |
Response.sendRedirect(url)
Deliver an HTTP 302 Moved Temporarily header to redirect the user to the specified URL.
|
<static> |
Response.setBaseHref(href)
Set the Base HREF for this page
|
<static> |
Response.setContentLength(length)
Sets the Content-Length header for the response to the client.
|
<static> |
Response.setContentType(type)
Sets the content type of the response being sent to the client.
|
<static> |
Response.setHeader(name, value)
Set an arbitrary HTTP response header attribute.
|
<static> |
Response.setTemplate(template)
Set the template within which the current page will be wrapped.
|
<static> |
Response.setTitle(title)
Set the HTML title element of the document.
|
Method Detail
<static>
Response.addCookie(options)
Add a cookie on the browser
<? var cookie=Response.addCookie({name:'cookieName',value:'myval',maxAge:'0',domain:'domain.com',path:'/'}); ?>
- Parameters:
- {name:'cookieName'|value:'myval'|maxAge:'0'|domain:'domain.com'|path:'/'|secure:true} options
- Cookie options. Options include name: Required name of the cookie value: Required value of the cookie maxAge: Sets the maximum age of the cookie in seconds. A positive value indicates that the cookie will expire after that many seconds have passed. Note that the value is the maximum age when the cookie will expire, not the cookie's current age. A negative value means that the cookie is not stored persistently and will be deleted when the Web browser exits. A zero value causes the cookie to be deleted. path: Specifies a path for the cookie to which the client should return the cookie. The cookie is visible to all the pages in the directory you specify, and all the pages in that directory's subdirectories. A cookie's path must include the servlet that set the cookie, for example, /catalog, which makes the cookie visible to all directories on the server under /catalog. Consult RFC 2109 (available on the Internet) for more information on setting path names for cookies. domain: Specifies the domain within which this cookie should be presented. The form of the domain name is specified by RFC 2109. A domain name begins with a dot (.foo.com) and means that the cookie is visible to servers in a specified Domain Name System (DNS) zone (for example, www.foo.com, but not a.b.foo.com). By default, cookies are only returned to the server that sent them. secure: Indicates to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS. The default value is false.
<static>
Response.addCSS(css)
Add raw CSS to the head of the document if the document contains a
<head>
element. The method will blindly enclose
css
in style tags without checking for validity.
If the template contains the comment <!-- TemplateHeader -->
, the
content will be placed there, otherwise it will be added immediately before the
closing head
tag.
- Parameters:
- {String} css
- The raw css to enclose in a
<style type="text/css">
tag.
- See:
- Response.addStyleSheet to add a link to a stylesheet.
- Response.addHeadString to add arbitrary information to the
<head>
of a document.
<static>
Response.addHeadString(str)
Add an arbitrary string to the
<head>
element
of a document if it contains one.
If the template contains the comment <!-- TemplateHeader -->
, the
content will be placed there, otherwise it will be added immediately before the
closing head
tag.
- Parameters:
- {String} str
- The string to append to the end of the
<head>
element's contents.
- See:
- Response.addStyleSheet To add a stylesheet to the document.
- Response.addJavaScript To add a javascript file to the document.
<static>
Response.addJavaScript(script)
Add a script tag to the head of the document if the document contains a
<head>
element and script
has not previously
been added using an addJavaScript
call. It will add it in the form
<script type="text/javascript" src="{script}" >
.
If the template contains the comment <!-- TemplateHeader -->
, the
content will be placed there, otherwise it will be added immediately before the
closing head
tag.
- Parameters:
- {String} script
- The
href
path to the javascript file.
- See:
- Response.addHeadString to add arbitrary information to the
<head>
of a document.
<static>
Response.addStyleSheet(stylesheet, media, conditional)
Add a stylesheet link tag to the head of the document if the document contains a
<head>
element and stylesheet
has not previously
been added using an addStyleSheet
call. It will add it in the form
<link rel="stylesheet" href="{stylesheet}" type="text/css" media="screen" />
If the template contains the comment <!-- TemplateHeader -->
, the
content will be placed there, otherwise it will be added immediately before the
closing head
tag.
Response.addStyleSheet("/salsa/include/jquery-ui-1.7.1/css-ui-lightness/jquery-ui-1.7.1.css"); Response.addStyleSheet("print.css", { media: "print" }); Response.addStyleSheet("mobile.css", {media: "handheld, only screen and (max-width: 767px)" }); Response.addStyleSheet("ie.css", { conditional: "lt IE 9" });
- Parameters:
- {String} stylesheet
- The
href
path to the stylesheet - {String} media Optional, Default: screen
- The media type to add to the stylesheet. Supports
- {String} conditional Optional
- Conditional Comments, for IE-specific stylesheets media queries.
- See:
- Response.addHeadString to add arbitrary information to the
<head>
of a document.
<static>
Response.sendRedirect(url)
Deliver an HTTP 302 Moved Temporarily header to redirect the user to the specified URL.
- Parameters:
- {String} url
- The location of the document the user will be directed to.
<static>
Response.setBaseHref(href)
Set the Base HREF for this page
- Parameters:
- {String} href
<static>
Response.setContentLength(length)
Sets the Content-Length header for the response to the client.
- Parameters:
- {Number} length
- The length of the content body as a decimal number of octets.
- See:
- Java Servlet API
<static>
Response.setContentType(type)
Sets the content type of the response being sent to the client. The content type may include the type of character encoding used, for example, text/html; charset=ISO-8859-4.
- Parameters:
- {String} type
- the MIME type of the content
- See:
- Java Servlet API
<static>
Response.setHeader(name, value)
Set an arbitrary HTTP response header attribute.
<? salsa.setHeader('Content-type', 'text/javascript'); ?>
- Parameters:
- {String} name
- The name of the attribute being set.
- {String} value
- The value of the attribute.
<static>
Response.setTemplate(template)
Set the template within which the current page will be wrapped.
- Parameters:
- {Number} template
- The template_KEY of the template within which to wrap the current page.
<static>
Response.setTitle(title)
Set the HTML title element of the document.
- Parameters:
- {String} title
- The title of the web site.