Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.i2p.router.web
Class FormHandler

    java.lang.Object
      net.i2p.router.web.FormHandler

Direct Known Subclasses:
  ConfigAdvancedHandler, ConfigClientsHandler, ConfigKeyringHandler, ConfigLoggingHandler, ConfigNetHandler, ConfigPeerHandler, ConfigServiceHandler, ConfigStatsHandler, ConfigTunnelsHandler, ConfigUIHandler, ConfigUpdateHandler

    public class FormHandler

extends Object

Simple form handler base class - does not depend on servlets or jsp, but instead the subclasses are populated with javabean properties. e.g. The form is "processed" after the properties are set and the first output property is retrieved - either getAll(), getNotices() or getErrors().

Field Summary
`protected String` | `_action`
`protected RouterContext` | `_context`
`protected Log` | `_log`
`protected String` | `_passphrase`

Constructor Summary
`FormHandler()`

Method Summary
`String` | `_(String s)` translate a string
`String` | `_(String s, Object o)` translate a string with a parameter This is a lot more expensive than _(s), so use sparingly.
`protected void` | `addFormError(String errorMsg)` Add an error message to display
`protected void` | `addFormNotice(String msg)` Add a non-error message to display
`String` | `getAllMessages()` Display everything, wrap it in a div for consistent presentation
`String` | `getErrors()` Display any error messages (processing the form if it hasn't been yet)
`String` | `getNotices()` Display any non-error messages (processing the form if it hasn't been yet)
`protected void` | `processForm()` Override this to perform the final processing (in turn, adding formNotice and formError messages, etc)
`void` | `setAction(String val)`
`void` | `setContextId(String contextId)` Configure this bean to query a particular router context
`void` | `setNonce(String val)`
`void` | `setPassphrase(String val)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _context

    protected RouterContext _context

### _log

    protected Log _log

### _action

    protected String _action

### _passphrase

    protected String _passphrase

Constructor Detail

### FormHandler

    public FormHandler()

Method Detail

### setContextId

    public void setContextId(String contextId)

  Configure this bean to query a particular router context

  Parameters:
    `contextId` - begging few characters of the routerHash, or null to pick the first one we come across.

### setNonce

    public void setNonce(String val)

### setAction

    public void setAction(String val)

### setPassphrase

    public void setPassphrase(String val)

### processForm

    protected void processForm()

  Override this to perform the final processing (in turn, adding formNotice and formError messages, etc)

### addFormError

    protected void addFormError(String errorMsg)

  Add an error message to display

### addFormNotice

    protected void addFormNotice(String msg)

  Add a non-error message to display

### getAllMessages

    public String getAllMessages()

  Display everything, wrap it in a div for consistent presentation

### getErrors

    public String getErrors()

  Display any error messages (processing the form if it hasn't been yet)

### getNotices

    public String getNotices()

  Display any non-error messages (processing the form if it hasn't been yet)

### _

    public String _(String s)

  translate a string

### _

    public String _(String s,
                    Object o)

  translate a string with a parameter This is a lot more expensive than _(s), so use sparingly.

  Parameters:
    `s` - string to be translated containing {0} The {0} will be replaced by the parameter. Single quotes must be doubled, i.e. ' -> '' in the string.
    `o` - parameter, not translated. To tranlslate parameter also, use _("foo {0} bar", _("baz")) Do not double the single quotes in the parameter. Use autoboxing to call with ints, longs, floats, etc.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD