Continue structural port from Spring Boot to Undertow
- Notification template generator - Add tests for email notification handler
This commit is contained in:
@@ -27,11 +27,16 @@ import io.kamax.mxisd.config.threepid.medium.GenericTemplateConfig;
|
||||
import io.kamax.mxisd.exception.InternalServerError;
|
||||
import io.kamax.mxisd.invitation.IThreePidInviteReply;
|
||||
import io.kamax.mxisd.threepid.session.IThreePidSession;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public abstract class GenericTemplateNotificationGenerator extends PlaceholderNotificationGenerator implements NotificationGenerator {
|
||||
|
||||
@@ -46,13 +51,14 @@ public abstract class GenericTemplateNotificationGenerator extends PlaceholderNo
|
||||
|
||||
private String getTemplateContent(String location) {
|
||||
try {
|
||||
// FIXME make it work again
|
||||
/*
|
||||
InputStream is = StringUtils.startsWith(location, "classpath:") ?
|
||||
app.getResource(location).getInputStream() : new FileInputStream(location);
|
||||
URI loc = URI.create(location);
|
||||
InputStream is;
|
||||
if (StringUtils.equals("classpath", loc.getScheme())) {
|
||||
is = getClass().getResourceAsStream(loc.getSchemeSpecificPart());
|
||||
} else {
|
||||
is = new FileInputStream(location);
|
||||
}
|
||||
return IOUtils.toString(is, StandardCharsets.UTF_8);
|
||||
*/
|
||||
throw new IOException("Not implemented!");
|
||||
} catch (IOException e) {
|
||||
throw new InternalServerError("Unable to read template content at " + location + ": " + e.getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user