Inter-Application Communication"

From Documentation
(Created page with '{{ZKDevelopersReferencePageHeader}} =Version History= {{LastUpdated}} {| border='1px' | width="100%" ! Version !! Date !! Content |- |   |   |   |} {{ZKDeveloper…')
 
Line 1: Line 1:
 
{{ZKDevelopersReferencePageHeader}}
 
{{ZKDevelopersReferencePageHeader}}
 +
 +
__TOC__
 +
 +
An EAR file or an installation of Web server could have multiple WAR files. Each of them is a Web application. There are no standard way to communicate between two Web applications. However, there are a few ways to work around it.
 +
 +
=Use ZK Specific URI: <tt>~app/</tt>=
 +
ZK supports a way to reference the resource from another Web applications. For example, assume you want to include a resource, say <tt>/foreign.zul</tt>, from another Web application, say <tt>app2</tt>. Then, you could do as follows.
 +
 +
<include src="~app2/foreign.zul"/>
 +
 +
Similarly, you could reference resources from another Web application.
 +
 +
<source lang="xml">
 +
<style src="~app2/foo.css"/> <!-- assume foo.css is in the context called app2 -->
 +
<image src="~/foo.png"/> <!-- assume foo.png is in the root context -->
 +
</source>
 +
 +
Note: Whether you can access a resource located in another Web application depends on the configuration of the Web server. For example, you have to specify <tt>crossContext="true"</tt> in conf/context.xml, if you are using Tomcat.
 +
 +
= Web Resources from Classpath =
 +
Though it is not necessary for inter-application communication, you could, with ZK, reference a resource that is locatable by the classpath. The advantage is that you could embed Web resources in a JAR file, which simplifies the deployment.
 +
 +
<image src="~./my/jar.gif"/>
 +
 +
Then, it tries to locate the resource, <tt>/my/jar.gif</tt>, at the <tt>/web</tt> directory by searching resources from the classpath. Notice that <tt>WEB-INF/classes</tt> is also part of the classpath, so you could it under <tt>WEB-INF/classes/web/my/jar.gif</tt> too.
  
 
=Version History=
 
=Version History=

Revision as of 11:15, 25 November 2010


Inter-Application Communication


An EAR file or an installation of Web server could have multiple WAR files. Each of them is a Web application. There are no standard way to communicate between two Web applications. However, there are a few ways to work around it.

Use ZK Specific URI: ~app/

ZK supports a way to reference the resource from another Web applications. For example, assume you want to include a resource, say /foreign.zul, from another Web application, say app2. Then, you could do as follows.

<include src="~app2/foreign.zul"/>

Similarly, you could reference resources from another Web application.

<style src="~app2/foo.css"/> <!-- assume foo.css is in the context called app2 --> 
<image src="~/foo.png"/> <!-- assume foo.png is in the root context -->

Note: Whether you can access a resource located in another Web application depends on the configuration of the Web server. For example, you have to specify crossContext="true" in conf/context.xml, if you are using Tomcat.

Web Resources from Classpath

Though it is not necessary for inter-application communication, you could, with ZK, reference a resource that is locatable by the classpath. The advantage is that you could embed Web resources in a JAR file, which simplifies the deployment.

<image src="~./my/jar.gif"/>

Then, it tries to locate the resource, /my/jar.gif, at the /web directory by searching resources from the classpath. Notice that WEB-INF/classes is also part of the classpath, so you could it under WEB-INF/classes/web/my/jar.gif too.

Version History

Last Update : 2010/11/25


Version Date Content
     



Last Update : 2010/11/25

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.