A "best practices" question: What is the best way of sharing a single, changeable copy of common information across multiple servlets?
Example Scenario: Using two servlets (webdav and cocoon), I need to share common information between them. There are two choices for how to host the servlets, each of which affects the options for sharing info: - host the servlets in different contexts (a likely requirement if security constraints differ) - host the servlets in the same context. Then, within each servlet you could share the information through: - singleton classes + pro: conceptually simple + con: singleton pattern isn't bulletproof + con: threading issues? + con: lifecyle issues (can't use servlet destroy() if have multiple servlets) - avalon roles + pro: convenient, correct lifecycle management + pro: using avalon in other apps (James) in same JVM could also share info + con: poolable (e.g. multiple instances) and not the same as singleton - context attributes + pro: conceptually simple, no singleton coding necessary + con: HTTP specific, information can't be shared with non TC app (James) + con: can't share across contexts, all servlets must live in same webapp - enterprise javabeans + pro: managed + con: requires J2EE server? 1) Are there other options I'm missing? 2) What have people found to be the best pattern? 3) Besides the servlet 2.3 reference docs and O'Reilly books, can anyone recommend reading material that includes these issues (most introductory books cover the same 'your first webapp' type of material). Thanks in advance for your opinion, Per -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
