• 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

Servlet to Servlet

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on a utility API. Basically, this would be a web-app with a servlet that will load some data from various property/text files into Hashtables (or classes extending HT), cache it using OSCache for say 48 hrs and service client requests.
Another application (which can be any application, the Utlity API shouldn't bother about it), lets call it client application, has a servlet that will send request to this API (say request for translating a word to another language). The API will search for the translation in the Hashtables and return it to the servlet if found (or an empty string if not found).
I am really not able to imagine the design part of it. My API should have abstraction so that any client API can use it. The API on the other hand should be something like a service (apart from usual java classes) that updates the data after the OSCache TTL expires automatically. Can anybody help me in this?
Thanks for your time ranchers..
[ December 01, 2003: Message edited by: Yash Sharma ]
 
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You say you are writing a utility API, then why do you want to have a servlet on top of it ?? You can simply expose your APIs as a simple Java class and let any client call the methods.
If for whatever reason, you need to have a servlet on top of your utility API, then no problem. Any client can simply make a HTTPConnection to your servlet and get the response stream with the results.
Regards.
 
Yash Sharma
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. Actually I am envisaging a Servlet in the utility API because I need some sort of service that automatically reads the data from property/text files periodically (as per the TTL of OSCache) and has the Hashtables loaded in memory, ready to respond to the client Servlet.
I could have kept the hash data in a database but I want to avoid that. The data is not changing too frequently and is hence cached and updated only in say a week or so. The client Servlets would be given responses based on this cached data.
[ December 01, 2003: Message edited by: Yash Sharma ]
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can basically go 2 ways here.
First way is to write the servlet to take in HTTP requests (or whatever protocol) and act as a regular servlet would, returning the results using it's reqular PrintWriter.
Second way would have the servlet sitting there and acting as a server of its own, responding to requests in a custom protocol you need to design and passing back the results in whichever way is easiest for you. This is a bit more programming effort but a more flexible approach.
 
Yash Sharma
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again for the reply. There is one more query in my mind. I am aware of various frameworks like Struts or Cocoon. For the server-side Utility API that I want to make is there any free framework available. Obviously I am interested in a non-GUI type of framework since my API would not involve any GUI but would simply respond to client requests.
I hope I am not being stupid but perhaps I am asking something of a framework for the Business Logic Layer.
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Yash Sharma:
Thanks again for the reply. There is one more query in my mind. I am aware of various frameworks like Struts or Cocoon. For the server-side Utility API that I want to make is there any free framework available. Obviously I am interested in a non-GUI type of framework since my API would not involve any GUI but would simply respond to client requests.
I hope I am not being stupid but perhaps I am asking something of a framework for the Business Logic Layer.


I suggest for your requirement mentioned above, it simply would be easy to finish it off on your own. learning a framework and most importantly using it effectively will take some time. well, i dont know of any f/w that fits your requirement.
[ December 02, 2003: Message edited by: shankar vembu ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic