SEPIA Documentation
  • Setup
    • Eclipse Project Setup
  • Running Sepia
    • Adding a Map
    • Running Resource Collection Agent Example
    • Manual Control
  • Your First Agent
    • Create the Class
    • Setup the Configuration
    • Basic Agent API
    • Actions
    • Moving Your Units
    • Collecting Resources
    • Building Units
    • Summary
  • Combat Agents
    • Setting up the Combat Agent
    • Attacking the Enemy
  • Javadoc
    • edu.cwru.sepia
    • edu.cwru.sepia.action
    • edu.cwru.sepia.agent
    • edu.cwru.sepia.agent.visual
    • edu.cwru.sepia.agent.visual.editor
    • edu.cwru.sepia.environment
    • edu.cwru.sepia.environment.model
    • edu.cwru.sepia.environment.model.history
    • edu.cwru.sepia.environment.model.persistence
    • edu.cwru.sepia.environment.model.persistence.generated
    • edu.cwru.sepia.environment.model.state
    • edu.cwru.sepia.experiment
    • edu.cwru.sepia.start
    • edu.cwru.sepia.util
    • edu.cwru.sepia.util.config.xml
    • matlabcontrol
    • matlabcontrol.extensions
    • matlabcontrol.internal
    • org.json
 
SEPIA Documentation
  • Docs »
  • Javadoc »
  • org.json »
  • Cookie
  • View page source

Cookie¶

public class Cookie¶

Convert a web browser cookie specification to a JSONObject and back. JSON and Cookies are both notations for name/value pairs.

Author:JSON.org

Methods¶

escape¶

public static String escape(String string)¶

Produce a copy of a string in which the characters ‘+’, ‘%’, ‘=’, ‘;’ and control characters are replaced with “%hh”. This is a gentle form of URL encoding, attempting to cause as little distortion to the string as possible. The characters ‘=’ and ‘;’ are meta characters in cookies. By convention, they are escaped using the URL-encoding. This is only a convention, not a standard. Often, cookies are expected to have encoded values. We encode ‘=’ and ‘;’ because we must. We encode ‘%’ and ‘+’ because they are meta characters in URL encoding.

Parameters:
  • string – The source string.
Returns:

The escaped result.

toJSONObject¶

public static JSONObject toJSONObject(String string)¶

Convert a cookie specification string into a JSONObject. The string will contain a name value pair separated by ‘=’. The name and the value will be unescaped, possibly converting ‘+’ and ‘%’ sequences. The cookie properties may follow, separated by ‘;’, also represented as name=value (except the secure property, which does not have a value). The name will be stored under the key “name”, and the value will be stored under the key “value”. This method does not do checking or validation of the parameters. It only converts the cookie string into a JSONObject.

Parameters:
  • string – The cookie specification string.
Throws:
  • JSONException –
Returns:

A JSONObject containing “name”, “value”, and possibly other members.

toString¶

public static String toString(JSONObject jo)¶

Convert a JSONObject into a cookie specification string. The JSONObject must contain “name” and “value” members. If the JSONObject contains “expires”, “domain”, “path”, or “secure” members, they will be appended to the cookie specification string. All other members are ignored.

Parameters:
  • jo – A JSONObject
Throws:
  • JSONException –
Returns:

A cookie specification string

unescape¶

public static String unescape(String string)¶

Convert %hh sequences to single characters, and convert plus to space.

Parameters:
  • string – A string that may contain + (plus) and %hh sequences.
Returns:

The unescaped string.

Next Previous

© Copyright .

Sphinx theme provided by Read the Docs