Web Resource (PRIM_CLRC)

The abstract class describing the resource delivered by a webroutine

Ancestors - Object (PRIM_OBJT)

Details

A Web Resource is a component instance used to describe the output of a WebRoutine as a Response Object.

Example

This example shows a typical file download routine.
 
Rather than the data being returned as a BLOB, it is returned in a Response Object so that the browser can deal with it as an object.
 
The BLOB is read from the file and attached to the Response Object as the ContentFile.
Webroutine Name(DownloadImage) Response(#Response)
   Web_Map For(*Input) Fields(#Empno)
 
   Fetch Fields(#GiveName #Surname) From_File(pslmst) With_Key(#empno)
 
   If_Status Is(*okay)
 
      Fetch Fields(#empimg) From_File(pslimg) With_Key(#empno)
 
   If_Status Is(*okay)
 
      #Response.ContentFile := #Empimg.Filename
      #Response.AttachmentFileName := #Surname + #GiveName + #Empno
 
   Endif
 
   Endif
 
Endroutine

Properties

Name Description
AttachmentFileName Save the file with a suggested name
Charset Specify a character set override
ComponentClassName ComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT)
ComponentMembers ComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT)
ComponentPatternName ComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT)
ComponentTag Generic space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT)
ComponentType ComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT)
ComponentTypeName ComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT)
Compression Set as true to use gzip encoding to compress the file
ContentFile File name to be served
ContentString String to be served
ContentType Override the default file content type derived from the extension
HttpStatus HTTP status code
Name Name identifies the component Inherited from Object (PRIM_OBJT)
Owner Owner owns this component Inherited from Object (PRIM_OBJT)
Parent The component instance to which this instance is attached. The visual container for a control or the collector of a set of child instances Inherited from Object (PRIM_OBJT)
RemoveFile Remove the file after it is sent to the user agent

Events

Name Description
CreateInstance CreateInstance is signalled when an instance of a component is created Inherited from Web Resource (PRIM_CLRC)
DestroyInstance DestroyInstance is signalled when an instance of a component is about to be destroyed Inherited from Web Resource (PRIM_CLRC)

Methods

Name Description
AddHeader Add a custom HTTP header
Name, Value

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020