Hi Marco,
thanks for your info. some questions: the webdavResoruce has one method:
public Subscription
<http://jakarta.apache.org/slide/clientjavadoc/org/apache/webdav/lib/Subscription.html>
*subscribeMethod*(java.lang.String path,
java.lang.String notificationType,
java.lang.String callback,
long notificationDelay,
int depth,
long lifetime)
I suppose this is used to tell Slide that I am interested in the change made
to the 'path'. But I do not know how to register the Subscriber. and also
what do we have in the Map information ? the API doc does not tell us more
abt this though.
One more question, does this subscribeMethod is valid for the current http
session ? I am developing a Struts+Spring based web application. The feature
is something like this:
user can subscribe to the changes made to the resources (files/folders)
when something happened, a notification msg is sent by Slide to my web
application; the web application then log necessary information, like who
and what action was done to the resource.
Does your solution work in this way:
- when we start the web application, we check a special folder in Slide to
get any existing subscritions, then webdavResource.subscribeMethod() one by
one with a long enough lifetime;
- when user wants to monitor a resource, the web application add the
request into the special folder, and also webdavResource.subscribeMethod()
it.
- when a notification arrives, the registered Subscriber class will get the
user list and send msg to all subscribers
thanks !
On 6/12/06, Marco Ferretti <[EMAIL PROTECTED]> wrote:
On 6/12/06, Lixin Chu <[EMAIL PROTECTED]> wrote:
> I realized that proppatchmethod will create a new version for a
versioned
> resource.
>
> if this is true, I am afraid that I cannot make use of this mechanism to
> support custome properties.
>
> Is it really true ?
>
> The specific custome property I would like to have is a list of users
who
> are interested in the update of the resource (file or folder). I wanted
to
> do something when the watched resource is changed (new version uploaded,
or
> deleted for example).
>
> I notice that there is a subscribe method, but do not know how to
program
> it; googled but did not find detailed enough examples.
>
> any idea ?
>
As of the notification :
2 make a long story short you have to implement your subscriber (
implements org.apache.webdav.lib.Subscriber ) in order to reply to the
listener. The method that's being called is public void notify(String
uri, Map information) ; This way you can implement your emailer .
What I did was mantaining a list of users/resource/type of
subscription in a private webdav folder so that I didn't have to
bother with users deleting properties that mattered from the resources
themselves .
In my implementation of Subscriber I had something like
public void notify(String uri, Map information) {
printInfos(uri,information,logger);
if ( users != null && !users.isEmpty() ){
sendSmtpMail(message + "\n\n" +
createMessageBody(uri,information));
} else {
logger.warning("users list is empty");
}
}
Then you have to implement your own methods for sending email .
I'll come back on this if you need more.
Cheers
Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]