Search in sources :

Example 1 with WikiToCPResource

use of org.olat.modules.wiki.WikiToCPResource in project OpenOLAT by OpenOLAT.

the class WikiWebServiceHelper method serve.

/**
 * exports the wiki-Resource and serves the zip file. The given
 * OLATResourceable can be the repository-entry of the wiki or the
 * businessGroup (if it is a group-wiki)
 *
 * @param wikiResource
 * @param request
 * @param response
 * @return
 */
public static Response serve(OLATResourceable wikiResource, HttpServletRequest request, HttpServletResponse response) {
    Identity ident = RestSecurityHelper.getIdentity(request);
    Translator translator = Util.createPackageTranslator(WikiMainController.class, new Locale(ident.getUser().getPreferences().getLanguage()));
    // make mediaResource
    MediaResource cpMediaResource = new WikiToCPResource(wikiResource, ident, translator);
    // use servletUtil, so file gets deleted afterwards
    ServletUtil.serveResource(request, response, cpMediaResource);
    return Response.ok().build();
}
Also used : Locale(java.util.Locale) WikiToCPResource(org.olat.modules.wiki.WikiToCPResource) Translator(org.olat.core.gui.translator.Translator) MediaResource(org.olat.core.gui.media.MediaResource) Identity(org.olat.core.id.Identity)

Example 2 with WikiToCPResource

use of org.olat.modules.wiki.WikiToCPResource in project openolat by klemens.

the class WikiWebServiceHelper method serve.

/**
 * exports the wiki-Resource and serves the zip file. The given
 * OLATResourceable can be the repository-entry of the wiki or the
 * businessGroup (if it is a group-wiki)
 *
 * @param wikiResource
 * @param request
 * @param response
 * @return
 */
public static Response serve(OLATResourceable wikiResource, HttpServletRequest request, HttpServletResponse response) {
    Identity ident = RestSecurityHelper.getIdentity(request);
    Translator translator = Util.createPackageTranslator(WikiMainController.class, new Locale(ident.getUser().getPreferences().getLanguage()));
    // make mediaResource
    MediaResource cpMediaResource = new WikiToCPResource(wikiResource, ident, translator);
    // use servletUtil, so file gets deleted afterwards
    ServletUtil.serveResource(request, response, cpMediaResource);
    return Response.ok().build();
}
Also used : Locale(java.util.Locale) WikiToCPResource(org.olat.modules.wiki.WikiToCPResource) Translator(org.olat.core.gui.translator.Translator) MediaResource(org.olat.core.gui.media.MediaResource) Identity(org.olat.core.id.Identity)

Aggregations

Locale (java.util.Locale)2 MediaResource (org.olat.core.gui.media.MediaResource)2 Translator (org.olat.core.gui.translator.Translator)2 Identity (org.olat.core.id.Identity)2 WikiToCPResource (org.olat.modules.wiki.WikiToCPResource)2