Package javax.ws.rs

Examples of javax.ws.rs.PathParam


            case PATH:
                p = new Param();
                p.setStyle(ParamStyle.TEMPLATE);
                for (Annotation a : annotations) {
                    if (PathParam.class.equals(a.annotationType())) {
                        PathParam paramAnn = (PathParam)a;
                        p.setName(paramAnn.value());
                    }
                }
                break;
            case QUERY:
                p = new Param();
                p.setStyle(ParamStyle.QUERY);
                for (Annotation a : annotations) {
                    if (QueryParam.class.equals(a.annotationType())) {
                        QueryParam paramAnn = (QueryParam)a;
                        p.setName(paramAnn.value());
                    }
                }
                break;
            case FORM:
                p = new Param();
                p.setStyle(ParamStyle.QUERY);
                for (Annotation a : annotations) {
                    if (FormParam.class.equals(a.annotationType())) {
                        FormParam paramAnn = (FormParam)a;
                        p.setName(paramAnn.value());
                    }
                }
                break;
            case CONTEXT:
                break;
            case COOKIE:
                break;
            case ENTITY:
                break;
        }

        if (p == null) {
            /*
             * The paramtype was never set so return null. This might have been
             * some other type of injectable that shouldn't be created as a
             * Param. This is a preventive measure.
             */
            return null;
        }

        Class<?> memberType = paramMetadata.getType();
        if (memberType.equals(int.class) || memberType.equals(Integer.class)) {
            p.setType(new QName(XML_SCHEMA_NS, "int"));
        } else if (memberType.equals(float.class) || memberType.equals(Float.class)) {
            p.setType(new QName(XML_SCHEMA_NS, "float"));
        } else if (memberType.equals(long.class) || memberType.equals(Long.class)) {
            p.setType(new QName(XML_SCHEMA_NS, "long"));
        } else if (memberType.equals(boolean.class) || memberType.equals(Boolean.class)) {
            p.setType(new QName(XML_SCHEMA_NS, "boolean"));
        } else if (memberType.equals(short.class) || memberType.equals(Short.class)) {
            p.setType(new QName(XML_SCHEMA_NS, "short"));
        } else if (memberType.equals(double.class) || memberType.equals(Double.class)) {
            p.setType(new QName(XML_SCHEMA_NS, "double"));
        } else if (memberType.equals(byte.class) || memberType.equals(Byte.class)) {
            p.setType(new QName(XML_SCHEMA_NS, "byte"));
        }

        for (Annotation a : annotations) {
            if (DefaultValue.class.equals(a.annotationType())) {
                DefaultValue paramAnn = (DefaultValue)a;
                p.setDefault(paramAnn.value());
            }

            if (WADLDoc.class.equals(a.annotationType())) {
                WADLDoc d = (WADLDoc)a;
                p.getDoc().add(getDocument(d));
View Full Code Here


   }

   private Multimap<String, Object> getPathParamKeyValues(Invocation invocation) {
      Multimap<String, Object> pathParamValues = LinkedHashMultimap.create();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PathParam.class)) {
         PathParam pathParam = param.getAnnotation(PathParam.class);
         String paramKey = pathParam.value();
         Optional<?> paramValue = getParamValue(invocation, param.getAnnotation(ParamParser.class), param.hashCode(),
               paramKey);
         if (paramValue.isPresent())
            pathParamValues.put(paramKey, paramValue.get().toString());
      }
View Full Code Here

        boolean isEncoded = AnnotationUtils.getAnnotation(anns, Encoded.class) != null;
        String dValue = AnnotationUtils.getDefaultParameterValue(anns);
       
        Parameter p = null;
       
        PathParam a = AnnotationUtils.getAnnotation(anns, PathParam.class);
        if (a != null) {
            p = new Parameter(ParameterType.PATH, index, a.value(), isEncoded, dValue);
        }
        if (p == null) {
            QueryParam q = AnnotationUtils.getAnnotation(anns, QueryParam.class);
            if (q != null) {
                p = new Parameter(ParameterType.QUERY, index, q.value(), isEncoded, dValue);
View Full Code Here

            throw new UnableToCompleteException();
        }
        String pathExpression = wrap(pathAnnotation.value());

        for (JParameter arg : method.getParameters()) {
            PathParam paramPath = getAnnotation(arg, PathParam.class);
            if (paramPath != null) {
                pathExpression = pathExpression(pathExpression, arg, paramPath);
            }
        }
View Full Code Here

            HashMap<String, JParameter> queryParams = new HashMap<String, JParameter>();
            HashMap<String, JParameter> formParams = new HashMap<String, JParameter>();
            HashMap<String, JParameter> headerParams = new HashMap<String, JParameter>();

            for (JParameter arg : args) {
                PathParam paramPath = getAnnotation(arg, PathParam.class);
                if (paramPath != null) {
                    if (pathExpression == null) {
                        getLogger().log(ERROR, "Invalid rest method.  Invalid @PathParam annotation. Method is missing the @Path annotation: " + method.getReadableDeclaration());
                        throw new UnableToCompleteException();
                    }
View Full Code Here

      if (defaultValue != null) defaultVal = defaultValue.value();

      QueryParam query;
      HeaderParam header;
      MatrixParam matrix;
      PathParam uriParam;
      CookieParam cookie;
      FormParam formParam;
      Form form;
      Suspend suspend;


      if ((query = FindAnnotation.findAnnotation(annotations, QueryParam.class)) != null)
      {
         return new QueryParamInjector(type, genericType, injectTarget, query.value(), defaultVal, encode, providerFactory);
      }
      else if ((header = FindAnnotation.findAnnotation(annotations, HeaderParam.class)) != null)
      {
         return new HeaderParamInjector(type, genericType, injectTarget, header.value(), defaultVal, providerFactory);
      }
      else if ((formParam = FindAnnotation.findAnnotation(annotations, FormParam.class)) != null)
      {
         return new FormParamInjector(type, genericType, injectTarget, formParam.value(), defaultVal, providerFactory);
      }
      else if ((cookie = FindAnnotation.findAnnotation(annotations, CookieParam.class)) != null)
      {
         return new CookieParamInjector(type, genericType, injectTarget, cookie.value(), defaultVal, providerFactory);
      }
      else if ((uriParam = FindAnnotation.findAnnotation(annotations, PathParam.class)) != null)
      {
         return new PathParamInjector(type, genericType, injectTarget, uriParam.value(), defaultVal, encode, providerFactory);
      }
      else if ((form = FindAnnotation.findAnnotation(annotations, Form.class)) != null)
      {
         return new FormInjector(type, providerFactory);
      }
View Full Code Here

        boolean isEncoded = AnnotationUtils.getAnnotation(anns, Encoded.class) != null;
        String dValue = AnnotationUtils.getDefaultParameterValue(anns);
       
        Parameter p = null;
       
        PathParam a = AnnotationUtils.getAnnotation(anns, PathParam.class);
        if (a != null) {
            p = new Parameter(ParameterType.PATH, index, a.value(), isEncoded, dValue);
        }
        if (p == null) {
            QueryParam q = AnnotationUtils.getAnnotation(anns, QueryParam.class);
            if (q != null) {
                p = new Parameter(ParameterType.QUERY, index, q.value(), isEncoded, dValue);
View Full Code Here

        boolean isEncoded = AnnotationUtils.isEncoded(anns, ori);
        String defaultValue = AnnotationUtils.getDefaultParameterValue(anns, ori);
       
        Object result = null;
       
        PathParam pathParam = AnnotationUtils.getAnnotation(anns, PathParam.class);
        if (pathParam != null) {
            result = readFromUriParam(message, pathParam, parameterClass, genericParam,
                                      values, defaultValue, !isEncoded);
        }
       
View Full Code Here

        boolean isEncoded = AnnotationUtils.isEncoded(anns, ori);
        String defaultValue = AnnotationUtils.getDefaultParameterValue(anns, ori);
       
        Object result = null;
       
        PathParam pathParam = AnnotationUtils.getAnnotation(anns, PathParam.class);
        if (pathParam != null) {
            result = readFromUriParam(message, pathParam, parameterClass, genericParam,
                                      values, defaultValue, !isEncoded);
        }
       
View Full Code Here

        Context ctx = AnnotationUtils.getAnnotation(anns, Context.class);
        if (ctx != null) {
            reportInvalidResourceMethod(ori.getMethodToInvoke(), "NO_CONTEXT_PARAMETERS");
        }
       
        PathParam a = AnnotationUtils.getAnnotation(anns, PathParam.class);
        if (a != null) {
            return new Parameter(ParameterType.PATH, index, a.value());
        }
       
        QueryParam q = AnnotationUtils.getAnnotation(anns, QueryParam.class);
        if (q != null) {
            return new Parameter(ParameterType.QUERY, index, q.value());
View Full Code Here

TOP

Related Classes of javax.ws.rs.PathParam

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.