Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the smackjack Reference Manual, version 0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 17:49:15 2021 GMT+0.
• Introduction | What smackjack is all about | |
• Systems | The systems documentation | |
• Modules | The modules documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
This is the stub README.txt for the "smackjack" project. Smackjack is a small Ajax framework written in Common Lisp. Basically Smackjack allows browser code call lisp functions via ajax and get a return value. The code can be downloaded with all its dependencies and loaded by quicklisp (10/2013). Currently runs under Hunchentoot web server but there are plans to allow other web servers. It was a fork of ht-simple-ajax and aspires to be a replacement to the unmaintained and out of date ht-ajax. Differently than those two libraries, this one depends on parenscript to generate client-side javascript and allows greater flexibility in generated javascript. Current version is compatible with ht-simple-ajax but it lacks many features of ht-ajax. The following features are addition to those available in ht-simple-ajax: * AJAX via Post as well as Get * response can be text, xml or json. * optional javascript namespaces to encapsulate generated javascript functions. * The arguments of the functions can be treated by cl-json before calling the function. The code also contains a "pusher" subclass. This allows a lisp function call indirectly a javascript function defined in your lisp code by parenscript but runs in the browser. Basically the opposite of SmackJack. This is achieved by adding a simple polling mechanism. Future development may include long polling.
Next: Modules, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The smackjack system |
Andy Peterson <andy.arvid@gmail.com>
MIT
A small Ajax framework for hunchentoot using parenscript
0.1
smackjack.asd (file)
Modules are listed depth-first from the system components tree.
• The smackjack/impl-dependent module |
smackjack (system)
impl-dependent/
sbcl.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The smackjack.asd file | ||
• The smackjack/package.lisp file | ||
• The smackjack/smackjack.lisp file | ||
• The smackjack/pusher.lisp file | ||
• The smackjack/impl-dependent/sbcl.lisp file |
Next: The smackjack/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
smackjack.asd
smackjack (system)
Next: The smackjack/smackjack․lisp file, Previous: The smackjack․asd file, Up: Lisp files [Contents][Index]
Next: The smackjack/pusher․lisp file, Previous: The smackjack/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
smackjack (system)
smackjack.lisp
Next: The smackjack/impl-dependent/sbcl․lisp file, Previous: The smackjack/smackjack․lisp file, Up: Lisp files [Contents][Index]
smackjack.lisp (file)
smackjack (system)
pusher.lisp
Previous: The smackjack/pusher․lisp file, Up: Lisp files [Contents][Index]
impl-dependent (module)
impl-dependent/sbcl.lisp
arglist (function)
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The smackjack package |
the one and only smackjack package. Contains all code to run the ajax framework.
package.lisp (file)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported macros | ||
• Exported generic functions | ||
• Exported classes |
Next: Exported generic functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Macro to defun a server-side function that can be called from a client page.
Example: (defun-ajax func1 (arg1 arg2) (*ajax-processor*)
(do-stuff))
smackjack.lisp (file)
declares and defines a ’push’ function that when called in lisp causes the correponding javascript function to be called in the client page. the body should be parenscript code to be compiled into javascript
pusher.lisp (file)
Next: Exported classes, Previous: Exported macros, Up: Exported definitions [Contents][Index]
Symbol. Prefix for javascript functions corresponding
to lisp functions. Default is nil for no prefix.
smackjack.lisp (file)
Boolean. Place javascript functions corresponding
to lisp functions in the ajax-namespace. Default t.
smackjack.lisp (file)
Symbol or nil. Name for a namespace object for generated
javascript code. Nil means no namespace; code will be
global
smackjack.lisp (file)
Creates a hunchentoot dispatcher for an ajax processor.
One possible usage:
(push (create-ajax-dispatcher your-ajax-processor)
hunchentoot:*dispatch-table*)
smackjack.lisp (file)
String. The http content type that is sent with each response
smackjack.lisp (file)
Creates a string that contains all the client-side
javascript code for the ajax communication. Optionally include
<script> ... </script> html element wrapper. If including the wrapper,
include this script in the <head> </head> of each html page.
Without the wrapper, a virtual file can be done like:
(define-easy-handler (js-ajax-code :uri "/ajax-code.js") ()
(when (boundp ’hunchentoot:*request*)
(setf (content-type*) "text/javascript"))
(generate-prologue *ajax-processor* :wrapper nil))
smackjack.lisp (file)
Boolean. use ht-simple-ajax symbol processor to generate compatible ht-simple-ajax compatible code
smackjack.lisp (file)
Boolean. Ajax function arguments are passed using json
smackjack.lisp (file)
Name of the smackjack function called
on the client side when polling for pushes. Note: this name is a tag. The
function does not actually exist on the server.
pusher.lisp (file)
pusher.lisp (file)
pusher.lisp (file)
The number of milliseconds between polls of the server for push calls.
pusher.lisp (file)
javascript namespace (i.e. object) to hold the polling code and the defined push functions
pusher.lisp (file)
Maximum number of pushes per poll.
pusher.lisp (file)
String. The uri which is used to handle ajax request
smackjack.lisp (file)
Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
The principal and controlling class of this
library. The programmer will instantiate this class, define the ajax
functions of the class and link the dispatcher to hunchentoot’s
dispatcher. This processor will also generate javascript code that can
be loaded to the browser.
smackjack.lisp (file)
standard-object (class)
Hashtable maps the symbol names of the remoted functions to their ajax-function object
hash-table
(make-hash-table :test (function equal))
ajax-functions (generic function)
(setf ajax-functions) (generic function)
Symbol or nil. Name for a namespace object for generated
javascript code. Nil means no namespace; code will be
global
symbol
:ajax-namespace
(quote smackjack::smackjack)
ajax-namespace (generic function)
(setf ajax-namespace) (generic function)
Boolean. Place javascript functions corresponding
to lisp functions in the ajax-namespace. Default t.
boolean
:ajax-functions-namespace-p
t
ajax-functions-namespace-p (generic function)
(setf ajax-functions-namespace-p) (generic function)
Symbol. Prefix for javascript functions corresponding
to lisp functions. Default is nil for no prefix.
symbol
:ajax-function-prefix
ajax-function-prefix (generic function)
(setf ajax-function-prefix) (generic function)
Boolean. use ht-simple-ajax symbol processor to generate compatible ht-simple-ajax compatible code
boolean
:ht-simple-ajax-symbols-p
ht-simple-ajax-symbols-p (generic function)
(setf ht-simple-ajax-symbols-p) (generic function)
Boolean. Ajax function arguments are passed using json
boolean
:json-args-p
t
json-args-p (generic function)
(setf json-args-p) (generic function)
String. The uri which is used to handle ajax request
string
:server-uri
"/ajax"
server-uri (generic function)
(setf server-uri) (generic function)
String. The http content type that is sent with each response
string
:default-content-type
"text/xml; charset=\"utf-8\""
default-content-type (generic function)
(setf default-content-type) (generic function)
The format for the character output stream
flexi-streams::external-format
:reply-external-format
hunchentoot::+utf-8+
reply-external-format (generic function)
(setf reply-external-format) (generic function)
The class adds pushing capabilities to ajax-processor.
The server can push function calls to the client. That is the lisp server
code calls a function with arguments that will cause a corresponding
function call on the client side.
pusher.lisp (file)
ajax-processor (class)
javascript namespace (i.e. object) to hold the polling code and the defined push functions
symbol
:poll-namespace
(quote smackjack::smackpusher)
pusher-poll-namespace (generic function)
(setf pusher-poll-namespace) (generic function)
Name of the smackjack function called
on the client side when polling for pushes. Note: this name is a tag. The
function does not actually exist on the server.
symbol
:poll-function-name
(quote smackjack::push-poll-request)
pusher-poll-function-name (generic function)
(setf pusher-poll-function-name) (generic function)
pretty sure this is not used.
symbol
:session-queue-name
:smackpush-queue
pusher-session-queue-name (generic function)
(setf pusher-session-queue-name) (generic function)
The number of milliseconds between polls of the server for push calls.
(integer 1)
:poll-interval
5000
pusher-poll-interval (generic function)
(setf pusher-poll-interval) (generic function)
Maps the symbol names of the remoted functions to their ajax-function object
hash-table
(make-hash-table :test (function equal))
pusher-push-functions (generic function)
(setf pusher-push-functions) (generic function)
Maximum number of pushes per poll.
(integer 1)
:pushes-per-poll
1
pusher-pushes-per-poll (generic function)
(setf pusher-pushes-per-poll) (generic function)
A sub-class designed to be compatible with ht-simple-ajax
smackjack.lisp (file)
ajax-processor (class)
(quote smackjack::ajax)
t
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal functions | ||
• Internal generic functions | ||
• Internal classes |
Next: Internal generic functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
Escape all characters in STRING which pass TEST. This function is not guaranteed to return a fresh string. Note that you can pass NIL for STRING which’ll just be returned.
smackjack.lisp (file)
html script/cdata wrapper for javascript
wraps javascript in a <script> ... </script> html element
smackjack.lisp (file)
this functions generates converts lisps symbols to format used
by ht-simple-ajax and will be transformed by parenscript so that.
they are compatibile with ht-simple-ajax.
helper function for making ’foo_bar_ out of ’foo-bar?
smackjack.lisp (file)
this is the default processor of the polling from the client.
pusher.lisp (file)
returns parenscript (client) code to set up ajax request.
smackjack.lisp (file)
wrapper for xml ajax response
smackjack.lisp (file)
Next: Internal classes, Previous: Internal functions, Up: Internal definitions [Contents][Index]
returns a string for the remote function name before parenscript processing
smackjack.lisp (file)
Hashtable maps the symbol names of the remoted functions to their ajax-function object
smackjack.lisp (file)
returns parenscript code to define a function on the
client that will call the corresponding server-side lisp function via ajax.
smackjack.lisp (file)
returns a list of the arguments of the ajax-function ready for parenscript processing.
smackjack.lisp (file)
Overriding the default method for ajax-processor because that method
would fail on the pusher-poll-function. First checks if the
lisp function is the name given for the ajax-pusher’s poll processing
function. If so, returns nil to indicate no parameters. If not,
then call the ajax-processor method.
pusher.lisp (file)
returns the symbol of the parenscript function that will handle the ajax response of the ajax-function
smackjack.lisp (file)
This calls does the actual call of the ajax-lisp function.
Note: this is separate because it is overridden in the class ajax-pusher.
smackjack.lisp (file)
Overriding the default method for ajax-processor. First checks if the lisp function is the name given for the ajax-pusher’s poll processing function. If so, process push polls. If not, then call the ajax-processor method.
pusher.lisp (file)
argument passed to callback function from ajax response. Content-type should correspond.
smackjack.lisp (file)
generates a string of raw javascript code that needs to be
loaded on the client side for the ajax-processor to function correctly.
This code can be embedded in a file, a virtual file, or generated html.
smackjack.lisp (file)
returns javascript code for the entire pusher/ajax processor.
Calls the inherited method from ajax-processor and adds in code for the
pusher.
pusher.lisp (file)
return the content type string for ajax-function response.
smackjack.lisp (file)
http method of the lisp ajax function
smackjack.lisp (file)
symbol name of the lisp function
smackjack.lisp (file)
This should called on each ajax request. That is the
ajax uri is identified and dispatched by hunchentoot. See
CREATE-AJAX-DISPATCHER. It parses the parameters from the http request, calls
the lisp function and returns the response.
smackjack.lisp (file)
returns parenscript code to define a client-side function
for the ajax-processor that initiates an ajax call of a server-side lisp
function
smackjack.lisp (file)
returns client parenscript code to define functions to handle the various types of ajax responses
smackjack.lisp (file)
returns parenscript code to define a client-side function that encodes the arguments to be passed along with an ajax/http request.
smackjack.lisp (file)
Return parenscript code to define client-side fetch-uri
which initiates ajax request and sets up callback/error treatment.
smackjack.lisp (file)
returns parenscript code to define all the push-functions on the client
pusher.lisp (file)
If a push function is called and the hunchentoot
sessions are not specified, this will determine which in sessions the push call
happens on the client side.
pusher.lisp (file)
This function is called when you want to push a function
call to the client(s) as specified in the parameter sessions. Note: the
programmer should not call this directly.
pusher.lisp (file)
Returns a list of Hunchentoot sessions for a push-function based on the slot default-sessions
pusher.lisp (file)
parenscript code to be compiled and sent to the browser on page load
pusher.lisp (file)
returns parenscript code for the push-function to be defined on the client
pusher.lisp (file)
Maps the symbol names of the remoted functions to their ajax-function object
pusher.lisp (file)
pretty sure this is not used.
pusher.lisp (file)
Function to create a push-function and store it in the pusher object.
pusher.lisp (file)
remote name of the function
smackjack.lisp (file)
Creates a remote ajax-function identified by its symbol and symbol-name and attaches it to the ajax-processor
smackjack.lisp (file)
remove a remote function identified by its symbol or name from the ajax-processor
smackjack.lisp (file)
Previous: Internal generic functions, Up: Internal definitions [Contents][Index]
Class for browser functions that call a server-side lisp function using ajax
smackjack.lisp (file)
remote-function (class)
http method of the lisp ajax function
(quote (member :post :get))
:method
:get
http-method (generic function)
(setf http-method) (generic function)
argument passed to callback function from ajax response. Content-type should correspond.
(quote (member :request-object :response-xml :response-text :response-xml-text :json))
:callback-data
:response-xml
callback-data (generic function)
(setf callback-data) (generic function)
The http content type that is sent with each response
(or null string)
:content-type
"text/xml;"
content-type (generic function)
(setf content-type) (generic function)
This class represents functions that are pushed to the client.
pusher.lisp (file)
remote-function (class)
parenscript code to be compiled and sent to the browser on page load
list
:ps-code
push-ps-code (generic function)
(setf push-ps-code) (generic function)
If a push function is called and the hunchentoot
sessions are not specified, this will determine which in sessions the push call
happens on the client side.
(quote (member :current-session :acceptor-sessions :acceptor-sessions-except-current))
:default-sessions
:acceptor-sessions
push-default-sessions (generic function)
(setf push-default-sessions) (generic function)
Base class for remote functions between server and browser
smackjack.lisp (file)
standard-object (class)
symbol name of the lisp function
symbol
:name
name (generic function)
remote name of the function
symbol
:remote-name
remote-name (generic function)
(setf remote-name) (generic function)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L M S |
---|
Jump to: | F L M S |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
A C D E F G H J M N P R S U X |
---|
Jump to: | (
A C D E F G H J M N P R S U X |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | A C D H J M N P R S |
---|
Jump to: | A C D H J M N P R S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | A C H P R S |
---|
Jump to: | A C H P R S |
---|