UncheckedParameterHolder( WebRequestSource source ) { _characterSet = source.getCharacterSet(); _submitAsMime = source.isSubmitAsMime(); try { source.recordPredefinedParameters( this ); source.recordParameters( this ); } catch (IOException e) { throw new RuntimeException( "This should never happen" ); } }
/** * Returns the multiple default values of the named parameter. **/ public String[] getParameterValues( String name ) { return _parameterHolder.getParameterValues( name ); }
/** * Returns true if the specified parameter is a file field. **/ public boolean isFileParameter( String name ) { return _parameterHolder.isFileParameter( name ); }
/** * Returns an array of all parameter names defined as part of this web request. * @since 1.3.1 **/ public String[] getRequestParameterNames() { final HashSet names = new HashSet(); ParameterProcessor pp = new ParameterProcessor() { public void addParameter( String name, String value, String characterSet ) throws IOException { names.add( name ); } public void addFile( String parameterName, UploadFileSpec fileSpec ) throws IOException { names.add( parameterName ); } }; try { _parameterHolder.recordPredefinedParameters( pp ); _parameterHolder.recordParameters( pp ); } catch (IOException e) {} return (String[]) names.toArray( new String[ names.size() ] ); }
/** * Sets the multiple values of a parameter in a web request. **/ public void setParameter( String name, String[] values ) { _parameterHolder.setParameter( name, values ); }
/** * 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 an array of all parameter names defined as part of this web request. * @since 1.3.1 **/ public String[] getRequestParameterNames() { final HashSet names = new HashSet(); ParameterProcessor pp = new ParameterProcessor() { public void addParameter( String name, String value, String characterSet ) throws IOException { names.add( name ); } public void addFile( String parameterName, UploadFileSpec fileSpec ) throws IOException { names.add( parameterName ); } }; try { _parameterHolder.recordPredefinedParameters( pp ); _parameterHolder.recordParameters( pp ); } catch (IOException e) {} return (String[]) names.toArray( new String[ names.size() ] ); }
/** * Constructs a web request using a base URL, a relative URL string, and a target. **/ private WebRequest( URL urlBase, String urlString, FrameSelector sourceFrame, String requestTarget, ParameterHolder parameterHolder ) { _urlBase = urlBase; _sourceFrame = sourceFrame; _requestTarget = requestTarget; _urlString = urlString.toLowerCase().startsWith( "http" ) ? escape( urlString ) : urlString; _parameterHolder = parameterHolder; _characterSet = parameterHolder.getCharacterSet(); }
/** * Constructs a web request for a form submitted via a button. * * @since 1.6 **/ protected MessageBodyWebRequest( WebForm sourceForm, ParameterHolder parameterHolder, SubmitButton button, int x, int y ) { super( sourceForm, parameterHolder, button, x, y ); _mimeEncoded = parameterHolder.isSubmitAsMime(); setHeaderField( REFERER_HEADER_NAME, sourceForm.getBaseURL().toExternalForm() ); }
/** * Removes a parameter from this web request. **/ public void removeParameter( String name ) { _parameterHolder.removeParameter( name ); }
/** * Returns an array of all parameter names defined as part of this web request. * @since 1.3.1 **/ public String[] getRequestParameterNames() { final HashSet names = new HashSet(); ParameterProcessor pp = new ParameterProcessor() { public void addParameter( String name, String value, String characterSet ) throws IOException { names.add( name ); } public void addFile( String parameterName, UploadFileSpec fileSpec ) throws IOException { names.add( parameterName ); } }; try { _parameterHolder.recordPredefinedParameters( pp ); _parameterHolder.recordParameters( pp ); } catch (IOException e) {} return (String[]) names.toArray( new String[ names.size() ] ); }
/** * Sets the multiple values of a parameter in a web request. **/ public void setParameter( String name, String[] values ) { _parameterHolder.setParameter( name, values ); }
/** * 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 the query string defined for this request. **/ public String getQueryString() { try { URLEncodedString encoder = new URLEncodedString(); getParameterHolder().recordPredefinedParameters( encoder ); return encoder.getString(); } catch (IOException e) { throw new RuntimeException( "Programming error: " + e ); // should never happen } }
/** * Constructs a web request using a base URL, a relative URL string, and a target. **/ private WebRequest( URL urlBase, String urlString, FrameSelector sourceFrame, String requestTarget, ParameterHolder parameterHolder ) { _urlBase = urlBase; _sourceFrame = sourceFrame; _requestTarget = requestTarget; _urlString = urlString.toLowerCase().startsWith( "http" ) ? escape( urlString ) : urlString; _parameterHolder = parameterHolder; _characterSet = parameterHolder.getCharacterSet(); }
/** * Constructs a web request for a form submitted via a button. * * @since 1.6 **/ protected MessageBodyWebRequest( WebForm sourceForm, ParameterHolder parameterHolder, SubmitButton button, int x, int y ) { super( sourceForm, parameterHolder, button, x, y ); _mimeEncoded = parameterHolder.isSubmitAsMime(); setHeaderField( REFERER_HEADER_NAME, sourceForm.getBaseURL().toExternalForm() ); }
/** * Removes a parameter from this web request. **/ public void removeParameter( String name ) { _parameterHolder.removeParameter( name ); }
/** * Returns the query string defined for this request. **/ public String getQueryString() { try { URLEncodedString encoder = new URLEncodedString(); getParameterHolder().recordPredefinedParameters( encoder ); getParameterHolder().recordParameters( encoder ); return encoder.getString(); } catch (IOException e) { throw new RuntimeException( "Programming error: " + e ); // should never happen } }
/** * Sets the value of a parameter in a web request. **/ public void setParameter( String name, String value ) { _parameterHolder.setParameter( name, value ); }
/** * 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 ); }