![]() |
# Class: Asp::Server [ "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/server.rb, line 183 def initialize( r, oAspError, aspHandler ) @oApacheRequest = r @oAspError = oAspError @oAspHandler = aspHandler @bEnd = 0 end

(Not Implemented)
[ show source ]
# File lib/asp/server.rb, line 155 def clearError( ) ## -> void end

(Not Implemented)
[ show source ]
# File lib/asp/server.rb, line 160 def createObject( xType ) ## -> object end

(Not Implemented)
[ show source ]
# File lib/asp/server.rb, line 165 def createObjectFromClsid( xClsid ) ## -> object end

Executes the current request using another page.
[ show source ]
# File lib/asp/server.rb, line 51 def execute( 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 ) eval( "@oAspHandler." + funcname + "( args )" ) end

Returns true if xFilename exist, false otherwise
[ show source ]
# File lib/asp/server.rb, line 32 def exist?( xFilename ) return File.exist?( xFilename.untaint ).untaint end

Returns the absolute file path to current executing script.
[ show source ]
# File lib/asp/server.rb, line 27 def file return @oApacheRequest.filename.dup end

Alias for exist?

Returns the last script error
[ show source ]
# File lib/asp/server.rb, line 131 def getLastError( ) return @oAspError end

Decodes a string that has been encoded to eliminate invalid HTML characters.
[ show source ]
# File lib/asp/server.rb, line 170 def htmlDecode( xData ) ## -> string return Common::html_unescape( xData ) end

Alias for html_encode

Alias for htmlDecode

Encodes a string to be displayed in a browser.
[ show source ]
# File lib/asp/server.rb, line 38 def html_encode( data ) return Common::html_escape( data ) end

Gets the server’s computer name. (To be implemented)
[ show source ]
# File lib/asp/server.rb, line 145 def machineName ## -> string end

Sends a mail
hMailOps is a hash with keys :
hSMTPOps is a hash with keys :
[ show source ]
# File lib/asp/server.rb, line 89 def mail( hMailOps, hSMTPOps=nil ) if hSMTPOps.nil? == true hSMTPOps = Hash::new hSMTPOps["server"] = ENV["MailHost"].untaint || "localhost" hSMTPOps["port"] = ENV["MailPort"].untaint || 25 end body = "From: " + String( hMailOps["From"] ) + "\n" + "To: " + String( hMailOps["To"] ) + "\n" + "Subject: " + ( String( hMailOps["Subject"] ) || "[No Subject]" ) + "\n\n" + ( String( hMailOps["Body"] ) || "" ) begin smtp = Net::SMTP::new( hSMTPOps["server"], hSMTPOps["port"] ) smtp.start( ) smtp.sendmail( body, hMailOps["From"], hMailOps["To"] ) smtp.finish end end

Returns the physical file path that corresponds to the specified virtual path on the Web server.
[ show source ]
# File lib/asp/server.rb, line 62 def mapPath( path ) global = @oApacheRequest.filename.dup local = @oApacheRequest.uri www = global.gsub( local, "" ) mmm = global.gsub( /[^\/]*$/, "" ) result = "" if /^\// =~ path result = www + path else result = File::expand_path( mmm + path ) end return result end

(Not Implemented)
[ show source ]
# File lib/asp/server.rb, line 150 def scriptTimeout ## -> int end

Transfers control to another script.
[ show source ]
# File lib/asp/server.rb, line 44 def transfer( filename, *args ) @bEnd = 1 self.execute( filename, args ) goto :e end

Will return a URL with hParams serialized into a query string
[ show source ]
# File lib/asp/server.rb, line 117 def url( uri, hParams=nil ) args = "" sep = "?" if hParams.nil? == false hParams.each_pair { |k,v| args += sep + self.url_encode( k ) + "=" + self.url_encode( v ) sep = "&" } end return( uri + args ) end

Decodes a string encoded for HTTP transmission and sent to the server in a URL.
[ show source ]
# File lib/asp/server.rb, line 177 def urlDecode( xUrl ) ## -> string return Common::url_decode( xUrl ) end

Alias for url_encode

Alias for url_encode

Encodes a string for reliable HTTP transmission from the Web server to a client via the URL.
[ show source ]
# File lib/asp/server.rb, line 110 def url_encode( data ) return Common::url_encode( data ) end

This method takes string for XSL and XML data and returns the XSLT output as a string
[ show source ]
# File lib/asp/server.rb, line 136 def xslt( xsl_data, xml_data ) xslt = XML::XSLT.new() xslt.xml = xml_data xslt.xsl = xsl_data return xslt.serve() end