Package org.apache.cxf.jaxrs.model

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


        return templ.substitute(varValueMap);
    }
   
    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


        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

                                                                MultivaluedMap<String, String> values,
                                                                String requestContentType,
                                                                String acceptContentTypes) {
       
        for (ClassResourceInfo resource : resources) {
            URITemplate uriTemplate = resource.getURITemplate();
            MultivaluedMap<String, String> map = new MetadataMap<String, String>();
            if (uriTemplate.match(path, map)) {
                String subResourcePath = map.getFirst(URITemplate.FINAL_MATCH_GROUP);
                OperationResourceInfo ori = findTargetMethod(resource, subResourcePath, httpMethod, map,
                                                             requestContentType, acceptContentTypes);
                if (ori != null) {
                    values.putAll(map);
View Full Code Here

        List<MediaType> acceptTypes = JAXRSUtils.sortMediaTypes(acceptContentTypes);
      
        for (MediaType acceptType : acceptTypes) {
            for (OperationResourceInfo ori : resource.getMethodDispatcher().getOperationResourceInfos()) {
               
                URITemplate uriTemplate = ori.getURITemplate();
                MultivaluedMap<String, String> map = cloneMap(values);
                if (uriTemplate != null && uriTemplate.match(path, map)) {
                    if (ori.isSubResourceLocator() && matchMimeTypes(requestType, acceptType, ori)) {
                        candidateList.put(ori, map);
                    } else if (ori.getHttpMethod().equalsIgnoreCase(httpMethod)
                               && matchMimeTypes(requestType, acceptType, ori)) {
                        String finalGroup = map.getFirst(URITemplate.FINAL_MATCH_GROUP);
View Full Code Here

     * @param values template variable values
     * @return updated WebClient
     */
    public WebClient path(String path, Object... values) {
        URI u = UriBuilder.fromUri(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

            throw new RuntimeException("Resource class " + sClass.getName() + " has no model info");
        }
        ClassResourceInfo cri =
            new ClassResourceInfo(sClass, sClass, isRoot, enableStatic, true,
                                  model.getConsumes(), model.getProduces(), bus);
        URITemplate t = URITemplate.createTemplate(model.getPath());
        cri.setURITemplate(t);
        MethodDispatcher md = new MethodDispatcher();
        Map<String, UserOperation> ops = model.getOperationsAsMap();
        for (Method m : cri.getServiceClass().getMethods()) {
            UserOperation op = ops.get(m.getName());
View Full Code Here

                                                            boolean enableStatic,
                                                            Bus bus) {
        ClassResourceInfo cri = new ClassResourceInfo(rClass, sClass, root, enableStatic, bus);

        if (root) {
            URITemplate t = URITemplate.createTemplate(cri.getPath());
            cri.setURITemplate(t);
        }
       
        evaluateResourceClass(cri, enableStatic);
        return checkMethodDispatcher(cri) ? cri : null;
View Full Code Here

   
   
    private static OperationResourceInfo createOperationInfo(Method m, Method annotatedMethod,
                                                      ClassResourceInfo cri, Path path, String httpMethod) {
        OperationResourceInfo ori = new OperationResourceInfo(m, annotatedMethod, cri);
        URITemplate t = URITemplate.createTemplate(path);
        ori.setURITemplate(t);
        ori.setHttpMethod(httpMethod);
        return ori;
    }
View Full Code Here

        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

     * @param values template variable values
     * @return updated WebClient
     */
    public WebClient path(String path, Object... values) {
        URI u = UriBuilder.fromUri(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

TOP

Related Classes of org.apache.cxf.jaxrs.model.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.