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);
} catch (IOException e) {
throw new HandlerException(e);
}
response.setHeader(HeaderName.CONTENT_TYPE, "application/xhtml+xml");
response.setBody(pipedReader);
PrintWriter out = new PrintWriter(pipedOut);