📄 goeventinstance.java
字号:
/*
* j2wap is distributed under the terms of the GNU Public License
*
* j2wap was written by:
*
* Scott Campbell
* Michael Nordling
* Karl Maftoum
* Julian Bright
*
* This was a final project for Comp.Engineering at the University of Canberra, Australia
*
* Now released as Open Source software. 28 November 2000
*
* Email: k_maftoum@hotmail.com for more info
*
* Use entirely at your own risk.
*/
package wae;
import java.util.Stack;
/**
* A storage class for a GO event used by EventManagement.<br>
* Company: J2wap.com
* @author Julian Bright, Scott Campbell.
* @version 1.1
*/
public class GoEventInstance extends EventInstance
{
/** SendReferer flag for URL */
private boolean c_bolSendReferer;
/** Method for URL */
private String c_clsStrMethod;
/** Encoding type for URL */
private String c_clsStrEncType;
/** Stack for Post variables */
private Stack c_clsPostStack;
/**
* Constructor calls the super's constructor and initialises postfield stack.
* @param EventType To initialize the object (should allways be 1)
*/
public GoEventInstance (int in_intEventType)
{
super(in_intEventType);
c_clsPostStack = new Stack();
}
/**
* Returns the method type for the URL operation.
* @return The method type:
* <ul>
* <li>GET
* <li>POST
* </ul>
*/
public String getMethod ()
{
return c_clsStrMethod;
}
/**
* Set attributes on the GO event
* @param in_strURL The URL for go event. <i>(Pre-condition: URL != null)</i>
* @param in_bolSendReferer Boolean indicating whether to send the referer. (Not used)
* @param in_strMethod The method type (GET/POST)
* @param in_strEncType Determines the Encoding type for data retrived. (Not used)
*/
public void setAttributes (String in_strURL,
boolean in_bolSendReferer,
String in_strMethod,
String in_strEncType)
{
in_bolSendReferer = c_bolSendReferer;
// Apply defaults if a parameter is null.
if (in_strURL != null)
setURL (in_strURL);
if (in_strMethod == null)
c_clsStrMethod = "GET";
else
c_clsStrMethod = new String(in_strMethod);
if (in_strEncType == null)
c_clsStrEncType = "application/x-www-form-urlencoded";
else
c_clsStrEncType = new String(in_strEncType);
} // setAttributes
/**
* Adds a postfield to the internal store.
* @param in_strName The name of the new postfield.
* @param in_strValue The value associated with the name.
*/
public void addPostfield(String in_strName, String in_strValue)
{
c_clsPostStack.push(in_strValue);
c_clsPostStack.push(in_strName);
} // addPostfield
/**
* Build up postfield string.
* @param in_clsBrowserContext The Browser Context reference.
* @return Postfield string.
*/
public String getPostfieldStr(BrowserContext in_clsBrowserContext)
{
String strName;
String strVal;
StringBuffer strBPost = new StringBuffer("?");
while (!c_clsPostStack.empty())
{
strName = (String)c_clsPostStack.pop();
strVal = (String)c_clsPostStack.pop();
// Add to the postfield string.
strBPost.append(strName + strVal + '&');
} // while
// Remove the last '&' or '?' if no postfields.
strBPost.deleteCharAt(strBPost.length()-1);
return strBPost.toString();
} // getPostfieldStr
} // class goEventInstance
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -