Package com.linkedin.jersey.api.uri

Examples of com.linkedin.jersey.api.uri.UriTemplate


    return getCodeModel().ref(ComplexResourceKey.class).narrow(keyClass, paramsClass);
  }

  private static List<String> getPathKeys(String basePath, Map<String, List<String>> pathToAssocKeys)
  {
    UriTemplate template = new UriTemplate(basePath);
    return fixOldStylePathKeys(template.getTemplateVariables(), basePath, pathToAssocKeys);
  }
View Full Code Here


  }

  public static String[] extractPathComponentsFromUriTemplate(String uriTemplate)
  {
    final String normalizedUriTemplate = uriTemplate.replaceAll("(^/|/$)", "");
    final UriTemplate template = new UriTemplate(normalizedUriTemplate);
    final String uri = template.createURI(_EMPTY_STRING_ARRAY);
    return uri.replaceAll("/+", "/").split("/");
  }
View Full Code Here

  /**
   * Validates that all path keys in the URI template are present. If not, an {@link IllegalStateException} is thrown.
   */
  private void validatePathKeys()
  {
    UriTemplate template = new UriTemplate(getBaseUriTemplate());
    for (String key: template.getTemplateVariables())
    {
      Object value = getPathKeys().get(key);
      if (value == null)
      {
        throw new IllegalStateException("Missing path key: " + key);
View Full Code Here

   * @return the resource path parts as a list.
   */
  @Deprecated
  public List<String> getResourcePath()
  {
    UriTemplate template = new UriTemplate(_baseUriTemplate);
    List<String> resourcePath = new ArrayList<String>(1);
    String[] pathParts = SLASH_PATTERN.split(template.createURI(Collections.<String, String>emptyMap()));

    for (String pathPart : pathParts)
    {
      if (!pathPart.equals(""))
      {
View Full Code Here

    return _request;
  }

  private String bindPathKeys()
  {
    UriTemplate template = new UriTemplate(_request.getBaseUriTemplate());
    @SuppressWarnings("unchecked")
    Map<String, Object> pathKeys = _request.getPathKeys();
    Map<String, String> escapedKeys = new HashMap<String, String>();

    for(Map.Entry<String, Object> entry : pathKeys.entrySet())
    {
      String value = URIParamUtils.encodeKeyForUri(entry.getValue(), UriComponent.Type.PATH_SEGMENT, _version);
      if (value == null)
      {
        throw new IllegalArgumentException("Missing value for path key " + entry.getKey());
      }
      escapedKeys.put(entry.getKey(), value);
    }

    return template.createURI(escapedKeys);
  }
View Full Code Here

TOP

Related Classes of com.linkedin.jersey.api.uri.UriTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.