javax.servlet.sip.URI类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中javax.servlet.sip.URI类的一些代码示例,展示了URI类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URI类的具体详情如下:
包路径:javax.servlet.sip.URI
类名称:URI

URI介绍

[英]Base interface for any type of URI. These are used in the request line of SIP requests to identify the callee and also in Contact, From, and To headers. The only feature common to all URIs is that they can be represented as strings beginning with a token identifying the scheme of the URI followed by a colon followed by a scheme-specific part. The generic syntax of URIs is defined in RFC 2396.
[中]任何类型URI的基本接口。它们用于SIP请求的请求行中,以识别被叫方,也用于Contact、From和to头。所有URI的唯一共同特征是,它们可以表示为字符串,以标识URI方案的标记开头,后跟冒号,后跟特定于方案的部分。URI的通用语法在RFC 2396中定义。

代码示例

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-as7

public Object extract(Object input) {
    URI uri = (URI) input;
    if (uri.isSipURI()) {
      return ((SipURI) uri).getParameter(param);
    } else if ("tel".equals(uri.getScheme())) {
      return ((TelURL) uri).getParameter(param);
    }
    return null;
  }
}

代码示例来源:origin: org.restcomm/restcomm-connect.http

private void writeInviteUri(final URI requestUri, final JsonObject object) {
  object.addProperty("Initial Invite", requestUri.toString());
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

/**
 * {@inheritDoc}
 */
public void encodeURI(URI uri) {
  // no need to encode the id it is done automatically in setParameter method of the uri
  // Issue 1299 Sip request contains ApplicationSessionKey in request URI is not dispatched to existing SippApplicationSession
  // http://code.google.com/p/mobicents/issues/detail?id=1299
  uri.setParameter(SIP_APPLICATION_KEY_PARAM_NAME, getId());
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-catalina

public Map<String, String> getParameterMap() {
    // JSR 289 Section 5.6.1 Parameters :
    // For initial requests where a preloaded Route header specified the application to be invoked, the parameters are those of the SIP or SIPS URI in that Route header.
    // For initial requests where the application is invoked the parameters are those present on the request URI, 
    // if this is a SIP or a SIPS URI. For other URI schemes, the parameter set is undefined.
    // For subsequent requests in a dialog, the parameters presented to the application  are those that the application itself 
    // set on the Record-Route header for the initial request or response (see 10.4 Record-Route Parameters). 
    // These will typically be the URI parameters of the top Route header field but if the upstream SIP element is a 
    // "strict router" they may be returned in the request URI (see RFC 3261). 
    // It is the containers responsibility to recognize whether the upstream element is a strict router and determine the right parameter set accordingly.
    HashMap<String, String> retval = new HashMap<String, String>();
    if(this.getPoppedRoute() != null) {
      Iterator<String> parameterNamesIt =  this.getPoppedRoute().getURI().getParameterNames();
      while (parameterNamesIt.hasNext()) {
        String parameterName = parameterNamesIt.next();
        retval.put(parameterName, this.getPoppedRoute().getURI().getParameter(parameterName));			
      }
    } else {
      Iterator<String> parameterNamesIt =  this.getRequestURI().getParameterNames();
      while (parameterNamesIt.hasNext()) {
        String parameterName = parameterNamesIt.next();
        retval.put(parameterName, this.getRequestURI().getParameter(parameterName));			
      }
    }        
    
    return retval;
  }
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-as7

public Object extract(Object input) {
    URI uri = (URI) input;
    if (uri.isSipURI()) {
      return ((SipURI)uri).getHost();
    } else { 
      return null;
    }
  }
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

public List<ProxyBranch> createProxyBranches(List<? extends URI> targets) {
  ArrayList<ProxyBranch> list = new ArrayList<ProxyBranch>();
  for(URI target: targets)
  {
    if(target == null) {
      throw new NullPointerException("URI can't be null");
    }
    if(!JainSipUtils.checkScheme(target.toString())) {
      throw new IllegalArgumentException("Scheme " + target.getScheme() + " is not supported");
    }
    ProxyBranchImpl branch = new ProxyBranchImpl(target, this);
    branch.setRecordRoute(recordRoutingEnabled);
    branch.setRecurse(recurse);
    list.add(branch);
    this.proxyBranches.put(target, branch);
  }
  return list;
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-as7

public Object extract(Object input) {
    return ((URI) input).getScheme();
  }
}

代码示例来源:origin: org.restcomm/restcomm-connect.telephony.api

logger.debug("ReqURI="+reqURI.toString()+" msgReqURI="+message.getRequestURI());
parName = keyValPair.substring(0, equalsPos);
parVal = keyValPair.substring(equalsPos+1);
reqURI.setParameter(parName, parVal);
if(logger.isDebugEnabled()) {
  logger.debug("ReqURI pars ="+parName+"="+parVal+" equalsPos="+equalsPos+" keyValPair="+keyValPair);
logger.debug("ReqURI="+reqURI.toString()+" msgReqURI="+message.getRequestURI());

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

public Enumeration<String> getParameterNames() {
  // JSR 289 Section 5.6.1 Parameters :
  // For initial requests where a preloaded Route header specified the application to be invoked, the parameters are those of the SIP or SIPS URI in that Route header.
  // For initial requests where the application is invoked the parameters are those present on the request URI, 
  // if this is a SIP or a SIPS URI. For other URI schemes, the parameter set is undefined.
  // For subsequent requests in a dialog, the parameters presented to the application  are those that the application itself 
  // set on the Record-Route header for the initial request or response (see 10.4 Record-Route Parameters). 
  // These will typically be the URI parameters of the top Route header field but if the upstream SIP element is a 
  // "strict router" they may be returned in the request URI (see RFC 3261). 
  // It is the containers responsibility to recognize whether the upstream element is a strict router and determine the right parameter set accordingly.
  Vector<String> retval = new Vector<String>();
  if(this.getPoppedRoute() != null) {
    Iterator<String> parameterNamesIt =  this.getPoppedRoute().getURI().getParameterNames();
    while (parameterNamesIt.hasNext()) {
      String parameterName = parameterNamesIt.next();
      retval.add(parameterName);        
    }
  } else {
    Iterator<String> parameterNamesIt =  this.getRequestURI().getParameterNames();
    while (parameterNamesIt.hasNext()) {
      String parameterName = parameterNamesIt.next();
      retval.add(parameterName);
    }
  }        
  
  return retval.elements();				
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

public String getParameter(String name) {
  // JSR 289 Section 5.6.1 Parameters :
  // For initial requests where a preloaded Route header specified the application to be invoked, the parameters are those of the SIP or SIPS URI in that Route header.
  // For initial requests where the application is invoked the parameters are those present on the request URI, 
  // if this is a SIP or a SIPS URI. For other URI schemes, the parameter set is undefined.
  // For subsequent requests in a dialog, the parameters presented to the application  are those that the application itself 
  // set on the Record-Route header for the initial request or response (see 10.4 Record-Route Parameters). 
  // These will typically be the URI parameters of the top Route header field but if the upstream SIP element is a 
  // "strict router" they may be returned in the request URI (see RFC 3261). 
  // It is the containers responsibility to recognize whether the upstream element is a strict router and determine the right parameter set accordingly.
  if(this.getPoppedRoute() != null) {
    return this.getPoppedRoute().getURI().getParameter(name);
  } else {
    return this.getRequestURI().getParameter(name);
  }
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-as7

public Map<String, String[]> getParameterMap() {
  // JSR 289 Section 5.6.1 Parameters :
  // For initial requests where a preloaded Route header specified the application to be invoked, the parameters are those of the SIP or SIPS URI in that Route header.
  // For initial requests where the application is invoked the parameters are those present on the request URI, 
  // if this is a SIP or a SIPS URI. For other URI schemes, the parameter set is undefined.
  // For subsequent requests in a dialog, the parameters presented to the application  are those that the application itself 
  // set on the Record-Route header for the initial request or response (see 10.4 Record-Route Parameters). 
  // These will typically be the URI parameters of the top Route header field but if the upstream SIP element is a 
  // "strict router" they may be returned in the request URI (see RFC 3261). 
  // It is the containers responsibility to recognize whether the upstream element is a strict router and determine the right parameter set accordingly.
  HashMap<String, String[]> retval = new HashMap<String, String[]>();
  if(this.getPoppedRoute() != null) {
    Iterator<String> parameterNamesIt =  this.getPoppedRoute().getURI().getParameterNames();
    while (parameterNamesIt.hasNext()) {
      String parameterName = parameterNamesIt.next();
      String [] paramsArray = {this.getPoppedRoute().getURI().getParameter(parameterName)}; //Get the parameter map value to String[]
      retval.put(parameterName, paramsArray); 
    }
  } else {
    Iterator<String> parameterNamesIt =  this.getRequestURI().getParameterNames();
    while (parameterNamesIt.hasNext()) {
      String parameterName = parameterNamesIt.next();
      String [] paramsArray = {this.getPoppedRoute().getURI().getParameter(parameterName)}; //Get the parameter map value to String[]
      retval.put(parameterName, paramsArray);
    }
  }        
  
  return retval;
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-as7

public Object extract(Object input) {
    URI uri = (URI) input;
    if (uri.isSipURI()) {
      return ((SipURI)uri).getUser();
    } else {
      return null;
    }
  }
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

public void proxyTo(final List<? extends URI> uris) {
  for (URI uri : uris)
  {
    if(uri == null) {
      throw new NullPointerException("URI can't be null");
    }
    if(!JainSipUtils.checkScheme(uri.toString())) {
      throw new IllegalArgumentException("Scheme " + uri.getScheme() + " is not supported");
    }
    final ProxyBranchImpl branch = new ProxyBranchImpl((URI) uri, this);
    branch.setRecordRoute(recordRoutingEnabled);
    branch.setRecurse(recurse);
    this.proxyBranches.put(uri, branch);
  }
  startProxy();
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-catalina

public Object extract(Object input) {
    return ((URI) input).getScheme();
  }
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-catalina

public Object extract(Object input) {
    URI uri = (URI) input;
    if (uri.isSipURI()) {
      return ((SipURI) uri).getParameter(param);
    } else if ("tel".equals(uri.getScheme())) {
      return ((TelURL) uri).getParameter(param);
    }
    return null;
  }
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-as8

Iterator<String> parameterNamesIt = this.getPoppedRoute().getURI().getParameterNames();
while (parameterNamesIt.hasNext()) {
  String parameterName = parameterNamesIt.next();
  String[] paramsArray = { this.getPoppedRoute().getURI().getParameter(parameterName) }; // Get the
Iterator<String> parameterNamesIt = this.getRequestURI().getParameterNames();
while (parameterNamesIt.hasNext()) {
  String parameterName = parameterNamesIt.next();
  String[] paramsArray = { this.getPoppedRoute().getURI().getParameter(parameterName) }; // Get the

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

public Address createAddress(URI uri) {
  if (logger.isDebugEnabled()) {
    logger.debug("Creating Address fromm URI[" + uri.toString()
        + "]");
  }
  URIImpl uriImpl = (URIImpl) uri;
  return new AddressImpl(SipFactoryImpl.addressFactory
      .createAddress(uriImpl.getURI()), null, ModifiableRule.Modifiable);
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-catalina

public Object extract(Object input) {
    URI uri = (URI) input;
    if (uri.isSipURI()) {
      return ((SipURI)uri).getUser();
    } else {
      return null;
    }
  }
}

代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl

public void proxyTo(final URI uri) {
  if(uri == null) {
    throw new NullPointerException("URI can't be null");
  }
  if(!JainSipUtils.checkScheme(uri.toString())) {
    // Fix for Issue http://code.google.com/p/mobicents/issues/detail?id=2327, checking the route header
    RouteHeader routeHeader = (RouteHeader) originalRequest.getMessage().getHeader(RouteHeader.NAME);
    if(routeHeader == null || (routeHeader != null && !JainSipUtils.checkScheme(routeHeader.getAddress().getURI().toString()))) {
      throw new IllegalArgumentException("Scheme " + uri.getScheme() + " is not supported");
    }            
  }
  final ProxyBranchImpl branch = new ProxyBranchImpl(uri, this);
  branch.setRecordRoute(recordRoutingEnabled);
  branch.setRecurse(recurse);
  this.proxyBranches.put(uri, branch);
  startProxy();
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-as8

public Object extract(Object input) {
    return ((URI) input).getScheme();
  }
}

相关文章