Search in sources :

Example 1 with UriTemplateParser

use of org.glassfish.jersey.uri.internal.UriTemplateParser in project jersey by jersey.

the class ELLinkBuilder method buildURI.

/**
     * TODO javadoc.
     */
static URI buildURI(InjectLinkDescriptor link, Object entity, Object resource, Object instance, UriInfo uriInfo, ResourceMappingContext rmc) {
    String template = link.getLinkTemplate(rmc);
    // first process any embedded EL expressions
    LinkELContext context = new LinkELContext(entity, resource, instance);
    ValueExpression expr = expressionFactory.createValueExpression(context, template, String.class);
    template = expr.getValue(context).toString();
    // now process any embedded URI template parameters
    UriBuilder ub = applyLinkStyle(template, link.getLinkStyle(), uriInfo);
    UriTemplateParser parser = new UriTemplateParser(template);
    List<String> parameterNames = parser.getNames();
    Map<String, Object> valueMap = getParameterValues(parameterNames, link, context, uriInfo);
    return ub.buildFromMap(valueMap);
}
Also used : ValueExpression(javax.el.ValueExpression) UriBuilder(javax.ws.rs.core.UriBuilder) UriTemplateParser(org.glassfish.jersey.uri.internal.UriTemplateParser)

Aggregations

ValueExpression (javax.el.ValueExpression)1 UriBuilder (javax.ws.rs.core.UriBuilder)1 UriTemplateParser (org.glassfish.jersey.uri.internal.UriTemplateParser)1