use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class RSSImageLinkTag method doWikiStartTag.
/**
* {@inheritDoc}
*/
@Override
public final int doWikiStartTag() throws IOException {
WikiEngine engine = m_wikiContext.getEngine();
JspWriter out = pageContext.getOut();
ResourceBundle rb = Preferences.getBundle(m_wikiContext, InternationalizationManager.CORE_BUNDLE);
if (engine.getRSSGenerator() != null && engine.getRSSGenerator().isEnabled()) {
if (RSSGenerator.MODE_FULL.equals(m_mode)) {
String rssURL = engine.getGlobalRSSURL();
if (rssURL != null) {
out.print("<a class=\"feed\" href=\"" + rssURL + "\"> </a>");
}
} else {
String page = m_pageName != null ? m_pageName : m_wikiContext.getPage().getName();
String params = "page=" + page + "&mode=" + m_mode;
out.print("<a href='" + m_wikiContext.getURL(WikiContext.NONE, "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.WikiEngine 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(HttpServletRequest req, AjaxServletContainer container) {
final WikiEngine e = WikiEngine.getInstance(req.getSession().getServletContext(), null);
boolean valid = false;
if (container != null) {
valid = e.getAuthorizationManager().checkPermission(WikiSession.getWikiSession(e, req), container.permission);
}
return valid;
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class JDBCGroupDatabaseTest method setUp.
/**
*/
@Before
public void setUp() throws Exception {
m_hu.setUp();
Properties props = TestEngine.getTestProperties();
WikiEngine engine = new TestEngine(props);
m_wiki = engine.getApplicationName();
// Set up the mock JNDI initial context
TestJNDIContext.initialize();
Context initCtx = new InitialContext();
try {
initCtx.bind("java:comp/env", new TestJNDIContext());
} catch (NameAlreadyBoundException e) {
// ignore
}
Context ctx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = new TestJDBCDataSource(new File("target/test-classes/jspwiki-custom.properties"));
ctx.bind(JDBCGroupDatabase.DEFAULT_GROUPDB_DATASOURCE, ds);
try {
m_conn = ds.getConnection();
} catch (SQLException e) {
Assert.fail("Looks like your database could not be connected to - " + "please make sure that you have started your database, exception: " + e.getMessage());
}
// Initialize the user database
m_db = new JDBCGroupDatabase();
m_db.initialize(engine, new Properties());
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class XMLGroupDatabaseTest method setUp.
/**
*/
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
WikiEngine engine = new TestEngine(props);
m_db = new XMLGroupDatabase();
m_db.initialize(engine, props);
m_wiki = engine.getApplicationName();
}
use of org.apache.wiki.WikiEngine in project jspwiki by apache.
the class XMLUserDatabaseTest method setUp.
/**
*/
@Before
public void setUp() throws Exception {
Properties props = TestEngine.getTestProperties();
props.put(XMLUserDatabase.PROP_USERDATABASE, "target/test-classes/userdatabase.xml");
WikiEngine engine = new TestEngine(props);
m_db = new XMLUserDatabase();
m_db.initialize(engine, props);
}
Aggregations