use of com.developmentontheedge.be5.model.jsonapi.ErrorModel in project be5 by DevelopmentOnTheEdge.
the class StaticPageComponent method generate.
@Override
public void generate(Request req, Response res, Injector injector) {
String language = UserInfoHolder.getLanguage();
String page = req.getRequestUri();
String staticPageContent = injector.getProject().getStaticPageContent(language, page);
if (staticPageContent == null) {
// todo localize
res.sendErrorAsJson(new ErrorModel("500", ErrorTitles.formatTitle(Be5ErrorCode.NOT_FOUND, page), Collections.singletonMap(SELF_LINK, "static/" + page)), req.getDefaultMeta());
} else {
res.sendAsJson(new ResourceData(STATIC_ACTION, new StaticPagePresentation("", staticPageContent), Collections.singletonMap(SELF_LINK, "static/" + page)), req.getDefaultMeta());
}
}
Aggregations