use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class SearchResultIteratorTag method nextResult.
private int nextResult() {
if (m_iterator != null && m_iterator.hasNext() && m_count++ < m_maxItems) {
SearchResult r = (SearchResult) m_iterator.next();
// Create a wiki context for the result
WikiEngine engine = m_wikiContext.getEngine();
HttpServletRequest request = m_wikiContext.getHttpRequest();
Command command = PageCommand.VIEW.targetedCommand(r.getPage());
WikiContext context = new WikiContext(engine, request, command);
// Stash it in the page context
pageContext.setAttribute(WikiTagBase.ATTR_CONTEXT, context, PageContext.REQUEST_SCOPE);
pageContext.setAttribute(getId(), r);
return EVAL_BODY_BUFFERED;
}
return SKIP_BODY;
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class NoSuchPageTag method doWikiStartTag.
public int doWikiStartTag() throws IOException, ProviderException {
WikiEngine engine = m_wikiContext.getEngine();
WikiPage page;
if (m_pageName == null) {
page = m_wikiContext.getPage();
} else {
page = engine.getPage(m_pageName);
}
if (page != null && engine.pageExists(page.getName(), page.getVersion())) {
return SKIP_BODY;
}
return EVAL_BODY_INCLUDE;
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class PageInfoLinkTag method doWikiStartTag.
public final int doWikiStartTag() throws IOException {
WikiEngine engine = m_wikiContext.getEngine();
String pageName = m_pageName;
if (m_pageName == null) {
WikiPage p = m_wikiContext.getPage();
if (p != null) {
pageName = p.getName();
} else {
return SKIP_BODY;
}
}
if (engine.pageExists(pageName)) {
JspWriter out = pageContext.getOut();
String url = m_wikiContext.getURL(WikiContext.INFO, pageName);
switch(m_format) {
case ANCHOR:
out.print("<a class=\"pageinfo\" href=\"" + url + "\" accesskey=\"" + m_accesskey + "\" title=\"" + m_title + "\">");
break;
case URL:
out.print(url);
break;
}
return EVAL_BODY_INCLUDE;
}
return SKIP_BODY;
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class PageNameTag method doWikiStartTag.
public final int doWikiStartTag() throws IOException {
WikiEngine engine = m_wikiContext.getEngine();
WikiPage page = m_wikiContext.getPage();
if (page != null) {
if (page instanceof Attachment) {
pageContext.getOut().print(((Attachment) page).getFileName());
} else {
pageContext.getOut().print(engine.beautifyTitle(m_wikiContext.getName()));
}
}
return SKIP_BODY;
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class PageSizeTag method doWikiStartTag.
public final int doWikiStartTag() throws IOException {
WikiEngine engine = m_wikiContext.getEngine();
WikiPage page = m_wikiContext.getPage();
try {
if (page != null) {
long size = page.getSize();
if (// should never happen with attachments
size == -1 && engine.pageExists(page)) {
size = engine.getPureText(page.getName(), page.getVersion()).length();
page.setSize(size);
}
pageContext.getOut().write(Long.toString(size));
}
} catch (ProviderException e) {
log.warn("Providers did not work: ", e);
pageContext.getOut().write("Error determining page size: " + e.getMessage());
}
return SKIP_BODY;
}
Aggregations