• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sharing data between web app's

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the best way of sharing data between web apps
request or session or application?
 
Ranch Hand
Posts: 472
Objective C Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
database
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All option are depends on your needs.

Session: when you want to share your data in your whole application. like user_id.
Request: its just use for forward and recieve the data between webpages but its data just shareable for next and last hit webpages.. not like session.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
..., or socket connections, or files, or email, or JMS, or HTTP, or web services, or ...

That's too broad a question to answer without knowing the details of what you want to share, how often it changes, etc.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Saif uddin:
Session: when you want to share your data in your whole application. like user_id.



Nope.

Session: The information is available throughout the session till session is invalidated

Request: The information is available just for that particular request cycle after that that particular request is disposed off
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vijayk gopu:
What is the best way of sharing data between web apps
request or session or application?



These scopes would not be available out of the context. Or you can use some stateful beans. Indeed, you can send some data using request parameters.

Other options are already mentioned.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adeel Ansari:


These scopes would not be available out of the context. Or you can use some stateful beans. Indeed, you can send some data using request parameters.

Other options are already mentioned.



Ok, btw HttpSession API confirm this
"Session information is scoped only to the current web application (ServletContext), so information stored in one context will not be directly visible in another."

but what that 'directly' means?
which are the not-so direct way to access to session info from a different web context?
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try this , but would not recomend this.

Write a singleton repository , which can store key , value pairs and then place those classes in shared/classes , so that this is visible to all the web applcations.
 
leonardo battagli
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rahul Bhattacharjee:
You can try this , but would not recomend this.

Write a singleton repository , which can store key , value pairs and then place those classes in shared/classes , so that this is visible to all the web applcations.



what does that 'singleton repository' means?

It means, create an object with the singleton pattern and store it in shared/classes of the ear, so that both application can access it?
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
simple: do NOT do this. If you need to send data from one web app to another store it in a database used by both or send http requests to servlets back and forth.

Do NOT attempt to write some class, instances of which you hope will be available to both applications.
It's not going to work, and even if you think it does it's not at all scalable and extremely poor design.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can choose, the most suitable one for you, from the list given by Ulf.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adeel Ansari:

Session: The information is available throughout the session till session is invalidated

Request: The information is available just for that particular request cycle after that that particular request is disposed off



agreed with more clear picture..
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by leonardo battagli:


what does that 'singleton repository' means?

It means, create an object with the singleton pattern and store it in shared/classes of the ear, so that both application can access it?



yes..
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic