* org.wymiwyg.rwcf.Response, org.wymiwyg.rwcf.HandlerChain)
*/
public void handle(Request request, Response response, HandlerChain chain)
throws HandlerException {
EnhancedRequest ehRequest = new EnhancedRequest(request);
MultiPartBody body = (MultiPartBody) request.getBody();
String itemURIString = body.getParameter("item");
// since this doesn't read, I assume it need no read-lock
Resource item = model.createResource(itemURIString);
String recipientURIStrings[] = body.getParameterValues("recipient");
if (recipientURIStrings == null) {
throw new HandlerException("A recipient must be specified");
}
AcceptLanguagesIterator acceptedLanguages = ehRequest.getAcceptLanguages();
InternetAddress fromAddress;
String fromString = body.getParameter("from");
if ((fromString != null) && (!fromString.equals(""))) {
try {
fromAddress = getIntenetAddress(model.createResource(fromString));
} catch (AddressException e) {
throw new HandlerException("Couldn't get address", e);
}
} else {
try {
fromAddress = getDefaultAddress(model);
} catch (AddressException e) {
throw new HandlerException("Couldn't get default address", e);
}
}
sendItem(item, fromAddress, recipientURIStrings, acceptedLanguages,
ehRequest.getRootURL(), hashStore);
PipedWriter pipedOut = new PipedWriter();
PipedReader pipedReader;
try {
pipedReader = new PipedReader(pipedOut);