eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTTPPluggableActionService':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: HTTPPluggableActionService


Inheritance:

   Object
   |
   +--HTTPService
      |
      +--HTTPPluggableActionService

Package:
stx:goodies/webServer
Category:
Net-Communication-HTTP-Services
Version:
rev: 1.13 date: 2023/07/03 08:23:26
user: cg
file: HTTPPluggableActionService.st directory: goodies/webServer
module: stx stc-classLibrary: webServer

Description:


A service which associates page-URLS with a block's evaluation.
Can be used for quick ad-hoc and Expecco-driven webservices,
and also to provide the glue to Pharo services (see JRPCServer).
The registered block (-> register:as:) is evaluated with the httpRequest object
as argument.

Blocks are registered to react on absolute URL-paths,
and all request-URLs below a particular action link are handled by this block.

For example, if a block is registered as '/foo/bar',
then also '/foo/bar/baz', '/foo/bar/bla' and '/foo/bar/baz/bla/bla' are handled by
that block.

copyright

COPYRIGHT (c) 2008 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Instance protocol:

registration
o  linkNames
(comment from inherited method)
return the relative pathName of this service; i.e. if
'Bla' is returned, the service is reached as http://hostname:port/Bla.
If the linkname was not explicitely assigned (via linkName: or linkNames:),
then the service's class is asked for a default linkNames

o  register: aBlock as: aPageNameString
register a page with given (full) link name

request handling
o  process: aRequest
not reached


Examples:


|server service|

server := HTTPServer serverOnPort:9091.

service := HTTPPluggableActionService new.
service register:[ :req | req reply:'Hello World' ] as:'hello'.
service register:[ :req | req reply:'Bla' ] as:'hello/bla'.

service registerServiceOn:server


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 06:32:23 GMT