public void setValue(String value) { try { ContactHeader contactHeader = (ContactHeader) SipFactoryImpl.headerFactory.createHeader( ContactHeader.NAME, value); this.address = SipFactoryImpl.addressFactory.createAddress(value); this.parameters = getParameters(((Parameters) contactHeader)); } catch (Exception ex) { throw new IllegalArgumentException("Illegal argument", ex); } }
.createHeader(name, value); this.message.setHeader(header);
public void setParameterableHeader(String name, Parameterable param) { checkCommitted(); if(isSystemHeader(getModifiableRule(name))) { throw new IllegalArgumentException(name + " is a system header !"); } try { this.message.setHeader(SipFactoryImpl.headerFactory.createHeader(name, param.toString())); } catch (ParseException e) { throw new IllegalArgumentException("Impossible to set this parameterable header", e); } }
Header header = SipFactory.getInstance().createHeaderFactory().createHeader(nameToAdd, value); this.message.setHeader(header); } else { .createHeader(name, value); this.message.addLast(header);
/** * {@inheritDoc} */ public void pushPath(Address uri) { checkReadOnly(); if(!Request.REGISTER.equalsIgnoreCase(((Request)message).getMethod())) { throw new IllegalStateException("Cannot push a Path on a non REGISTER request !"); } if(uri.getURI() instanceof TelURL) { throw new IllegalArgumentException("Cannot push a TelUrl as a path !"); } if (logger.isDebugEnabled()) logger.debug("Pushing path into message of value [" + uri + "]"); try { javax.sip.header.Header p = SipFactoryImpl.headerFactory .createHeader(PathHeader.NAME, uri.toString()); this.message.addFirst(p); } catch (Exception e) { logger.error("Error while pushing path [" + uri + "]"); throw new IllegalArgumentException("Error pushing path ", e); } }
public void setHeaderInternal(String name, String value, boolean bypassSystemHeaderCheck) { if(name == null) { throw new NullPointerException ("name parameter is null"); } if(value == null) { throw new NullPointerException ("value parameter is null"); } if(!bypassSystemHeaderCheck && isSystemHeader(getModifiableRule(name))) { throw new IllegalArgumentException(name + " is a system header !"); } try { Header header = SipFactory.getInstance().createHeaderFactory() .createHeader(name, value); this.message.setHeader(header); } catch (Exception e) { throw new IllegalArgumentException("Error creating header!", e); } }
public void addParameterableHeader(String name, Parameterable param, boolean first) { checkCommitted(); try { String hName = getFullHeaderName(name); if (logger.isDebugEnabled()) logger.debug("Adding parametrable header under name [" + hName + "] as first [" + first + "] value [" + param + "]"); String body = param.toString(); String nameToAdd = getCorrectHeaderName(hName); Header header = SipFactoryImpl.headerFactory.createHeader(nameToAdd, body); if (first) this.message.addFirst(header); else this.message.addLast(header); } catch (Exception ex) { throw new IllegalArgumentException("Illegal args supplied", ex); } }
String headerNameToAdd = getCorrectHeaderName(hName); try { h = SipFactoryImpl.headerFactory.createHeader(headerNameToAdd, addr .toString()); this.message.setHeader(h);
final Header header = sipFactoryImpl.getHeaderFactory().createHeader( headerName, value); if(! JainSipUtils.SINGLETON_HEADER_NAMES.contains(header.getName())) {
subsequentMessage.addHeader(sipFactoryImpl.getHeaderFactory().createHeader(headerName, "")); } catch (ParseException e) { if (logger.isDebugEnabled()) {
Header h = SipFactoryImpl.headerFactory.createHeader(nameToAdd, addr.toString());
private void sendErrorResponse(int resultCode, ServerTransaction serverTransaction) throws ParseException, SipException, InvalidArgumentException { Response response = this.messageFactory.createResponse(resultCode, serverTransaction.getRequest()); if (resultCode == Response.INTERVAL_TOO_BRIEF) { response.setHeader(this.headerFactory .createDateHeader(new GregorianCalendar())); // set min expires header response.addHeader(this.headerFactory.createHeader("Min-Expires", Long.toString(config.getSipRegistrationMinExpires()))); } serverTransaction.sendResponse(response); }
public void setContentType(String type) { checkContentType(type); checkCommitted(); String name = getCorrectHeaderName(ContentTypeHeader.NAME); try { Header h = SipFactoryImpl.headerFactory.createHeader(name, type); this.message .removeHeader(getCorrectHeaderName(ContentTypeHeader.NAME)); this.message.addHeader(h); } catch (ParseException e) { logger.error("Error while setting content type header !!!", e); } }
/** * {@inheritDoc} */ public Parameterable createParameterable(String value) throws ServletParseException { try { Header header = SipFactoryImpl.headerFactory.createHeader(ContactHeader.NAME, value); return SipServletMessageImpl.createParameterable(header, SipServletMessageImpl.getFullHeaderName(header.getName()), true); } catch (ParseException e) { try { Header header = SipFactoryImpl.headerFactory.createHeader(ContentTypeHeader.NAME, value); return SipServletMessageImpl.createParameterable(header, SipServletMessageImpl.getFullHeaderName(header.getName()), true); } catch (ParseException pe) { // Contribution from Nishihara, Naoki from Japan for Issue http://code.google.com/p/mobicents/issues/detail?id=1856 // Cannot create a parameterable header for Session-Expires try { Header header = SipFactoryImpl.headerFactory.createHeader(ContentDispositionHeader.NAME, value); return SipServletMessageImpl.createParameterable(header, SipServletMessageImpl.getFullHeaderName(header.getName()), true); } catch (ParseException pe2) { throw new ServletParseException("Impossible to parse the following parameterable "+ value , pe2); } } } }
RouteHeader routeHeader = (RouteHeader) SipFactoryImpl.headerFactory.createHeader(RouteHeader.NAME, routes[i]); URI routeURI = routeHeader.getAddress().getURI(); if(routeURI.isSipURI()) { Header routeHeader = SipFactoryImpl.headerFactory.createHeader(RouteHeader.NAME, sipURI.toString()); request.addHeader(routeHeader); routeHeader = SipFactoryImpl.headerFactory.createHeader(RouteHeader.NAME, routes[i]); request.addHeader(routeHeader);
Header routeHeader = SipFactoryImpl.headerFactory.createHeader(RouteHeader.NAME, sipURI.toString()); routeHeader = SipFactoryImpl.headerFactory.createHeader(RouteHeader.NAME, routes[i]); request.addFirst(routeHeader);
Header header1 = headerFactory.createHeader(hname, UriDecoder.decode(h1)); Header header2 = headerFactory.createHeader(hname, UriDecoder.decode(h2));