Examples of URITemplate


Examples of org.apache.cxf.jaxrs.model.URITemplate

        }
    }
   
    private String substituteMapped(String path, Map<String, ? extends Object> varValueMap) {
   
        URITemplate templ = new URITemplate(path);
       
        Set<String> uniqueVars = new HashSet<String>(templ.getVariables());
        if (varValueMap.size() < uniqueVars.size()) {
            throw new IllegalArgumentException("Unresolved variables; only " + varValueMap.size()
                                               + " value(s) given for " + uniqueVars.size()
                                               + " unique variable(s)");
        }
        return templ.substitute(varValueMap);
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

        Iterator<PathSegment> iter = paths.iterator();
        while (iter.hasNext()) {
            PathSegment ps = iter.next();
            String p = ps.getPath();
            if (p.length() != 0 || !iter.hasNext()) {
                p = fromEncoded ? new URITemplate(p).encodeLiteralCharacters() : p;
                if (sb.length() == 0 && leadingSlash) {
                    sb.append('/');
                } else if (!p.startsWith("/") && sb.length() > 0) {
                    sb.append('/');
                }
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

        int produceMatched = 0;
       
        boolean subresourcesOnly = true;
        for (MediaType acceptType : acceptContentTypes) {
            for (OperationResourceInfo ori : resource.getMethodDispatcher().getOperationResourceInfos()) {
                URITemplate uriTemplate = ori.getURITemplate();
                MultivaluedMap<String, String> map = new MetadataMap<String, String>(values);
                if (uriTemplate != null && uriTemplate.match(path, map)) {
                    boolean added = false;
                    if (ori.isSubResourceLocator()) {
                        candidateList.put(ori, map);
                        added = true;
                    } else {
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

        boolean samePathOperationFollows = singleResourceMultipleMethods && compareOperations(ori, nextOp);
       
        String path = ori.getURITemplate().getValue();
        if (!resourceTagOpened && openResource(path)) {
            resourceTagOpened = true;
            URITemplate template = ori.getClassResourceInfo().getURITemplate();
            if (template != null) {
                String parentPath = template.getValue();
                if (parentPath.endsWith("/") && path.startsWith("/") && path.length() > 1) {
                    path = path.substring(1);
                }
            }
            sb.append("<resource path=\"").append(getPath(path)).append("\">");
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

                if (sub1 && !sub2) {
                    return 1;
                } else if (!sub1 && sub2) {
                    return -1;
                }
                URITemplate ut1 = op1.getURITemplate();
                URITemplate ut2 = op2.getURITemplate();
                int result = ut1.getValue().compareTo(ut2.getValue());
                if (result == 0 && !(sub1 && sub2)) {
                    result = op1.getHttpMethod().compareTo(op2.getHttpMethod());
                }
                return result;
            }
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

     * @param values template variable values
     * @return updated WebClient
     */
    public WebClient path(String path, Object... values) {
        URI u = new UriBuilderImpl().uri(URI.create("http://tempuri")).path(path).buildFromEncoded(values);
        getState().setTemplates(getTemplateParametersMap(new URITemplate(path), Arrays.asList(values)));
        return path(u.getRawPath());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

    }

    private URI doBuild(boolean fromEncoded, Object... values) {
       
        String thePath = buildPath(fromEncoded);
        URITemplate pathTempl = new URITemplate(thePath);
        thePath = substituteVarargs(pathTempl, values, 0);
       
        String theQuery = buildQuery(fromEncoded);
        int queryTemplateVarsSize = 0;
        if (theQuery != null) {
            URITemplate queryTempl = new URITemplate(theQuery);
            int lengthDiff = values.length - pathTempl.getVariables().size();
            if (lengthDiff > 0) {
                queryTemplateVarsSize = queryTempl.getVariables().size();
                theQuery = substituteVarargs(queryTempl, values, values.length - lengthDiff);
            }
        }
       
        String theFragment = fragment;
        if (theFragment != null) {
            URITemplate fragmentTempl = new URITemplate(theFragment);
            int lengthDiff = values.length - pathTempl.getVariables().size() - queryTemplateVarsSize;
            if (lengthDiff > 0) {
                theFragment = substituteVarargs(fragmentTempl, values, values.length - lengthDiff);
            }
        }
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

        }
    }
   
    private String substituteMapped(String path, Map<String, ? extends Object> varValueMap) {
   
        URITemplate templ = new URITemplate(path);
       
        Set<String> uniqueVars = new HashSet<String>(templ.getVariables());
        if (varValueMap.size() < uniqueVars.size()) {
            throw new IllegalArgumentException("Unresolved variables; only " + varValueMap.size()
                                               + " value(s) given for " + uniqueVars.size()
                                               + " unique variable(s)");
        }
        return templ.substitute(varValueMap);
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

        Iterator<PathSegment> iter = paths.iterator();
        while (iter.hasNext()) {
            PathSegment ps = iter.next();
            String p = ps.getPath();
            if (p.length() != 0 || !iter.hasNext()) {
                p = fromEncoded ? new URITemplate(p).encodeLiteralCharacters() : p;
                if (sb.length() == 0 && leadingSlash) {
                    sb.append('/');
                } else if (!p.startsWith("/") && sb.length() > 0) {
                    sb.append('/');
                }
View Full Code Here

Examples of org.apache.cxf.jaxrs.model.URITemplate

        ClassResourceInfo cri = new ClassResourceInfo(Customer.class);
        OperationResourceInfo ori1 = new OperationResourceInfo(
                                         Customer.class.getMethod("getItAsXML", new Class[]{}),
                                         cri);
        ori1.setHttpMethod("GET");
        ori1.setURITemplate(new URITemplate("/"));
        OperationResourceInfo ori2 = new OperationResourceInfo(
                                         Customer.class.getMethod("getItPlain", new Class[]{}),
                                         cri);
        ori2.setHttpMethod("GET");
        ori2.setURITemplate(new URITemplate("/"));
        MethodDispatcher md = new MethodDispatcher();
        md.bind(ori1, Customer.class.getMethod("getItAsXML", new Class[]{}));
        md.bind(ori2, Customer.class.getMethod("getItPlain", new Class[]{}));
        cri.setMethodDispatcher(md);
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.