• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Regarding multiple application contexts in a given web application

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

Can there be more than one application contexts in a given web application?

Thanks and regards,
Paritosh Chandorkar
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think so. ALthough I haven't done it myself. You can put multiple DispatcherServlets in your web xml and map them to differrent paths. You can put the applicatiuon context as the contextCOnfig location parameter to the DispatcherServlet. SOmething like this



Try this out. I am pretty sure you can make it work
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The URL pattern in the servlet mapping above is what comes after the context root, isn't it?

I don't think that's possible.
I think it's something to do with container.
For example, in WebSphere, you have to supply the context root while deploying the app using Admin Console (there may be other ways to deploy), in which case you can't provide two context roots for the same app.

That's what my understanding is.
 
Jayesh A Lalwani
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since, the OP posted this thread in Spring, I'm pretty sure he means Spring application context.. not web application context

It's confusing... I know!! This is why I call the Spring application context "Spring xml" . Spring should have named application context something else.
 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:I'm pretty sure he means Spring application context.. not web application context


Gotcha.

Sorry, I didn't read the question properly.
 
Paritosh H Chandorkar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

For application context there is no entry in web.xml.
So is the above way correct to create multiple application contexts in spring?
Just confirming

Thanks and regards,
Paritosh Chandorkar
 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paritosh H Chandorkar wrote:
Just confirming



You need to try and confirm, isn't it?
 
Paritosh H Chandorkar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

We just checked.

We can have two or more objects of application contexts.

Example:
ApplicationContext object1 =new ApplicationContext(Bean.xml);
ApplicationContext object2 =new ApplicationContext(Bean.xml);
It gets initialized twice and two application contexts are created.

Thanks for the reply:)Just confirmed your answer.

Thanks and regards,
Paritosh Chandorkar

 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic