HTTP-based datasnap session management

Source: Internet
Author: User

Uses system. strutils, datasnap. dssession, sessionstoreobjectui;

Function tservermethods1.echostring (value: string): string; begin result: = value; end;

Function tservermethods1.reversestring (value: string): string; begin result: = system. strutils. reversestring (value); end;

// The client calls the HTTP storeobject method to store the session key

Function tservermethods1.storeobject (Key, A, B, C: string): string; var session: tdssession; inst: tmysessionclass; DEST: string; begin session: = tdssessionmanager. getthreadsession; if assigned (Session) then begin inst: = tmysessionclass. create; Inst. a: = A; Inst. b: = B; Inst. c: = C; Session. putobject (Key, insT );

// Return the URL wish session ID in it for // testing getting the session data back DEST: = 'HTTP: // localhost: 8080/datasnap/rest/tservermethods1/GetObject/'+ key + '? SID = '+ session. sessionname;

Form3.setthentext (DEST );

Exit (DEST); end;

Result: = 'failed' to add the object to the session'; end;

// The client calls HTTP GetObject to obtain the session content

Procedure tservermethods1.getobject (key: string; Out A, B, C: string); var session: tdssession; inst: tmysessionclass; begin session: = tdssessionmanager. getthreadsession; if assigned (Session) then begin inst: = tmysessionclass (Session. getObject (key); If assigned (insT) then begin A: = Inst. a; B: = Inst. b; C: = Inst. c; exit; end; A: = 'failed' to load data for key: '+ key; end;

HTTP-based datasnap session management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.