Package javax.ws.rs

Examples of javax.ws.rs.Path


        for (Method m : cri.getServiceClass().getMethods()) {
           
            Method annotatedMethod = AnnotationUtils.getAnnotatedMethod(m);
           
            String httpMethod = AnnotationUtils.getHttpMethodValue(annotatedMethod);
            Path path = (Path)AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class);
           
            if (httpMethod != null || path != null) {
                md.bind(createOperationInfo(m, annotatedMethod, cri, path, httpMethod), m);
                if (httpMethod == null) {
                    // subresource locator
View Full Code Here


            processDataClass(doc, classElementIn, xmlRoot);
            return;
        }

        // NO data class, so it is the api.
        Path basePath = classElementIn.getAnnotation(Path.class);
        if (basePath==null || basePath.value().isEmpty()) {
            log.debug("No @Path found on " + classElementIn.getQualifiedName() + " - skipping");
            return;
        }

        Element classElement = doc.createElement("class");
        String className = classElementIn.toString();
        classElement.setAttribute("name",className);
        String value = basePath.value();
        value = cleanOutPath(value);
        classElement.setAttribute("path", value);
        Api api = classElementIn.getAnnotation(Api.class);
        if (api!=null) {
            String shortDescription = api.value();
View Full Code Here

    private void processMethods(Document doc, ExecutableElement td, Element classElement) {

        log.debug("  Looking at method " + td.getSimpleName().toString());

        Path pathAnnotation = td.getAnnotation(Path.class);
        if (pathAnnotation==null) {
            return;
        }
        String path = pathAnnotation.value();
        path = cleanOutPath(path);

        Element methodElement = doc.createElement("method");
        methodElement.setAttribute("path",path);
        classElement.appendChild(methodElement);
View Full Code Here

        }
        return false;
    }

    private boolean parsePath(Class<?> cls) {
        Path path = cls.getAnnotation(Path.class);
        if (path != null) {
            getMetadata().addPath(path.value());
            return true;
        }

        Class<?> declaringClass = cls;

        while (!declaringClass.equals(Object.class)) {
            // try a superclass
            Class<?> superclass = declaringClass.getSuperclass();
            path = superclass.getAnnotation(Path.class);
            if (path != null) {
                getMetadata().addPath(path.value());
                return true;
            }

            // try interfaces
            Class<?>[] interfaces = declaringClass.getInterfaces();
            for (Class<?> interfaceClass : interfaces) {
                path = interfaceClass.getAnnotation(Path.class);
                if (path != null) {
                    getMetadata().addPath(path.value());
                    return true;
                }
            }
            declaringClass = declaringClass.getSuperclass();
        }
View Full Code Here

        if (httpMethod != null) {
            hasAnnotation = true;
            metadata.setHttpMethod(httpMethod.value());
        }

        Path path = getPath(method);
        if (path != null) {
            hasAnnotation = true;
            metadata.addPath(path.value());
        }

        String[] consumes = getConsumes(method);
        for (String mediaType : consumes) {
            hasAnnotation = true;
View Full Code Here

        logger.debug("path({}) entry", resource); //$NON-NLS-1$
        if (resource == null) {
            throw new IllegalArgumentException("resource is null");
        }
        isFirstCall = false;
        Path pathAnnotation = ((Class<?>)resource).getAnnotation(Path.class);
        if (pathAnnotation == null) {
            throw new IllegalArgumentException("resource is not annotated with Path");
        }
        String path = pathAnnotation.value();
        logger.debug("path annotation value is {}", path); //$NON-NLS-1$
        path(path);
        logger.debug("path() exit"); //$NON-NLS-1$
        return this;
    }
View Full Code Here

    public UriBuilder path(Method method) throws IllegalArgumentException {
        logger.debug("path({}) entry", method); //$NON-NLS-1$
        if (method == null) {
            throw new IllegalArgumentException("method is null");
        }
        Path pathAnnotation = method.getAnnotation(Path.class);
        if (pathAnnotation == null) {
            throw new IllegalArgumentException("method is not annotated with Path");
        }
        String path = pathAnnotation.value();
        logger.debug("path method annotation is {}", path); //$NON-NLS-1$
        path(path);
        logger.debug("path() exit"); //$NON-NLS-1$
        return this;
    }
View Full Code Here

        Method foundMethod = null;
        Method[] methods = resource.getDeclaredMethods();
        for (Method m : methods) {
            if (m.getName().equals(method)) {
                Path pathAnnotation = m.getAnnotation(Path.class);
                if (pathAnnotation != null) {
                    if (foundMethod != null) {
                        throw new IllegalArgumentException(
                                                           "more than one method with Path annotation exists");
                    }
View Full Code Here

        for (Method m : cri.getServiceClass().getMethods()) {
           
            Method annotatedMethod = AnnotationUtils.getAnnotatedMethod(m);
           
            String httpMethod = AnnotationUtils.getHttpMethodValue(annotatedMethod);
            Path path = AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class);
           
            if (httpMethod != null || path != null) {
                md.bind(createOperationInfo(m, annotatedMethod, cri, path, httpMethod), m);
                if (httpMethod == null) {
                    // subresource locator
View Full Code Here

    public UriBuilder path(@SuppressWarnings("rawtypes") Class resource) throws IllegalArgumentException {
        if (resource == null) {
            throw new IllegalArgumentException("resource is null");
        }
        Class<?> cls = resource;
        Path ann = cls.getAnnotation(Path.class);
        if (ann == null) {
            throw new IllegalArgumentException("Class '" + resource.getCanonicalName()
                                               + "' is not annotated with Path");
        }
        // path(String) decomposes multi-segment path when necessary
        return path(ann.value());
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.Path

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.