IntraWeb Articles and documentation
An Intraweb programmer must to know than Intraweb need serveral URL directories to execute an application: /files, /js, /exec... There is another special directories too which are the init session directory ( the property startcmd of the servercontrooller) by default is "/" and ther execution session directory (property execcmd) by default is "/EXEC "
This is an important problem when you want to have several "stand-alone" intraweb application running in a common domain, because some of this directories interfere to each other.
Intraweb have a 'partial solution' for this problem. In URLBase property of the servercontroller of our intraweb application.
An organization have an internet domain which point to the proxy entry of this enterprise. This proxy, route the http calls to other computer:port in the LAN, it depending of the "directory" of the http call.
We supose the domain : www.dominio.com
We want to have 1 app running as "http page" of this domain as:
In the proxy, we have routed the virtual directory app1 to a computer1:port running the first application. Really this is the entry point of the application, which can be customized in StartCMD.
So, the proxy route the http call to the computer1, and this know than is a init session (because the command is the startCMD).
Immediately we verified than we need at least one dir more: the application is redirected to another directory: /EXEC.
Here, we can choose between route the /EXEC directory in the proxy to the computer1 or make a new directory ( which name /execapp1, for example), in an ingenuous forecast of which we want to execute more applications. Let us suppose than we route this /execapp1 to the computer1 too.
We execute the program. Horror!, we even needed more directories.
www.dominio.com/files, www.dominio.com/fs, www.dominio.com/gfx...
Well here is the problem if we want to have another app running as page in the same domain.
www.dominio.com/app2 and exec dir www.dominio.com/execapp2
But what happend with www.dominio.com/files, www.dominio.com/fs, www.dominio.com/gfx ?
Where you route this directories, to app1 or app2 ?.
The solution is than each app run in different directories.
The app1 start in
continue the execution in
and it will use the resources relative to its directory
www.dominio.com/app1/js, www.dominio.com/app1/files, etc..
and app2 will use
www.dominio.com/app2, www.dominio.com/app2/EXEC, www.dominio.com/app2/js, etc..
This effect can be optained by URLBase property in the servercontroller.
Apparently, if we assigned URLBase with the prefix which we want to the application, we have obtained the result.
But when proving it, we verified that it fails, because the app1 don since it does not recognize the http commands. Some dir arrive at the application as "/app1/js" instead of "/js", and our application don't recognize /app1/js as dir.
We are in an impasse?
Apparently there is no good solution for this problem, But we can do a little hackering in our application in order fix this problem.
The server controller in our application have a property event called onBeforeDispatch, which is called before process the response in all Http commands. Is some like
(Sender: TObject; Request: TWebRequest; Response: TWebResponse;var Handled: Boolean);
Now, we want to remove the prefix /app1 of the request, before it passes to the recognition engine, so commands as "/app1/js/" are filtered as if they were "/js".
If we can modify the request, the problem is solved. But Request as type TwebReqest, don't have the possibility of change the call, unless we treat it as another type.
At the moment, in the delphi intraweb versions, than I know , this Request can be handled as a TInHTTPAppRequest, which have easy access to the command, through document property.
We can make our TmiRequest class which extended to TInHTTPAppRequest and which made the comprobation before continue the command reponse process.
// example1: type TmiRequest= class (TInHTTPAppRequest) public procedure setroot(const raiz:string); end; procedure TmiRequest.setroot(const raiz:string); var s:string; n:integer; begin s:= FRequestInfo.Document; n:=pos (raiz,s); if n>0 then if s<>raiz then begin delete (s,n,length(raiz)); FRequestInfo.Document:=s; end end;
Resume and several things more, for correct functionality :
1- We have assigned the URLBase property with "/app1" value.
2- We have assigned the StartCmd with the same value (removing the / ) . StartCmd:="app1".
3 - We include in servercontroller unit the code showed in example1
4- Important. All the references than we have as /files in our program (mainly in the use external templates), must be changed to /app1/files.
ONLY FOR VCL
This technique is only for VCL application. It don't work directly in .NET applications, but it can inspered to you for find the solution before I.
Strange effect in tab order.
I was many time confusing with tab order in Iw forms. (both using templates or not). It arrived a little while, working and changing things in the form, than tab order fail, and I can't do nothing to select the preference in tab order in the form. Because I assign an order in tabOrder, but when run it , then it work as other tab order...
Looking in the problem I have reached a conclusion, the order of tabs depend of the name component order. That is, if you have 2 iwedit component with name e1 and e2, every time the tab order was first for e1 and second e2. (even if you change the taborder property in component). I suspect than it is effect of the order setting in the final form generated in the page.
<form method post>
<input type="HIDDEN" name="e1">
<input type="HIDDEN" name="e2">
But really I never read about than the order of this hidden edits determine the tab index.
Really I don't know if is an Intraweb error, An Internet explorer error, or my error.
Somebody know about this problem ?
Granprimo have a 'little problem' with the security issues in Intraweb library.
For security and integrity, IW remember the 'User-Agent' associated with the user session and crash when it have different values in the same session.
The problem is when the 'User-Agent' header request of html browser is different than Java engine. (for example 'ms-IE' and 'java Sun' have different 'User-Agent' string)
Because Gp need to lunch a Java applet in the browser, different 'User-Agent' version can crash the communication.
This problem have an easy solution since 6.0.20 Intraweb version. (http://www.atozed.com/IntraWeb/History/60.iwp). The guis of Atozed add the BrowserSecurityCheck property in Application Forms to switch off check for browser change for SendFile/SendStream, then this is what we are looking for, the way to disable
But in older version, I don't found the way to fix it with my component, I must to do a patch in httpapp.pas unit to fix it.
the change is in TCustomWebDispatcher.DispatchAction method.
This it is not the 'ideal' way to fix the problem, but it work.
Teléfono: 978-610539 - Fax: 978-610861 -Trav.Agustina Aragón 1,1e 44002 Teruel ( España ).webmaster
Copyright © 1997-2004 , [Multi-Informatica Teruel, S.L].La información contenida en este documento está sujeta a modificaciones sin previo aviso. Otros productos u organizaciones mencionadas aquí son marcas comerciales o marcas registradas propiedad de sus respectivas organizaciones o propietarios.