[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit NodeUtils.java,1.10,1.11 WebRequest.java,
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-03-04 02:10:53
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv12045/src/com/meterware/httpunit
Modified Files:
NodeUtils.java WebRequest.java
Log Message:
Get ready for 1.4 release
Index: NodeUtils.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/NodeUtils.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NodeUtils.java 8 Jan 2002 23:21:53 -0000 1.10
+++ NodeUtils.java 4 Mar 2002 02:10:49 -0000 1.11
@@ -117,6 +117,7 @@
private static String convertNBSP( String text ) {
+ if (text == null) return "";
return text.replace( NBSP, ' ' );
}
Index: WebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- WebRequest.java 4 Feb 2002 22:33:55 -0000 1.39
+++ WebRequest.java 4 Mar 2002 02:10:50 -0000 1.40
@@ -47,6 +47,7 @@
**/
abstract
public class WebRequest {
+ private SubmitButton _button;
/**
* Sets the value of a header to be sent with this request. A header set here will override any matching header set
@@ -127,6 +128,19 @@
/**
+ * Specifies the click position for the submit button. When a user clioks on an image button, not only the name
+ * and value of the button, but also the position of the mouse at the time of the click is submitted with the form.
+ * This method allows the caller to override the position selected when this request was created.
+ *
+ * @exception IllegalRequestParameterException thrown if the request was not created from a form with an image button.
+ **/
+ public void setImageButtonClickPosition( int x, int y ) throws IllegalRequestParameterException {
+ if (_button == null) throw new IllegalButtonPositionException();
+ _parameterHolder.selectImageButtonPosition( _button, x, y );
+ }
+
+
+ /**
* Returns true if the specified parameter is a file field.
**/
public boolean isFileParameter( String name ) {
@@ -253,7 +267,8 @@
protected WebRequest( WebForm sourceForm, SubmitButton button, int x, int y ) {
this( sourceForm );
if (button != null && button.isImageButton() && button.getName().length() > 0) {
- _parameterHolder.selectImageButtonPosition( button, x, y );
+ _button = button;
+ _parameterHolder.selectImageButtonPosition( _button, x, y );
}
}
@@ -574,6 +589,26 @@
public String getMessage() {
return "The request does not use multipart/form-data encoding, and cannot be used to upload files ";
+ }
+
+}
+
+
+//============================= exception class IllegalButtonPositionException ======================================
+
+
+/**
+ * This exception is thrown on an attempt to set a file parameter in a form that does not specify MIME encoding.
+ **/
+class IllegalButtonPositionException extends IllegalRequestParameterException {
+
+
+ IllegalButtonPositionException() {
+ }
+
+
+ public String getMessage() {
+ return "The request was not created with an image button, and cannot accept an image button click position";
}
}
|