php.java.bridge
Class Options

java.lang.Object
  extended by php.java.bridge.Options
Direct Known Subclasses:
DefaultOptions, OldOptions, StandardOptions

public class Options
extends java.lang.Object

Exposes the request options. There is one Options instance for each request, but certain options may change for each packet. For example if a user calls java_set_file_encoding(enc), the new file encoding becomes available in the next packet.

Author:
jostb

Constructor Summary
Options()
           
 
Method Summary
 boolean base64Data()
          Return true if we must return a base 64 encoded string due to limitations in the client's XML parser.
 boolean canKeepAlive()
          Only for internal use
 void disableKeepAlive()
          Only for internal use
 byte[] getBytes(java.lang.String s)
          Return a byte array using the current file encoding (see java_set_file_encoding()).
 java.lang.String getEncoding()
          Returns the file encoding, see java_set_file_encoding().
 boolean hexNumbers()
          Returns always true unless the client hasn't sent a request header (for backward compatibility).
 boolean passContext()
          Return true, if the client cannot keep a back-pointer to its own data structures.
 boolean preferValues()
          Returns true when the bridge must destroy object identity (see PROTOCOL.TXT) due to limitations in the client (for PHP4 for example).
 boolean sendArraysAsValues()
          Returns true when the bridge must destroy array, Map, Collection identity (see PROTOCOL.TXT) due to limitations in the client (for PHP4 for example).
 void setEncoding(java.lang.String symbol)
          Set the new file encoding.
 void updateOptions(byte b)
          Update the current request options
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Options

public Options()
Method Detail

getEncoding

public java.lang.String getEncoding()
Returns the file encoding, see java_set_file_encoding(). This option may change for each packet.

Returns:
The file encoding

getBytes

public byte[] getBytes(java.lang.String s)
Return a byte array using the current file encoding (see java_set_file_encoding()).

Parameters:
s - The string
Returns:
The encoded bytes.

sendArraysAsValues

public boolean sendArraysAsValues()
Returns true when the bridge must destroy array, Map, Collection identity (see PROTOCOL.TXT) due to limitations in the client (for PHP4 for example). This option stays the same for all packets.

Returns:
the appropriate value from the request header.

preferValues

public boolean preferValues()
Returns true when the bridge must destroy object identity (see PROTOCOL.TXT) due to limitations in the client (for PHP4 for example). This option stays the same for all packets.

Returns:
the appropriate value from the request header.

hexNumbers

public boolean hexNumbers()
Returns always true unless the client hasn't sent a request header (for backward compatibility).

Returns:
true if the bridge should encode/decode exact numbers in hex.

disableKeepAlive

public void disableKeepAlive()
Only for internal use


canKeepAlive

public boolean canKeepAlive()
Only for internal use


setEncoding

public void setEncoding(java.lang.String symbol)
Set the new file encoding.

Parameters:
symbol - The new file encoding, for example "UTF-8".

updateOptions

public void updateOptions(byte b)
Update the current request options

Parameters:
b - The options from the request header.

base64Data

public boolean base64Data()
Return true if we must return a base 64 encoded string due to limitations in the client's XML parser. This option stays the same for all packets.

Returns:
true if the bridge must return strings as cdata, false otherwise.

passContext

public boolean passContext()
Return true, if the client cannot keep a back-pointer to its own data structures. This option stays the same for all packets.

Returns:
true if the bridge must accept and pass a context ID, false otherwise.