Jump to content

Uploading to UniGUI Server from VCL client


elGringo

Recommended Posts

For the moment I have working Decision for uploading files to HTTPServer, tried to transfer it to UniGUI Server but getting EUniSessionException (see attachment)

 

Even if i simply test connection...


procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo;
  AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean);
var ChunksInfo:string;

begin



with PS_HTTPFileServerAddon1.HTTPCommandGet_TPS_HTTPFileServerAddon do begin

   if ARequestInfo.URI='/testConnection' then

    begin

       AResponseInfo.ContentText := 'ok';
       AResponseInfo.ResponseNo := 200;
       AResponseInfo.WriteContent;

    end;

end;


post-2378-0-87000200-1487074085_thumb.jpg

Link to comment
Share on other sites

Shouldn't you be setting "Handled" to True if you're handling the request yourself and writing the content to prevent downstream processing from happening?

 

But, I'm also interested in this (and/or really something perhaps similar/related to this) which is how to control or post to a specific user session, I'll probably be posting a question shortly.   

Link to comment
Share on other sites

wprins, thank you for the answer.

 

That is interesting moment. I just tried to ping uniServer - if it works from vcl app.

 

it 100% must be the way to check if Uniserver answers  or not from other app ( not uniGui).

 

About "Handled" - i don't know about it - how it works?

Link to comment
Share on other sites

wprins, thank you for the answer.

 

That is interesting moment. I just tried to ping uniServer - if it works from vcl app.

 

it 100% must be the way to check if Uniserver answers  or not from other app ( not uniGui).

 

About "Handled" - i don't know about it - how it works?

 

The whole "Handled" idea crops up in several places in Delphi (WebBroker, Indy, Datasnap IIRC offhand), usually in the context of some type of request event handler (web request), the idea being that, instead of letting the framework or library code "handle" the request in the normal way, you can (in the event handler), "intervene" and "handle it yourself", and signal this to the rest of the system/library by setting the "Handled" output parameter to True.  

 

In your case, you've basically handled the response, by setting the Content and ResponseCode, and also sent it off, which means you've literally handled it there and then, and should not want the rest of the normal processing to happen.  To ensure that, you ought to therefore set Handled to True.  (Sometimes one just wants to alter or augment, or inspect [or log] a request in an event handled, and you still want the "normal" library/framework processing to happen.  In such cases you obviously would not set Handled to true.)

 

Anyway I'll also be looking at file uploads to a UniGUI solution shortly so will come back post once I've had a look if you like.

Link to comment
Share on other sites

As for uploading files from 3-d party, i decided to use separate HTTPFileServer(Indy) - I upload in chunks of definite size - my own decision, maybe as a separate EXE - for best sustain, in the same folder as UniServer - that's Ok for my task, but of course better to send files directly to UniGUI, Also UniGUI is quite close in that way as I can see, maybe for security reasons.

 

but anyway - I need to check if UniGUI Server works or not. Start it, Stop it from 3-d party vcl client. I have only 1 idea for the moment how to do that - check if process exists or not on server machine. Also - delete from the proceses or load again.

 

And thank you for "handled" explanation. It means finish with processing as I understood.

 

Regards, Stanislav.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...