Package org.jdesktop.swingx.action
Class ServerAction
java.lang.Object
javax.swing.AbstractAction
org.jdesktop.swingx.action.ServerAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action
An action which will invoke an http POST operation.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Loggerprivate static final Stringprivate static final Stringprivate static final StringFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsConstructorDescriptionServerAction(String name) ServerAction(String name, String command) ServerAction(String name, String command, Icon icon) ServerAction(String name, Icon icon) -
Method Summary
Modifier and TypeMethodDescriptionvoidInvokes the server operation when the action has been invoked.voidAdds a name value pair which represents a url connection request property.voidAdds a name value pair which represents a url parameter in an http POST request.private StringcreateMessage(int code, String msg) Creates a human readable message from the server code and message result.Return a set of parameter names or null if there are no paramsgetHeaderValue(String name) Return a header value corresponding to name or null if it doesn't exist.Return a set of parameter names or null if there are no paramsgetParamValue(String name) Return a parameter value corresponding to name or null if it doesn't exist.private StringRetrieves a string which represents the parameter data for a server action.getURL()private voidsetHeaders(Map<String, String> headers) private voidvoidSet the url for the action.Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
LOG
-
PARAMS
- See Also:
-
HEADERS
- See Also:
-
URL
- See Also:
-
URL_CACHE
- See Also:
-
-
Constructor Details
-
ServerAction
public ServerAction() -
ServerAction
-
ServerAction
- Parameters:
name- display name of the actioncommand- the value of the action command key
-
ServerAction
-
ServerAction
- Parameters:
name- display name of the actioncommand- the value of the action command keyicon- icon to display
-
-
Method Details
-
setURL
Set the url for the action.- Parameters:
url- a string representation of the url
-
getURL
-
getParams
-
setParams
-
addParam
Adds a name value pair which represents a url parameter in an http POST request. -
getParamValue
Return a parameter value corresponding to name or null if it doesn't exist. -
getParamNames
Return a set of parameter names or null if there are no params -
getHeaders
-
setHeaders
-
addHeader
Adds a name value pair which represents a url connection request property. For example, name could be "Content-Type" and the value could be "application/x-www-form-urlencoded" -
getHeaderValue
Return a header value corresponding to name or null if it doesn't exist. -
getHeaderNames
Return a set of parameter names or null if there are no params -
actionPerformed
Invokes the server operation when the action has been invoked. -
getPostData
Retrieves a string which represents the parameter data for a server action.- Returns:
- a string of name value pairs prefixed by a '?' and delimited by an 'invalid input: '&''
-
createMessage
Creates a human readable message from the server code and message result.- Parameters:
code- an http error code.msg- server message
-