java.lang.Object
net.i2p.router.web.FormHandler
net.i2p.router.web.helpers.ConfigLoggingHandler
Handler to deal with form submissions from the logging config form and act upon the values.
Nested Class Summary
Nested classes/interfaces inherited from class FormHandler
FormHandler.MessageModifier and TypeClassDescriptionstatic classMessage class to encapsulate the message text and the canClose flag.Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe date format from the form.private StringThe default log level from the form.private StringThe log file size from the form.private StringThe log levels from the form.private booleanTrue to compress the log files.private StringThe class of a new log.private StringThe level of a new log.private StringThe record format from the form.private booleanTrue if the form is to be saved.Fields inherited from class FormHandler
_action, _context, _log, _method, _out, _requestWrapper, _session, _settingsModifier and TypeFieldDescriptionprotected StringForm action.protected RouterContextRouter context.protected LogClass logger.protected StringRequest method.protected WriterOutput writer.protected RequestWrapperOnly for multipart/form-data.protected HttpSessionHTTP session for nonce validation.protected MapNot for multipart/form-data, will be null.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprotected voidImplement this to perform the final processing (in turn, adding formNotice and formError messages, etc)private voidThe user made changes to the config and wants to save them, so lets go ahead and do so.voidsetDefaultloglevel(String level) The default log level.voidThe log levels configuration string.voidsetLogcompress(String foo) Set whether to compress log files.voidsetLogdateformat(String format) The log date format pattern.voidsetLogfilesize(String size) The log file size limit.voidsetLogformat(String format) The log record format.voidSet a new class name for log level override.voidSet the log level for a new class override.voidsetShouldsave(String moo) Whether to save the configuration.Methods inherited from class FormHandler
_t, _t, _t, _x, addFormError, addFormError, addFormErrorNoEscape, addFormErrorNoEscape, addFormNotice, addFormNotice, addFormNoticeNoEscape, addFormNoticeNoEscape, getAllMessages, getErrors, getJettyString, getNotices, isAdvanced, resolveEffectiveAction, setAction, setContextId, setNonce, setRequestWrapper, setSettings, storeMethod, storeSession, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter This is a lot more expensive than _t(s), so use sparingly.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected voidaddFormError(String errorMsg) Add an error message to display Use if it does not include a link.protected voidaddFormError(String errorMsg, boolean canClose) Add an error message to display Use if it does not include a link.protected voidAdd an error message to display Use if it includes a link or other formatting.protected voidaddFormErrorNoEscape(String msg, boolean canClose) Add an error message to display Use if it includes a link or other formatting.protected voidaddFormNotice(String msg) Add a non-error message to display Use if it does not include a link.protected voidaddFormNotice(String msg, boolean canClose) Add a non-error message to display Use if it does not include a link.protected voidAdd a non-error message to display Use if it includes a link or other formatting.protected voidaddFormNoticeNoEscape(String msg, boolean canClose) Add a non-error message to display Use if it includes a link or other formatting.Display everything, wrap it in a div for consistent presentation.Display any error messages (processing the form if it hasn't been yet).protected StringgetJettyString(String key) FormHandler.setSettings(Map)must have been called previously Curses Jetty for returning arrays.Display any non-error messages (processing the form if it hasn't been yet).booleanSame as HelperBase.static StringresolveEffectiveAction(String action, Map<?, ?> settings) Resolve which operation the user actually requested.voidAction value.voidsetContextId(String contextId) Configure this bean to query a particular router context.voidNonce value.voidOnly set by formhandler.jsi for multipart/form-data.voidsetSettings(Map settings) For many forms, it's easiest just to put all the parameters here.voidstoreMethod(String val) Call this to prevent changes using GET.voidstoreSession(HttpSession session) For nonce validation.voidstoreWriter(Writer out) Store the output writer for inline form processing.
Field Details
_shouldSave
private boolean _shouldSaveTrue if the form is to be saved._levels
The log levels from the form._defaultLevel
The default log level from the form._recordFormat
The record format from the form._dateFormat
The date format from the form._fileSize
The log file size from the form._newLogClass
The class of a new log._newLogLevel
The level of a new log._logCompress
private boolean _logCompressTrue to compress the log files.
Constructor Details
ConfigLoggingHandler
public ConfigLoggingHandler()Handler for logging configuration form submissions.
Method Details
processForm
protected void processForm()Description copied from class:FormHandlerImplement this to perform the final processing (in turn, adding formNotice and formError messages, etc)Will only be called if _action is non-null and the nonce is valid.
- Specified by:
processFormin classFormHandler
setShouldsave
Whether to save the configuration.- Parameters:
moo- submitted form value; only its presence matters, the text is ignored
setLevels
The log levels configuration string.- Parameters:
levels- submitted level string, trimmed, null if the field was empty
setDefaultloglevel
The default log level.- Parameters:
level- submitted default level, trimmed, null if the field was empty
setLogformat
The log record format.- Parameters:
format- submitted record format pattern, trimmed, null if the field was empty
setLogdateformat
The log date format pattern.- Parameters:
format- submitted date format pattern, trimmed, null if the field was empty
setLogfilesize
The log file size limit.- Parameters:
size- submitted file size limit, trimmed, null if the field was empty
setLogcompress
Set whether to compress log files.- Parameters:
foo- the submitted value, ignored; compression is always enabled
setNewlogclass
Set a new class name for log level override.- Parameters:
s- the class name
setNewloglevel
Set the log level for a new class override.- Parameters:
s- the log level
saveChanges
private void saveChanges()The user made changes to the config and wants to save them, so lets go ahead and do so.