1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jelly.tags.http;
18
19 import org.apache.commons.jelly.JellyTagException;
20 import org.apache.commons.jelly.TagSupport;
21 import org.apache.commons.jelly.XMLOutput;
22
23 /***
24 * A tag to hold request headers
25 *
26 * @author dion
27 * @version $Id: HeaderTag.java 155420 2005-02-26 13:06:03Z dirkv $
28 */
29 public class HeaderTag extends TagSupport {
30 /*** parameter name */
31 private String _name;
32 /*** parameter value */
33 private String _value;
34
35 /*** Creates a new instance of HeaderTag */
36 public HeaderTag() {
37 }
38
39 /***
40 * Perform the tag functionality. In this case, simply evaluate the body.
41 *
42 * @param xmlOutput where to send output
43 * @throws Exception when an error occurs
44 */
45 public void doTag(XMLOutput xmlOutput) throws JellyTagException {
46 HttpTagSupport http = (HttpTagSupport) findAncestorWithClass(
47 HttpTagSupport.class);
48 http.addRequestHeader(getName(), getValue());
49 invokeBody(xmlOutput);
50 }
51
52
53
54
55 /***
56 * Getter for property name.
57 *
58 * @return Value of property name.
59 */
60 public String getName() {
61 return _name;
62 }
63
64 /***
65 * Setter for property name.
66 *
67 * @param name New value of property name.
68 */
69 public void setName(String name) {
70 _name = name;
71 }
72
73 /***
74 * Getter for property value.
75 *
76 * @return Value of property value.
77 */
78 public String getValue() {
79 return _value;
80 }
81
82 /***
83 * Setter for property value.
84 *
85 * @param value New value of property value.
86 */
87 public void setValue(String value) {
88 _value = value;
89 }
90
91 }