scistag.webstag.server.class_service_entry.WebClassServiceEntry

class WebClassServiceEntry(class_type, multithread=False, parameters=None)[source]

Bases: object

Defines the class entry for a single class which is published via http.

It converts the http request parameters to object method parameters, calls the method if it is available and afterwards bundles the method’s results to a http response again.

Parameters
  • class_type (type) – The type of the class to be instantiated

  • multithread (bool) – Defines if the class is multithread secure and can be used in parallel

  • parameters (dict | None) –

    The parameters to be passed to the object’s constructor

    Note that these value will be kept and passed on upon first use of the object’s services.

Methods

execute

Executes the object's method by unwrapping all input parameters to

prepare

Prepares the service and evaluate all available methods

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

class_type

The type of the class to construct for this service

parameters

The parameters to be passed to the object's initializer

_init_lock

Lock for the first initialization of an object

access_lock

Lock for the execution of the object (if not multi-threading capable)

prepared

Flag if this service is setup

main_object

The object instance - will be created upon first use of the service

multithread

Defines if the service can be access from multiple threads

methods

The methods the object implements

execute(request)[source]
Executes the object’s method by unwrapping all input parameters to

the function’s parameter list and vice versa all function results back to content returnable via http.

Parameters

request (WebRequest) – The http request details

Return type

WebResponse

Returns

The http response

prepare()[source]

Prepares the service and evaluate all available methods

_init_lock

Lock for the first initialization of an object

access_lock

Lock for the execution of the object (if not multi-threading capable)

class_type

The type of the class to construct for this service

main_object

The object instance - will be created upon first use of the service

methods: dict[str, method]

The methods the object implements

multithread

Defines if the service can be access from multiple threads

parameters

The parameters to be passed to the object’s initializer

prepared

Flag if this service is setup