Home | History | Annotate | Download | only in packet
      1 /*
      2  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
      3  * you may not use this file except in compliance with the License.
      4  * You may obtain a copy of the License at
      5  *
      6  *     http://www.apache.org/licenses/LICENSE-2.0
      7  *
      8  * Unless required by applicable law or agreed to in writing, software
      9  * distributed under the License is distributed on an "AS IS" BASIS,
     10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     11  * See the License for the specific language governing permissions and
     12  * limitations under the License.
     13  */
     14 package org.jivesoftware.smackx.packet;
     15 
     16 import org.jivesoftware.smack.packet.PacketExtension;
     17 
     18 /**
     19  * Represents a <b>Header</b> entry as specified by the <a href="http://xmpp.org/extensions/xep-031.html">Stanza Headers and Internet Metadata (SHIM)</a>
     20 
     21  * @author Robin Collier
     22  */
     23 public class Header implements PacketExtension
     24 {
     25 	private String name;
     26 	private String value;
     27 
     28 	public Header(String name, String value)
     29 	{
     30 		this.name = name;
     31 		this.value = value;
     32 	}
     33 
     34 	public String getName()
     35 	{
     36 		return name;
     37 	}
     38 
     39 	public String getValue()
     40 	{
     41 		return value;
     42 	}
     43 
     44 	public String getElementName()
     45 	{
     46 		return "header";
     47 	}
     48 
     49 	public String getNamespace()
     50 	{
     51 		return HeadersExtension.NAMESPACE;
     52 	}
     53 
     54 	public String toXML()
     55 	{
     56 		return "<header name='" + name + "'>" + value + "</header>";
     57 	}
     58 
     59 }
     60