Line: 45 to 45 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > | ObjectMethod _header (-type=>$type,-status => $status, -cookie => $cookie || \@cookies, -attachment => $attachName, -charset => $charset, -expires => $expires, -HeaderN => ValueN ) Private method to set response header like above that doesn't include fix for Item6602. Resonably compatible with CGI. Doesn't support -nph, -target and -p3p. | |||||||
ObjectMethod headers ({...}) -> $headersHashRefGets/Sets all response headers. Keys are headers name and values |
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > | Package ==On this page:
package TWiki::ResponseClass to encapsulate response data. Fields: *status - response status
* headers - hashref to response headers
* body - response body
* cookies - hashref to response cookies
ClassMethod new () -> $responseConstructs a TWiki::Response object.ObjectMethod status ($status) -> $statusGets/Sets response status.
ObjectMethod charset ([$charset]) -> $charsetGets/Sets response charset. If not defined, defaults to ISO-8859-1, just like CGI.pmObjectMethod header (-type=>$type,-status => $status, -cookie => $cookie || \@cookies, -attachment => $attachName, -charset => $charset, -expires => $expires, -HeaderN => ValueN ) Sets response header. Resonably compatible with CGI. Doesn't support -nph, -target and -p3p.ObjectMethod headers ({...}) -> $headersHashRefGets/Sets all response headers. Keys are headers name and values are scalars for single-valued headers or arrayref for multivalued ones.ObjectMethod getHeader ([$name]) -> $valueIf called without parameters returns all present header names, otherwise returns a list (maybe with a single element) of values associated with $name.ObjectMethod deleteHeader ($h1,$h2,...)Deletes headers whose names are passed.ObjectMethod pushHeader ($name,$value)Adds $value to list of values associated with header $name.ObjectMethod cookies ([\@cookies]) -> @cookiesGets/Sets response cookies. Parameter, if passed, must be an arrayref. Elements may be CGI::Cookie objects or raw cookie strings.ObjectMethod body ([$body]) -> $bodyGets/Sets response body.ObjectMethod redirect ($uri,$status,$cookies|-Location => $uri, -Status => $status, -Cookies => $cookies ) Populate object with redirect response headers.$uri must be passed. Others are optional.
CGI Compatibility Note: It doesn't support -target or -nph
ObjectMethod setDefaultHeaders ({$name=>$value,...})Sets the header, this does not modify the existing key=>value from $this->{headers}. Sets only new values. |