![]() |
# Class: Asp::Response [ "README", "lib/asp/server.rb", "lib/asp/application.rb", "lib/asp/request.rb", "lib/asp/response.rb", "lib/asp/session.rb", nil].each do Asp.view_html Asp::Session.view_html Asp::Response.view_html Asp::Application.view_html Asp::Server.view_html Asp::Request.view_html Asp::Eval.view_html end |
Copyright (C) 2003, 2004 Gregoire Lejeune <gregoire.lejeune@free.fr>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

[ show source ]
# File lib/asp/response.rb, line 362 def initialize( r, oAspError, aspHandler ) @oApacheRequest = r @oAspError = oAspError @oAspHandler = aspHandler @charset = "iso-8859-1" @contentType = "text/html" @expires = nil @expiresAbsolute = nil @bEnd = 0 @hxHeader = Hash::new @hvCookies = Hash::new end

Makes the validity of a cached item dependent on other items in the cache. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 217 def addCacheItemDependencies( lCacheKeys ) ## -> void end

Makes the validity of a cached item dependent on another item in the cache. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 223 def addCacheItemDependency( xCacheKey ) ## -> void end

[ show source ]
# File lib/asp/response.rb, line 302 def addCookiesHeader cookie_header = Array::new @hvCookies.each_key { |name| value = Array::new #if name == "session-id" if name == Asp::Common::sessionID self.appendToLog( format( "You can't use %s for a cookie name since it is reserved for session management", Asp::Common::sessionID ) ) else cookie = @hvCookies[name] cookie['Path'] ||= "/" cookie.each_pair { |k,v| case k.downcase when "expires" value[1] = "expires=#{v}" when "path" value[2] = "path=#{v}" when "domain" value[3] = "domain=#{v}" when "secure" value[4] = "secure" when "value" # we set the value later, nothing for now else if String( @hvCookies[name]['Value'].class ) != "String" if @hvCookies[name]['Value'].nil? == true @hvCookies[name]['Value'] = Hash::new end @hvCookies[name]['Value'][k] = v end end } if String( @hvCookies[name]['Value'].class ) == "Hash" dict = Array::new @hvCookies[name]['Value'].each_pair { |k,v| dict.push( format( "%s=%s", Asp::Common::url_encode( k ), Asp::Common::url_encode( v ) ) ) } value[0] = dict.join( "&" ) else value[0] = Asp::Common::url_encode( @hvCookies[name]['Value'] ) end value[0] = Asp::Common::url_encode( name )+"="+value[0] cookie = Array::new [0,1,2,3,4].each { |iCpt| next unless value[iCpt].nil? == false cookie.push( value[iCpt] ) } cookie_header.push( cookie.join( "; " ) ) end } return( cookie_header ) end

Adds a group of file names to the collection of file names on which the current response is dependent. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 229 def addFileDependencies( lFilenames ) ## -> void end

Adds a single file name to the collection of file names on which the current response is dependent. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 235 def addFileDependency( xFilename ) ## -> void end

Adds a new HTTP header and a value to the HTTP response
[ show source ]
# File lib/asp/response.rb, line 38 def addHeader( name, value ) @hxHeader.store( name, value ) end

(Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 240 def appendCookie( cookie ) ## -> void end

Alias for addHeader

Adds a string to the end of the server log entry
[ show source ]
# File lib/asp/response.rb, line 44 def appendToLog( message ) @oApacheRequest.server.log_error( "[Ruby/ASP] [%d] %s", $$, message ) end

Adds a session ID to the virtual path if the session is using cookieless session state and returns the combined path. If cookieless session state is not used, ApplyAppPathModifier returns the original virtual path. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 246 def applyAppPathModifier( xVirtualPath ) ## -> string end

Writes data directly to the output without any character conversion
[ show source ]
# File lib/asp/response.rb, line 27 def binaryWrite( data ) $stdout.binmode print data end

Specifies whether to buffer the page output or not (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 125 def buffer ## -> bool end

Gets or sets a value indicating whether to buffer output and send it after the entire page is finished processing. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 131 def bufferOutput ## -> bool end

Gets the caching policy (expiration time, privacy, vary clauses) of a Web page.
[ show source ]
# File lib/asp/response.rb, line 136 def cache ## -> System.Web.HttpCachePolicy return @oApacheRequest.cache_resp end

Sets whether a proxy server can cache the output generated by ASP or not (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 143 def cacheControl ## -> string end

Clears any buffered HTML output (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 252 def clear( ) ## -> void end

Alias for clear

Clears all headers from the buffer stream. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 260 def clearHeaders( ) ## -> void end

Closes the socket connection to a client. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 266 def close( ) ## -> void end

Gets the HTTP character set of the output stream.
[ show source ]
# File lib/asp/response.rb, line 148 def contentEncoding ## -> System.Text.Encoding return @oApacheRequest.content_encoding end

[ show source ]
# File lib/asp/response.rb, line 153 def contentEncoding=( str ) @oApacheRequest.content_encoding=str end

Sets a cookie value. If the cookie does not exist, it will be created, and take the value that is specified
$Response.cookies('name', 'value');
--> Set-Cookie: name=value; path=/
$Response.cookies("Test", "data1", "test value");
$Response.cookies("Test", "data2", "more test");
$Response.cookies("Test", "Expires", &HTTP::Date::time2str(time+86400));
$Response.cookies("Test", "Secure", 1);
$Response.cookies("Test", "Path", "/");
$Response.cookies("Test", "Domain", "host.com");
--> Set-Cookie:Test=data1=test%20value&data2=more%20test; # expires=Fri, 23 Apr 1999 07:19:52 GMT; # path=/; domain=host.com; secure
[ show source ]
# File lib/asp/response.rb, line 109 def cookies( name, key, value=nil ) if @hvCookies[name].nil? == true @hvCookies[name] = Hash::new end if value.nil? == false @hvCookies[name][key] = String( value ) else # we are assigning cookie with name the value of key @hvCookies[name]['Value'] = String( key ) end end

Stops processing a script, and returns the current result
[ show source ]
# File lib/asp/response.rb, line 49 def end @bEnd = 1 goto :e end

Gets or sets a wrapping filter object used to modify the HTTP entity body before transmission. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 159 def filter ## -> stream end

Sends buffered HTML output immediately (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 272 def flush( ) ## -> void end

— Reserved for Ruby/ASP internal use —
[ show source ]
# File lib/asp/response.rb, line 289 def getHeader xTime = nil if @expires != nil xTime = Asp::Common::time2str( Time::now + @expires ) elsif @expiresAbsolute != nil xTime = Asp::Common::str2time( @expiresAbsolute ) end if xTime != nil @hxHeader.store( "Expires", xTime ) end return @hxHeader end

This API extension calls the routine compiled from asp script in filename with the args *args.
[ show source ]
# File lib/asp/response.rb, line 55 def include( filename, *args ) funcname = "i__"+rand( Time::new.to_i ).to_s+"__"+rand( Time::new.to_i ).to_s code = @oAspHandler.compile(filename) ##code = compile(filename) totalcode = "def " + funcname + "( args=nil )\n" + code + "\nend\n" @oAspHandler.load_code( totalcode, nil ) if args.length == 0 xEvalData = "@oAspHandler." + funcname + "( nil )" eval( xEvalData.untaint ).untaint else xEvalData = "@oAspHandler." + funcname + "( args )" eval( xEvalData.untaint ).untaint end end

Gets a value indicating whether the client is still connected to the server.
[ show source ]
# File lib/asp/response.rb, line 164 def isClientConnected ## -> bool return !@oApacheRequest.connection.aborted? end

Enables output of text to the outgoing HTTP response stream. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 171 def output ## -> System.IO.TextWriter end

Enables binary output to the outgoing HTTP content body. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 177 def outputStream ## -> stream end

Appends a value to the PICS label response header (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 278 def pics( xValue ) ## -> void end

Redirects the user to a different URL
[ show source ]
# File lib/asp/response.rb, line 90 def redirect( url ) self.addHeader( "location", url ) @oApacheRequest.status = 302 end

Alias for redirect

Static method removes from the cache all cached items associated with the specified path. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 284 def removeOutputCacheItem( xPath ) ## -> void end

Alias for cookies

Specifies the value of the status line returned by the server
[ show source ]
# File lib/asp/response.rb, line 182 def status( ) ## -> string return @oApacheRequest.status_line end

Gets the HTTP status code of the output returned to the client.
[ show source ]
# File lib/asp/response.rb, line 188 def statusCode( ) ## -> int return @oApacheRequest.status end

Sets the HTTP status code of the output returned to the client.
[ show source ]
# File lib/asp/response.rb, line 194 def statusCode=( str ) @oApacheRequest.status = str end

Gets the HTTP status string of the output returned to the client.
[ show source ]
# File lib/asp/response.rb, line 199 def statusDescription ## -> string return @oApacheRequest.status_line end

Sets the HTTP status string of the output returned to the client.
[ show source ]
# File lib/asp/response.rb, line 205 def statusDescription=( str ) @oApacheRequest.status_line = str end

Gets or sets a value indicating whether to send HTTP content to the client. (Not Implemented)
[ show source ]
# File lib/asp/response.rb, line 211 def suppressContent ## -> bool end

Calls $Response.include() with same arguments as passed to it, but instead traps the include output buffer and returns it.
[ show source ]
# File lib/asp/response.rb, line 74 def trapInclude( filename, *args ) funcname = "i__"+rand( Time::new.to_i ).to_s+"__"+rand( Time::new.to_i ).to_s code = @oAspHandler.compile(filename) ##code = compile(filename) totalcode = "def " + funcname + "( args=nil )\n" + code + "\nend\n" if args.length == 0 o = Asp::Eval::new( totalcode, funcname, nil ) else o = Asp::Eval::new( totalcode, funcname, args ) end return o.get end

Writes a specified string to the output
[ show source ]
# File lib/asp/response.rb, line 33 def write( data ) print data end

Alias for include