-----Original Message-----
From: Serge Knystautas <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, April 17, 2000 11:00 AM
Subject: Servlet API questions
>I spent a little bit of time this weekend writing a very simple listserv
>servlet, and ran into some problems with the API. The problem I faced
>is that servlets can get invoked based on a recipient, and the extra
>work a servlet must do if there are multiple recipients. Here's an
>example:
Mailet can be invoked based on whatever condition occurrs. Or better
recipient can be invoked. So if you base your condition on recipients some
of them in the same mail will match and all other will not and so james will
split the mail it two. If you base condition on other things like sender or
size all recipient or none will match and so the recipient list in the mail
will remain untouched (all matching or none matching).
>
>Say I'm so proud of the code I've written, I want to send a message to
>[EMAIL PROTECTED], [EMAIL PROTECTED],
>[EMAIL PROTECTED] James is the mail server list, which I
>am a member of and that should deliver fine. Town is a members-only
>list, and I am not a member and that should bounce. Broadcast is a
>non-existant listserv.
>
>James, using the conf file, will see [EMAIL PROTECTED] as a
>specified recipient and will invoke the MiniListserv (servlet) for that
>mailing list. What should this servlet return if 1) the message was
>successfully sent to the listserv or 2) it was bounced (invalid sender,
>contained an attachment, etc...). Right now, I have to duplicate the
>email address of the listserv as a servlet parameter, and try to remove
>that email address from the array of recipients in the Mail object.
>
> [...]
Not sure if I get your point... I would handle this like:
<servlet match="[EMAIL PROTECTED]"
class="MiniListserv">
<listName> James </listName>
<userListRepository> file://../var/users/james/ </usersListRepository>
<moderator> [EMAIL PROTECTED] </moderator>
...
</servlet>
<servlet match="[EMAIL PROTECTED]"
class="MiniListserv">
<listName> Town </listName>
<userListRepository> file://../var/users/town/ </usersListRepository>
<moderator> [EMAIL PROTECTED] </moderator>
...
</servlet>
Your mail will be splitted on first match and a Mail object with only
"[EMAIL PROTECTED]" as recipient will be send to the first mailet.
Since you are subscibed on that list the mailet will return the Mail with a
list of all subscibed as recipient and a footer added at the end of body.
The second mailet will receive a Mail with only
"match="[EMAIL PROTECTED]" as recipient but since
you're not in the list it will bouce back the mail to you with an error
message and return null.
The last recipient will not match any condition and so will reach the end of
the pipe where the last mailet will bounce it back to you.
So the only thing I'm asking to a mailet is to handle all recipient it
declare to be able to handle.
Is that so bad?
Federico
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/>
Problems?: [EMAIL PROTECTED]