Package javax.ws.rs.ext

Examples of javax.ws.rs.ext.ContextResolver


      return clientErrorInterceptors;
   }

   public void addContextResolver(Class<? extends ContextResolver> resolver)
   {
      ContextResolver writer = null;
      try
      {
         writer = resolver.newInstance();
      }
      catch (InstantiationException e)
View Full Code Here


      return clientErrorInterceptors;
   }

   public void addContextResolver(Class<? extends ContextResolver> resolver)
   {
      ContextResolver writer = getProviderInstance(resolver);
      addContextResolver(writer);
   }
View Full Code Here

                if (pType.getRawType() != ContextResolver.class)
                    return null;
                Type type = pType.getActualTypeArguments()[0];
                // TODO check if concrete type
               
                final ContextResolver cr = getResolver(ic, type);
                if (cr == null) {
                    return new Injectable() {
                        public Object getValue() {
                            return null;
                        }                   
                    };
                } else {
                    return new Injectable() {
                        public Object getValue() {
                            return cr;
                        }
                    };
                }
            }
           
            ContextResolver getResolver(ComponentContext ic, Type type) {
                Map<MediaType, ContextResolver> x = resolver.get(type);
                if (x == null)
                    return null;
               
                List<MediaType> ms = getMediaTypes(ic);
                if (ms.size() == 1) {
                    return resolve(type, ms.get(0));
                } else {                   
                    Set<MediaType> ml = new TreeSet<MediaType>(MediaTypes.MEDIA_TYPE_COMPARATOR);
                    for (MediaType m : ms) {
                        if (m.isWildcardType()) {
                            ml.add(MediaTypes.GENERAL_MEDIA_TYPE);
                        } else if (m.isWildcardSubtype()) {
                            ml.add(new MediaType(m.getType(), "*"));
                            ml.add(MediaTypes.GENERAL_MEDIA_TYPE);
                        } else {
                            ml.add(new MediaType(m.getType(), m.getSubtype()));
                            ml.add(new MediaType(m.getType(), "*"));
                            ml.add(MediaTypes.GENERAL_MEDIA_TYPE);                        }
                    }

                    List<ContextResolver> crl = new ArrayList<ContextResolver>(ml.size());
                    for (MediaType m : ms) {
                        ContextResolver cr = x.get(m);
                        if (cr != null) crl.add(cr);
                    }
                    if (crl.isEmpty())
                        return null;

View Full Code Here

                if (pType.getRawType() != ContextResolver.class)
                    return null;
                Type type = pType.getActualTypeArguments()[0];
                // TODO check if concrete type
               
                final ContextResolver cr = getResolver(ic, type);
                if (cr == null) return null;
               
                return new Injectable() {
                    public Object getValue() {
                        return cr;
                    }
                };
            }
           
            ContextResolver getResolver(ComponentContext ic, Type type) {
                ContextResolver cr = null;
                MediaType[] ms = getMediaTypes(ic);
                if (ms.length == 1) {
                    cr = resolve(type, ms[0]);
                    if (cr == null)
                        return null;
View Full Code Here

                if (pType.getRawType() != ContextResolver.class)
                    return null;
                Type type = pType.getActualTypeArguments()[0];
                // TODO check if concrete type
               
                final ContextResolver cr = getResolver(ic, type);
                if (cr == null) {
                    return new Injectable() {
                        public Object getValue() {
                            return null;
                        }                   
                    };
                } else {
                    return new Injectable() {
                        public Object getValue() {
                            return cr;
                        }
                    };
                }
            }
           
            ContextResolver getResolver(ComponentContext ic, Type type) {
                Map<MediaType, ContextResolver> x = resolver.get(type);
                if (x == null)
                    return null;
               
                List<MediaType> ms = getMediaTypes(ic);
                if (ms.size() == 1) {
                    return resolve(type, ms.get(0));
                } else {                   
                    Set<MediaType> ml = new TreeSet<MediaType>(MediaTypes.MEDIA_TYPE_COMPARATOR);
                    for (MediaType m : ms) {
                        if (m.isWildcardType()) {
                            ml.add(MediaTypes.GENERAL_MEDIA_TYPE);
                        } else if (m.isWildcardSubtype()) {
                            ml.add(new MediaType(m.getType(), "*"));
                            ml.add(MediaTypes.GENERAL_MEDIA_TYPE);
                        } else {
                            ml.add(new MediaType(m.getType(), m.getSubtype()));
                            ml.add(new MediaType(m.getType(), "*"));
                            ml.add(MediaTypes.GENERAL_MEDIA_TYPE);                        }
                    }

                    List<ContextResolver> crl = new ArrayList<ContextResolver>(ml.size());
                    for (MediaType m : ms) {
                        ContextResolver cr = x.get(m);
                        if (cr != null) crl.add(cr);
                    }
                    if (crl.isEmpty())
                        return null;

View Full Code Here

      return clientErrorInterceptors;
   }

   protected void addContextResolver(Class<? extends ContextResolver> resolver, boolean builtin)
   {
      ContextResolver writer = createProviderInstance(resolver);
      addContextResolver(writer, resolver, builtin);
   }
View Full Code Here

   }

   public void addContextResolver(Class<? extends ContextResolver> resolver)
   {
      ContextResolver writer = null;
      try
      {
         writer = resolver.newInstance();
      }
      catch (InstantiationException e)
View Full Code Here

TOP

Related Classes of javax.ws.rs.ext.ContextResolver

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.