aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2015-05-04 09:05:20 +0300
committerDamian Minkov <damencho@jitsi.org>2015-05-04 09:05:20 +0300
commit6134b2967e24cbb05ef859525951e8749d3d93b6 (patch)
treed4a878ae06f32bf648db30ae0c2e9465f6655913 /src/net/java/sip/communicator/impl
parentadab0fa1c0ac440efb4dc8591af0ef1993ee826a (diff)
downloadjitsi-6134b2967e24cbb05ef859525951e8749d3d93b6.zip
jitsi-6134b2967e24cbb05ef859525951e8749d3d93b6.tar.gz
jitsi-6134b2967e24cbb05ef859525951e8749d3d93b6.tar.bz2
Directly creates custom headers to avoid header factory checking and additional parsing.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ConfigHeaders.java38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ConfigHeaders.java b/src/net/java/sip/communicator/impl/protocol/sip/ConfigHeaders.java
index b01626f..0044211 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ConfigHeaders.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ConfigHeaders.java
@@ -6,6 +6,7 @@
*/
package net.java.sip.communicator.impl.protocol.sip;
+import gov.nist.javax.sip.header.*;
import net.java.sip.communicator.util.*;
import javax.sip.address.*;
@@ -142,8 +143,7 @@ public class ConfigHeaders
try
{
- Header customHeader = protocolProvider.getHeaderFactory()
- .createHeader(
+ Header customHeader = new CustomHeader(
headerValues.get(ACC_PROPERTY_CONFIG_HEADER_NAME),
processParams(
headerValues.get(ACC_PROPERTY_CONFIG_HEADER_VALUE),
@@ -221,4 +221,38 @@ public class ConfigHeaders
return value;
}
+
+ /**
+ * Custom header to instert. Custom name and value.
+ */
+ private static class CustomHeader
+ extends SIPHeader
+ {
+ /**
+ * The header value.
+ */
+ private String value;
+
+ /**
+ * Constructs header.
+ * @param name header name
+ * @param value header value
+ */
+ CustomHeader(String name, String value)
+ {
+ super(name);
+ this.value = value;
+ }
+
+ /**
+ * Just the encoded body of the header.
+ * @param buffer the insert result
+ * @return the string encoded header body.
+ */
+ @Override
+ protected StringBuilder encodeBody(StringBuilder buffer)
+ {
+ return value != null ? buffer.append(value) : buffer.append("");
+ }
+ }
}