Examples of PathSegment


Examples of javax.ws.rs.core.PathSegment

            throw new IllegalArgumentException("path is null");
        }
       
        List<PathSegment> segments = JAXRSUtils.getPathSegments(path, false, false);
        if (!paths.isEmpty() && !matrix.isEmpty()) {
            PathSegment ps = paths.remove(paths.size() - 1);
            paths.add(replacePathSegment(ps));
        }
        paths.addAll(segments);
        matrix.clear();
        if (!paths.isEmpty()) {
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

   
    private String buildPath(boolean fromEncoded) {
        StringBuilder sb = new StringBuilder();
        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 (!p.startsWith("/")) {
                    sb.append('/');
                }
                sb.append(p);
                if (iter.hasNext()) {
                    buildMatrix(sb, ps.getMatrixParameters(), fromEncoded);
                }
            }
        }
        buildMatrix(sb, matrix, fromEncoded);
        return sb.toString();
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

        List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
                                                           values,
                                                           messageImpl);
        assertEquals("2 params should've been identified", 2, params.size());
       
        PathSegment ps = (PathSegment)params.get(0);
        assertEquals("bar foo", ps.getPath());
        assertEquals(1, ps.getMatrixParameters().size());
        assertEquals("0 1", ps.getMatrixParameters().getFirst("p4"));
        assertEquals("bar foo", params.get(1));
    }
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

        Message m = createMessage();
       
       
        List<Object> params =
            JAXRSUtils.processParameters(ori, values, m);
        PathSegment ps = (PathSegment)params.get(0);
        assertEquals("1", ps.getPath());
       
        SimpleFactory sf = (SimpleFactory)params.get(1);
        assertEquals(2, sf.getId());
    }
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

        if (value == null) {
            return null;
        }
       
        if (pType == ParameterType.PATH) {
            PathSegment ps = new PathSegmentImpl(value, false);   
            if (PathSegment.class.isAssignableFrom(pClass)) {
                return ps;  
            } else {
                value = ps.getPath();                
            }
        }
       
        if (pClass.isPrimitive()) {
            try {
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

        if (value == null) {
            return null;
        }
       
        if (pType == ParameterType.PATH) {
            PathSegment ps = new PathSegmentImpl(value, false);   
            if (PathSegment.class.isAssignableFrom(pClass)) {
                return ps;  
            } else {
                value = ps.getPath();                
            }
        }
       
        if (pClass.isPrimitive()) {
            try {
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

        List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m, null),
                                                           values,
                                                           messageImpl);
        assertEquals("2 params should've been identified", 2, params.size());
       
        PathSegment ps = (PathSegment)params.get(0);
        assertEquals("bar foo", ps.getPath());
        assertEquals(1, ps.getMatrixParameters().size());
        assertEquals("0 1", ps.getMatrixParameters().getFirst("p4"));
        assertEquals("bar foo", params.get(1));
    }
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

        Message m = createMessage();
       
       
        List<Object> params =
            JAXRSUtils.processParameters(ori, values, m);
        PathSegment ps = (PathSegment)params.get(0);
        assertEquals("1", ps.getPath());
       
        SimpleFactory sf = (SimpleFactory)params.get(1);
        assertEquals(2, sf.getId());
    }
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

            segments = new ArrayList<PathSegment>();
            path = path.replaceAll("/", "%2F");
            segments.add(new PathSegmentImpl(path, false));
        }
        if (!paths.isEmpty() && !matrix.isEmpty()) {
            PathSegment ps = paths.remove(paths.size() - 1);
            paths.add(replacePathSegment(ps));
        }
        paths.addAll(segments);
        matrix.clear();
        if (!paths.isEmpty()) {
View Full Code Here

Examples of javax.ws.rs.core.PathSegment

   
    private String buildPath(boolean fromEncoded) {
        StringBuilder sb = new StringBuilder();
        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('/');
                }
                sb.append(p);
                if (iter.hasNext()) {
                    buildMatrix(sb, ps.getMatrixParameters(), fromEncoded);
                }
            }
        }
        buildMatrix(sb, matrix, fromEncoded);
        return sb.toString();
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.