@Test public void exportXARForbidden() throws Exception { assertEquals("exception", this.action.render(this.oldcore.getXWikiContext())); assertEquals("needadminrights", this.oldcore.getXWikiContext().get("message")); }
@Override public String render(XWikiContext context) throws XWikiException { String defaultPage; try { XWikiRequest request = context.getRequest(); String format = request.get("format"); if ((format == null) || (format.equals("xar"))) { defaultPage = exportXAR(context); } else if (format.equals("html")) { defaultPage = exportHTML(context); } else { defaultPage = export(format, context); } } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_APP, XWikiException.ERROR_XWIKI_APP_EXPORT, "Exception while exporting", e); } return defaultPage; }
ExportAction extends XWikiAction { @Override public String render(XWikiContext context) throws XWikiException { String defaultPage; try { XWikiRequest request = context.getRequest(); String format = request.get("format"); if ((format == null) || (format.equals("xar"))) { defaultPage = exportXAR(context); } else if (format.equals("html")) { defaultPage = exportHTML(context); } else { defaultPage = export(format, context); } } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_APP, XWikiException.ERROR_XWIKI_APP_EXPORT, "Exception while exporting", e); } return defaultPage; } }
ExportAction extends XWikiAction { @Override public String render(XWikiContext context) throws XWikiException { String defaultPage; try { XWikiRequest request = context.getRequest(); String format = request.get("format"); if ((format == null) || (format.equals("xar"))) { defaultPage = exportXAR(context); } else if (format.equals("html")) { defaultPage = exportHTML(context); } else { defaultPage = export(format, context); } } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_APP, XWikiException.ERROR_XWIKI_APP_EXPORT, "Exception while exporting", e); } return defaultPage; }  }
ExportAction extends XWikiAction { @Override public String render(XWikiContext context) throws XWikiException { String defaultPage; try { XWikiRequest request = context.getRequest(); String format = request.get("format"); if ((format == null) || (format.equals("xar"))) { defaultPage = exportXAR(context); } else if (format.equals("html")) { defaultPage = exportHTML(context); } else { defaultPage = export(format, context); } } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_APP, XWikiException.ERROR_XWIKI_APP_EXPORT, "Exception while exporting", e); } return defaultPage; }  @Override String render(XWikiContext context); }
ExportAction extends XWikiAction { @Override public String render(XWikiContext context) throws XWikiException { String defaultPage; try { XWikiRequest request = context.getRequest(); String format = request.get("format"); if ((format == null) || (format.equals("xar"))) { defaultPage = exportXAR(context); } else if (format.equals("html")) { defaultPage = exportHTML(context); } else { defaultPage = export(format, context); } } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_APP, XWikiException.ERROR_XWIKI_APP_EXPORT, "Exception while exporting", e); } return defaultPage; }  @Override String render(XWikiContext context);  }