Classic ASP Framework
org.classicasp.server.ResourceEx

---CURRENTLY IN TEST MODE---

The ResourceEx class is a mechanism to create RESTful web services in Classic ASP. The class wraps inputs, variables, user authentication, user authorization, session management, logging, and data serialization into an easy to use library. This class requires a MySQL database with the following tables : tbl_system_log, tbl_system_log_dbex, tbl_system_session, tbl_system_user, tbl_system_variable. The SQL for these tables can be found in the "/lib/asp/org/classicasp/sql/" directory.

Example 1

	
  Call ResourceEx.Execute(new clsResource, "Administrator")
  

Example 2

	
  Call ResourceEx.Authenticate()
  Call ResourceEx.Authorize("Administrator")
  Call ResourceEx.Return(myData)
  

Summary

Enforces and authenticates the current connection.
Enforces and authorizes the current connection.
Deletes a variable in the database.
Executes a RESTful resource using corresponding http method, runs Authenticate , Authorize , and RateLimit .
Gets the geo-location information based on the users ip address.
Gets all inputs.
Gets all form inputs.
Gets all querystring inputs.
Gets all rest inputs.
Gets all ServerVariable inputs.
Gets the session record.
Gets the user record.
Gets the value of a variable in the database.
Gets all variables in the database.
Gets all variables like 'name*' in the database.
Checks if a variable exists in the database.
Sends a message to all users of a particular role.
Sends a message to a user.
Enforces and rate limits the current connection.
Serializes data and writes it to the client in requested format, supports : XML, JSON, BENCODE, CSV, and TEXT.
Sets the value of a variable in the database.
Allows the code to sleep or wait for a specified number of seconds.
See if the connection has authenticated.
See if the connection has authorized.
Gets the current command that is being executed.
Returns the configuration.
Returns the configuration.
Returns the first database connection in the config.
Returns DebugText.
Returns all input parameters including : RESTful, Form, and Querystring.
Returns all input Form parameters.
Returns all input Querystring parameters.
Returns all RESTful input parameters.
Returns all input Server Variable parameters.
Gets the geo-location record.
Gets the session record.
Gets the user record for the session.
Returns a variable stored in the database.
Stores DebugText.
Stores a variable in the database.

Authenticate

Public Sub Authenticate()
Enforces and authenticates the current connection.

Returns

N/A

Authorize

Public Sub Authorize(ByRef sAuthorizationRoles)
Enforces and authorizes the current connection.

Returns

N/A

deleteVariable

Public Sub deleteVariable(ByRef sInputName)
Deletes a variable in the database.

Returns

N/A

Execute

Public Sub Execute(
ByRef vInputClass,
ByRef sAuthorizationRoles)
Executes a RESTful resource using corresponding http method, runs Authenticate, Authorize, and RateLimit.

Returns

N/A

getGeoLocation

Public Function getGeoLocation()
Gets the geo-location information based on the users ip address.

Returns

Variant

getInputs

Public Function getInputs()
Gets all inputs.

Returns

Variant

getInputsForm

Public Function getInputsForm()
Gets all form inputs.

Returns

Variant

getInputsQueryString

Public Function getInputsQueryString()
Gets all querystring inputs.

Returns

Variant

getInputsRest

Public Function getInputsRest()
Gets all rest inputs.

Returns

Variant

getInputsServerVariable

Public Function getInputsServerVariable()
Gets all ServerVariable inputs.

Returns

Variant

getSessionRecord

Public Function getSessionRecord()
Gets the session record.

Returns

Variant

getUserRecord

Public Function getUserRecord()
Gets the user record.

Returns

Variant

getVariable

Public Function getVariable(ByRef sInputName)
Gets the value of a variable in the database.

Returns

Variant

getVariables

Public Function getVariables()
Gets all variables in the database.

Returns

ObjectEx

getVariablesLike

Public Function getVariablesLike(ByVal sLike)
Gets all variables like 'name*' in the database.

Returns

ObjectEx

hasVariable

Public Function hasVariable(ByRef sInputName)
Checks if a variable exists in the database.

Returns

BooleanEx

MessageRole

Public Sub MessageRole(
ByRef sRole,
ByRef sFunction,
ByRef oData)
Sends a message to all users of a particular role.

Returns

N/A

MessageUser

Public Sub MessageUser(
ByRef nUserId,
ByRef sFunction,
ByRef oData)
Sends a message to a user.

Returns

N/A

RateLimit

Public Sub RateLimit()
Enforces and rate limits the current connection.

Returns

N/A

Return

Public Sub Return(ByRef vInputData)
Serializes data and writes it to the client in requested format, supports : XML, JSON, BENCODE, CSV, and TEXT.

Returns

N/A

setVariable

Public Sub setVariable(
ByRef sInputName,
ByVal sInputValue)
Sets the value of a variable in the database.

Returns

N/A

Sleep

Public Sub Sleep(ByRef nSeconds)
Allows the code to sleep or wait for a specified number of seconds.

Returns

N/A

[GET] Authenticated

See if the connection has authenticated.

Returns

BooleanEx

[GET] Authorized

See if the connection has authorized.

Returns

BooleanEx

[GET] Command

Gets the current command that is being executed.

Returns

StringEx

[GET] Config

Returns the configuration. (/rest-service.config)

Returns

ObjectEx

[GET] ConfigXpath

Returns the configuration. (/rest-service.config)

Returns

Variant

[GET] Db

Returns the first database connection in the config.

Returns

DatabaseEx

[GET] DebugText

Returns DebugText.

StringEx

[GET] Input

Returns all input parameters including : RESTful, Form, and Querystring.

ObjectEx

[GET] InputForm

Returns all input Form parameters.

ObjectEx

[GET] InputQueryString

Returns all input Querystring parameters.

ObjectEx

[GET] InputRest

Returns all RESTful input parameters. RESTful parameters are defined in the url, see example below :

  • https://www.example.com/rest/products.json
  • https://www.example.com/rest/products/{products}.json
  • https://www.example.com/rest/products/{products}/images.json
  • https://www.example.com/rest/products/{products}/images/{images}.json
ObjectEx

[GET] InputServerVariable

Returns all input Server Variable parameters.

ObjectEx

[GET] SessionGeoLocation

Gets the geo-location record. {"session"}

ObjectEx

[GET] SessionRecord

Gets the session record. {"session"}

ObjectEx

[GET] UserRecord

Gets the user record for the session. {"id", "username", "email", "role"}

ObjectEx

[GET] Variable

Returns a variable stored in the database.

Variant

[LET] DebugText

Stores DebugText.

[LET] Variable

Stores a variable in the database.

'***ClassicASP.org
'Copyright 2010 ClassicASP.org

'This file is part of ClassicASP Framework.

'ClassicASP-Framework 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, version 3 of the License.

'ClassicASP-Framework 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 ClassicASP-Framework. If not, see .

'For additional information please visit .

Created with TwinText