2009-01-29 02:16:18 +00:00
|
|
|
package net.i2p.router.web;
|
|
|
|
|
|
|
|
import java.io.Writer;
|
|
|
|
|
|
|
|
import net.i2p.router.RouterContext;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base helper
|
|
|
|
*/
|
|
|
|
public abstract class HelperBase {
|
|
|
|
protected RouterContext _context;
|
|
|
|
protected Writer _out;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configure this bean to query a particular router context
|
|
|
|
*
|
2009-08-14 01:52:47 +00:00
|
|
|
* @param contextId beginning few characters of the routerHash, or null to pick
|
2009-01-29 02:16:18 +00:00
|
|
|
* the first one we come across.
|
|
|
|
*/
|
|
|
|
public void setContextId(String contextId) {
|
|
|
|
try {
|
|
|
|
_context = ContextHelper.getContext(contextId);
|
|
|
|
} catch (Throwable t) {
|
|
|
|
t.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-14 01:52:47 +00:00
|
|
|
/** might be useful in the jsp's */
|
|
|
|
//public RouterContext getContext() { return _context; }
|
|
|
|
|
2009-01-29 02:16:18 +00:00
|
|
|
public void setWriter(Writer out) { _out = out; }
|
2009-10-18 14:06:07 +00:00
|
|
|
|
|
|
|
/** translate a string */
|
|
|
|
public String _(String s) {
|
|
|
|
return Messages.getString(s, _context);
|
|
|
|
}
|
2009-01-29 02:16:18 +00:00
|
|
|
}
|