01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.jmeter.protocol.http.control;
20:
21: import java.io.Serializable;
22:
23: import org.apache.jmeter.config.ConfigElement;
24: import org.apache.jmeter.testelement.AbstractTestElement;
25:
26: /**
27: * This class is an HTTP Header encapsulator.
28: *
29: */
30: public class Header extends AbstractTestElement implements Serializable {
31:
32: private static final String HNAME = "Header.name"; //$NON-NLS-1$
33: // See TestElementPropertyConverter
34:
35: private static final String VALUE = "Header.value"; //$NON-NLS-1$
36:
37: /**
38: * Create the header.
39: */
40: public Header() {
41: this .setName("");
42: this .setValue("");
43: }
44:
45: /**
46: * Create the coookie.
47: */
48: public Header(String name, String value) {
49: this .setName(name);
50: this .setValue(value);
51: }
52:
53: public void addConfigElement(ConfigElement config) {
54: }
55:
56: public boolean expectsModification() {
57: return false;
58: }
59:
60: /**
61: * Get the name for this object.
62: */
63: public synchronized String getName() {
64: return getPropertyAsString(HNAME);
65: }
66:
67: /**
68: * Set the name for this object.
69: */
70: public synchronized void setName(String name) {
71: this .setProperty(HNAME, name);
72: }
73:
74: /**
75: * Get the value for this object.
76: */
77: public synchronized String getValue() {
78: return getPropertyAsString(VALUE);
79: }
80:
81: /**
82: * Set the value for this object.
83: */
84: public synchronized void setValue(String value) {
85: this .setProperty(VALUE, value);
86: }
87:
88: /**
89: * Creates a string representation of this header.
90: */
91: public String toString() {
92: return getName() + "\t" + getValue(); //$NON-NLS-1$
93: }
94: }
|