01: package com.meterware.httpunit;
02:
03: /********************************************************************************************************************
04: * $Id: HeaderOnlyWebRequest.java,v 1.4 2004/06/30 23:54:48 russgold Exp $
05: *
06: * Copyright (c) 2002,2004, Russell Gold
07: *
08: * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
09: * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
10: * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
11: * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12: *
13: * The above copyright notice and this permission notice shall be included in all copies or substantial portions
14: * of the Software.
15: *
16: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
17: * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
19: * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20: * DEALINGS IN THE SOFTWARE.
21: *
22: *******************************************************************************************************************/
23: import java.net.URL;
24: import java.io.IOException;
25:
26: /**
27: * A web request which has no information in its message body.
28: *
29: * @author <a href="mailto:russgold@httpunit.org">Russell Gold</a>
30: **/
31: public abstract class HeaderOnlyWebRequest extends WebRequest {
32:
33: /**
34: * Returns the query string defined for this request.
35: **/
36: public String getQueryString() {
37: try {
38: URLEncodedString encoder = new URLEncodedString();
39: getParameterHolder().recordPredefinedParameters(encoder);
40: getParameterHolder().recordParameters(encoder);
41: return encoder.getString();
42: } catch (IOException e) {
43: throw new RuntimeException("Programming error: " + e); // should never happen
44: }
45: }
46:
47: //-------------------------------- protected members ---------------------------
48:
49: protected HeaderOnlyWebRequest(URL urlBase, String urlString,
50: FrameSelector frame, String target) {
51: super (urlBase, urlString, frame, target);
52: }
53:
54: protected HeaderOnlyWebRequest(URL urlBase, String urlString,
55: String target) {
56: super (urlBase, urlString, target);
57: }
58:
59: protected HeaderOnlyWebRequest(URL urlBase, String urlString) {
60: super (urlBase, urlString);
61: }
62:
63: protected HeaderOnlyWebRequest(String urlString) {
64: super (urlString);
65: }
66:
67: //------------------------------------ package members --------------------------
68:
69: HeaderOnlyWebRequest(WebRequestSource requestSource) {
70: super (requestSource, WebRequest
71: .newParameterHolder(requestSource));
72: }
73:
74: HeaderOnlyWebRequest(WebForm sourceForm,
75: ParameterHolder parameterHolder, SubmitButton button,
76: int x, int y) {
77: super (sourceForm, parameterHolder, button, x, y);
78: }
79:
80: HeaderOnlyWebRequest(URL urlBase, String urlString,
81: FrameSelector frame) {
82: super(urlBase, urlString, frame, frame.getName());
83: }
84:
85: }
|