Re: Cobranding - Share Controller, Split View

2002-07-15 Thread Henner Zeller


Hi,
 I know I can treat the servlets as a separate webapp and deploy them to
 each separate host, but if I do this, will they be able to access the
 different configuration ( context-param and JNDI resources )
 specified in the each ROOT context's web.xml? 

What about having the same servlet referenced more than once in the same 
web.xml with different init-params ? Consider you have Servlet 
com.codemagi.FooServlet, then you could do

  servlet
servlet-name
   com.gargelmarf.FooServlet
/servlet-name
servlet-class
com.codemagi.FooServlet
/servlet-class
init-param
   param-namebrandType/param-name
   param-value1/param-value
/init-param
{...}
  /servlet

  servlet
servlet-name
   com.foobaz.FooServlet
/servlet-name
servlet-class
com.codemagi.FooServlet
/servlet-class
init-param
   param-namebrandType/param-name
   param-value2/param-value
/init-param
{...}
  /servlet
--
All these servlets can be accessed from the same context, but
have different names. The servlet com.codemagi.FooServlet reads the
init-param to determine the brand.
If you access:
  /mycontext/servlet/com.gargelmarf.FooServlet
  /mycontext/servlet/com.foobaz.FooServlet
all that is called are two different instances of com.codemagi.FooServlet,
sharing the same context but with different init-params.

Probably this is the easiest way to do it.

ciao,
 -hen


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Cobranding - Share Controller, Split View

2002-07-15 Thread Craig R. McClanahan



On Sun, 14 Jul 2002, August Detlefsen wrote:

 Date: Sun, 14 Jul 2002 23:15:53 -0700 (PDT)
 From: August Detlefsen [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED],
  [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: Cobranding - Share Controller, Split View

 I am currently developing several cobranded sites that share the same
 functionality. I want to be able to share the same set of servlets
 across multiple cobrands.

 I know I can treat the servlets as a separate webapp and deploy them to
 each separate host, but if I do this, will they be able to access the
 different configuration ( context-param and JNDI resources )
 specified in the each ROOT context's web.xml?


One way to do this in Tomcat 4.1.x is to take advantage of the
ResourceLink element.  Basically, you define the resources you want to
share once in the GlobalNamingResources section of server.xml, and then
embed a ResourceLink for each resource in the Context element for the
various webapps.  From the point of view of the application, it just looks
like a normal application resource -- the app doesn't know that it is
actually getting resolved to the underlying shared resource by a link.

This is very handy when you use the global resources to establish all the
default behavior, then override just the resources a particular app needs
to customize that app.  The app itself thinks of all resources as being
local, so it doesn't need to be modified to look two different places.

 -August


Craig


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Cobranding - Share Controller, Split View

2002-07-15 Thread August Detlefsen

Is there any support for this in TC 4.0.4? We can't upgrade to 4.1
until it is officially released. 

Is there some way to get a handle on the ServletContext representing
ROOT? Then I can easily load the params I need. 

How about ServletContext.getContext(/) -I tried this in my init()
method, but it only returns null: 

public void init(ServletConfig config)
throws ServletException {

super.init(config);

//get this servlet's context and location
ServletContext application = config.getServletContext();
ServletContext root= application.getContext(/);

//the rest...
}

The api docs for getContext() say: 

   In a security conscious environment, the servlet container 
may return null for a given URL.

How can I know if I am hitting a security constraint? If that is the
problem, is there a way to bypass the security to allow access to the
ROOT context, but only from this one app? 

-August



--- Craig R. McClanahan [EMAIL PROTECTED] wrote:
 
 
 On Sun, 14 Jul 2002, August Detlefsen wrote:
 
  Date: Sun, 14 Jul 2002 23:15:53 -0700 (PDT)
  From: August Detlefsen [EMAIL PROTECTED]
  Reply-To: Tomcat Users List [EMAIL PROTECTED],
   [EMAIL PROTECTED]
  To: Tomcat Users List [EMAIL PROTECTED]
  Subject: Cobranding - Share Controller, Split View
 
  I am currently developing several cobranded sites that share the
 same
  functionality. I want to be able to share the same set of servlets
  across multiple cobrands.
 
  I know I can treat the servlets as a separate webapp and deploy
 them to
  each separate host, but if I do this, will they be able to access
 the
  different configuration ( context-param and JNDI resources )
  specified in the each ROOT context's web.xml?
 
 
 One way to do this in Tomcat 4.1.x is to take advantage of the
 ResourceLink element.  Basically, you define the resources you want
 to
 share once in the GlobalNamingResources section of server.xml, and
 then
 embed a ResourceLink for each resource in the Context element for
 the
 various webapps.  From the point of view of the application, it just
 looks
 like a normal application resource -- the app doesn't know that it is
 actually getting resolved to the underlying shared resource by a
 link.
 
 This is very handy when you use the global resources to establish all
 the
 default behavior, then override just the resources a particular app
 needs
 to customize that app.  The app itself thinks of all resources as
 being
 local, so it doesn't need to be modified to look two different
 places.
 
  -August
 
 
 Craig
 
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 


__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Cobranding - Share Controller, Split View

2002-07-15 Thread August Detlefsen

This will work, but then I'd have to add a different servlet definition
for each cobrand (and code the views with different references as
well?). There must be a simpler way..?




--- Henner Zeller [EMAIL PROTECTED] wrote:
 
 Hi,
  I know I can treat the servlets as a separate webapp and deploy
 them to
  each separate host, but if I do this, will they be able to access
 the
  different configuration ( context-param and JNDI resources )
  specified in the each ROOT context's web.xml? 
 
 What about having the same servlet referenced more than once in the
 same 
 web.xml with different init-params ? Consider you have Servlet 
 com.codemagi.FooServlet, then you could do
 
   servlet
 servlet-name
com.gargelmarf.FooServlet
 /servlet-name
 servlet-class
 com.codemagi.FooServlet
 /servlet-class
 init-param
param-namebrandType/param-name
param-value1/param-value
 /init-param
 {...}
   /servlet
 
   servlet
 servlet-name
com.foobaz.FooServlet
 /servlet-name
 servlet-class
 com.codemagi.FooServlet
 /servlet-class
 init-param
param-namebrandType/param-name
param-value2/param-value
 /init-param
 {...}
   /servlet
 --
 All these servlets can be accessed from the same context, but
 have different names. The servlet com.codemagi.FooServlet reads the
 init-param to determine the brand.
 If you access:
   /mycontext/servlet/com.gargelmarf.FooServlet
   /mycontext/servlet/com.foobaz.FooServlet
 all that is called are two different instances of
 com.codemagi.FooServlet,
 sharing the same context but with different init-params.
 
 Probably this is the easiest way to do it.
 
 ciao,
  -hen
 
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 


__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Cobranding - Share Controller, Split View

2002-07-14 Thread August Detlefsen

I am currently developing several cobranded sites that share the same
functionality. I want to be able to share the same set of servlets
across multiple cobrands. 

I know I can treat the servlets as a separate webapp and deploy them to
each separate host, but if I do this, will they be able to access the
different configuration ( context-param and JNDI resources )
specified in the each ROOT context's web.xml? 

-August

__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]