use of org.apache.wiki.api.core.Engine in project jspwiki by apache.
the class RSSImageLinkTag method doWikiStartTag.
/**
* {@inheritDoc}
*/
@Override
public final int doWikiStartTag() throws IOException {
final Engine engine = m_wikiContext.getEngine();
final JspWriter out = pageContext.getOut();
final ResourceBundle rb = Preferences.getBundle(m_wikiContext, InternationalizationManager.CORE_BUNDLE);
if (engine.getManager(RSSGenerator.class) != null && engine.getManager(RSSGenerator.class).isEnabled()) {
if (RSSGenerator.MODE_FULL.equals(m_mode)) {
final String rssURL = engine.getGlobalRSSURL();
if (rssURL != null) {
out.print("<a class=\"feed\" href=\"" + rssURL);
out.print(" title='" + rb.getString("rss.title.full") + "'>");
out.print(" </a> ");
}
} else {
final String page = m_pageName != null ? m_pageName : m_wikiContext.getPage().getName();
final String params = "page=" + page + "&mode=" + m_mode;
out.print("<a href='" + m_wikiContext.getURL(ContextEnum.PAGE_NONE.getRequestContext(), "rss.jsp", params));
out.print("' class='feed'");
out.print(" title='" + MessageFormat.format(rb.getString("rss.title"), page) + "'>");
out.print(" </a> ");
}
}
return SKIP_BODY;
}
use of org.apache.wiki.api.core.Engine in project jspwiki by apache.
the class ContentEncodingTag method doWikiStartTag.
/**
* {@inheritDoc}
*/
@Override
public final int doWikiStartTag() throws IOException {
final Engine engine = m_wikiContext.getEngine();
pageContext.getOut().print(engine.getContentEncoding());
return SKIP_BODY;
}
use of org.apache.wiki.api.core.Engine in project jspwiki by apache.
the class SearchResultIteratorTag method nextResult.
private int nextResult() {
if (m_iterator != null && m_iterator.hasNext() && m_count++ < m_maxItems) {
final SearchResult r = (SearchResult) m_iterator.next();
// Create a wiki context for the result
final Engine engine = m_wikiContext.getEngine();
final HttpServletRequest request = m_wikiContext.getHttpRequest();
final Command command = PageCommand.VIEW.targetedCommand(r.getPage());
final Context context = Wiki.context().create(engine, request, command);
// Stash it in the page context
pageContext.setAttribute(Context.ATTR_CONTEXT, context, PageContext.REQUEST_SCOPE);
pageContext.setAttribute(getId(), r);
return EVAL_BODY_BUFFERED;
}
return SKIP_BODY;
}
use of org.apache.wiki.api.core.Engine in project jspwiki by apache.
the class PageNameTag method doWikiStartTag.
@Override
public final int doWikiStartTag() throws IOException {
final Engine engine = m_wikiContext.getEngine();
final Page page = m_wikiContext.getPage();
if (page != null) {
if (page instanceof Attachment) {
pageContext.getOut().print(TextUtil.replaceEntities(((Attachment) page).getFileName()));
} else {
pageContext.getOut().print(engine.getManager(RenderingManager.class).beautifyTitle(m_wikiContext.getName()));
}
}
return SKIP_BODY;
}
use of org.apache.wiki.api.core.Engine in project jspwiki by apache.
the class WikiAjaxDispatcherServlet method validatePermission.
/**
* Validate the permission of the {@link WikiAjaxServlet} using the {@link AuthorizationManager#checkPermission}
*
* @param req the servlet request
* @param container the container info of the servlet
* @return true if permission is valid
*/
private boolean validatePermission(final HttpServletRequest req, final AjaxServletContainer container) {
final Engine e = Wiki.engine().find(req.getSession().getServletContext(), null);
boolean valid = false;
if (container != null) {
valid = e.getManager(AuthorizationManager.class).checkPermission(Wiki.session().find(e, req), container.permission);
}
return valid;
}
Aggregations