java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.StatHelper
Helper for statistics page rendering and form processing.
Field Summary
FieldsFields inherited from class HelperBase
_context, _log, _out, CHECKED, PROP_ADVANCED, SELECTEDModifier and TypeFieldDescriptionprotected RouterContextThe router context.protected LogThe log instance.protected WriterThe writer for output.static final StringChecked attribute for HTML checkboxes.static final StringProperty key for advanced mode.static final StringSelected attribute for HTML select options.Constructor Summary
ConstructorsConstructorDescriptionNo peer selected, no filter, and no export format; the setters below fill those in from the form parameters before anything is rendered.Method Summary
Modifier and TypeMethodDescriptionprivate StringdumpProfile(Hash peer) Dump the profile.Export data as CSV or XML.Retrieve peer profile or stats based on usage.getStats()Get stats page as string or write to output stream.private StringLook up based on the full b64 - efficient.voidExport format (csv or xml).voidSet full flag for stats generation.voidCaller should strip HTML (XSS).voidsetStatFilter(String filter) Optional stat name filter (substring match, case-insensitive).Methods inherited from class HelperBase
_t, _t, _t, _x, getChecked, isAdvanced, ngettext, setContextId, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected StringgetChecked(String prop) Get the checked attribute for a boolean property.booleanCheck if advanced mode is enabled.Translate a string with plural forms (ngettext).voidsetContextId(String contextId) Configure this bean to query a particular router context.voidstoreWriter(Writer out) Store the writer for output.
Field Details
_peer
Peer whose stats are shown, if filtered._full
private boolean _fullTrue to show every stat, not just the summary._statFilter
Only stats containing this are shown._export
Format asked for when exporting the stats.
Constructor Details
StatHelper
public StatHelper()No peer selected, no filter, and no export format; the setters below fill those in from the form parameters before anything is rendered.
Method Details
setPeer
Caller should strip HTML (XSS).- Parameters:
peer- the base64 hash selecting a single peer to report on, or null to report on all peers
setFull
Set full flag for stats generation.- Parameters:
f- any non-empty value to generate the full stat set; null or empty leaves the flag off
setStatFilter
Optional stat name filter (substring match, case-insensitive). Only stats whose name contains this string will be rendered.- Parameters:
filter- the case-insensitive substring that stat names must contain to be rendered; null or empty clears the filter
setExport
Export format (csv or xml).- Parameters:
export- the requested format, accepted only as "csv" or "xml"; any other value leaves the export unset
getExportData
getProfile
Retrieve peer profile or stats based on usage.- Returns:
- the HTML for the requested peer's profile: the "No peer specified" notice if none was given, the full profile for a complete destination hash, the first profile whose hash starts with the given prefix, or a "Peer profile unavailable" message
getStats
Get stats page as string or write to output stream.- Returns:
- the rendered stats page, or an empty string when an output stream was supplied and the page was written there instead; an error message if generation failed
outputProfile
Look up based on the full b64 - efficient.- Returns:
- the dumped profile, or an error message for a bad peer hash
dumpProfile