Different WAR files, shared same user permission
You can enable SSO, as detailed here: JBoss7 Web SSO (Non-Clustered) or here: http://www.mastertheboss.com/jboss-server/jboss-security/configuring-single-signon-on-jboss-as-7
Add sso
tag to your standalone.xml
:
<virtual-server name="default-host" enable-welcome-root="false">
...
<sso domain="local" reauthenticate="false"/>
</virtual-server>
And add/update your war/WEB-INF/jboss-web.xml
:
<jboss-web>
<security-domain>sso</security-domain>
<valve>
<class-name>org.apache.catalina.authenticator.SingleSignOn</class-name>
</valve>
</jboss-web>
2 war files under same single tomcat - static resource sharing
Yes, you can. You simply need to put the context root of application A in the path for the script reference, e.g. like this
<script src="/A/sample.js"></script>
How does Tomcat load the different war files?
Tomcat creates (Web) application class loaders for each deployed WAR. It has some common class loaders. The overall hierachy is best described in the class loader howto:
http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html
BTW: Tomcat does an incredible amount of resource management in order to allow applications to be undeployed. This is described here:
http://wiki.apache.org/tomcat/MemoryLeakProtection
and ties tightly into class loaders and class unloading.
Tomcat ServletContext vs JNDI for Sharing session data across multiple war files
I'm not sure if you understood correctly, but the HttpSession is different for each user (browser session), and for each application as well, AFAIK, so you can't use it to share data.
Basically, you need communication between your web applications.
You could have one war to act as data manager for your UserSession, and all other wars communicating to this one. The data manager application needs to expose a service, e.g. UserSessionManager that can be accessed via other applications.
JNDI is a traditional solution for this. Spring has some helpers for this, but the JNDI API is not too complicated either. In the data manager war, you could do something like this in an initialization method:
DataManager mgr = new DataManagerImpl(...);
InitialContext ic = new InitialContext();
ic.rebind("java:global/env/datamanager", mgr);
The interface and the data objects you use needs to be put in a jar that is shared in all 'client' wars, the implementation is only in the data manager war. In your client wars, you can then do:
InitialContext ic = new InitialContext();
DataManager mgr = (DataManager)ic.lookup("java:global/env/datamanager");
Hope this helps,
Geert.
Related Topics
How to Make a New List in Java
How to Check Available Space on Android Device? on Sd Card
Android Resource - Array of Arrays
Android: How to Disable List Items on List Creation
How to Draw a Filled Triangle in Android Canvas
What Exactly Is a Context in Java
Android Fragmentmanager Backstackrecord.Run Throwing Nullpointerexception
How to Give an Imageview Click Effect Like a Button on Android
Collections Sort(List<T>,Comparator<? Super T>) Method Example
Why Can Not I Add Two Bytes and Get an Int and I Can Add Two Final Bytes Get a Byte
Private Final Static Attribute VS Private Final Attribute
How to Populate a Drop Down with a List Using Thymeleaf and Spring
Android Project Using Httpclient --> Http.Client (Apache), Post/Get Method
Full Screen Videoview Without Stretching the Video