EJB and permanent checking

G

Guybrush Treepwood

I want to implement a webbased bookmark management application. Users will
be notified if one of their bookmarks has changed content. So the server
program will need to check regularly the differences between cached sites
and the site at the url. But how is this done? I'm a beginner with EJB and
as far as I understand, the Enterprise Beans come into action whenever a
client makes connection. How can I keep checking the bookmarks, no matter
what the logins are.
 
J

Jon Martin Solaas

Guybrush said:
I want to implement a webbased bookmark management application. Users will
be notified if one of their bookmarks has changed content. So the server
program will need to check regularly the differences between cached sites
and the site at the url. But how is this done?

Download the content and compare to cached content, prehaps using some
checksumming. The http protocol also specifies the If-Modified-Since header:

14.25 If-Modified-Since

The If-Modified-Since request-header field is used with a method to
make it conditional: if the requested variant has not been modified
since the time specified in this field, an entity will not be
returned from the server; instead, a 304 (not modified) response will
be returned without any message-body.

If-Modified-Since = "If-Modified-Since" ":" HTTP-date

An example of the field is:

If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT

[...] <http://www.faqs.org/rfcs/rfc2616.html>

Using this would obviously be better since there is no need to download
content. I do not know how dynamic pages are handled, I suppose they may
be considered modified at any time ...

From what you write below I suppose your server will be EJB-based. But
EJB's can't download using http themselves, so you must find some other
way, perhaps write a spider that is started automatically at certain
intervals, get a list of sites from an ejb to scan, and feed the result
back to the ejb which takes care of all the accounting.
I'm a beginner with EJB and
as far as I understand, the Enterprise Beans come into action whenever a
client makes connection. How can I keep checking the bookmarks, no matter
what the logins are.

Not really sure what you want here. Possibly, you can't check all the
users bookmarks when the user logs into your application (too slow), so
I suppose you're asking how to implement asynchronous bookmark checking.
But: Also consider, If the list of links isn't too large (perhaps
because its's broken into some hierarcy of categories), and the
If-Modified-since http-function works satisfactory (no need to download
content), it might be possible to implement on-the-fly checking of the
links, and you would have saved yourself a lot of asynchronous
programming, and the state of the link-collection is always fresh.

If not; To have EJB's execute stuff at a certain time, possibly
repetitive, maybe the TimedObject of EJb 2.1 can be of help. But your
real problem is not scheduling, but the fact that you can't make http
connections from within the EJB container (In most cases nobody stops
you, but it's not standards compliant). You'd have to make some external
daemon program updating the bookmark database instead, and have the
EJB's check the same database. Also note, you don't *have* to use EJB's
for this, unless the general architecture of your applications requires EJB.

Last but not least, you have to define what "updated" means. For
instance; if the bookmark is referring a page at some commercial site,
has the page really changed if only an ad-banner has changed (and they
change a lot ... :) ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top