Package com.sun.jersey.api.container

Examples of com.sun.jersey.api.container.ContainerException


                    throw (WebApplicationException)target;
                } else {
                    throw new ExtractorContainerException(target);
                }
            } catch (Exception ex) {
                throw new ContainerException(ex);
            }
        }
View Full Code Here


                providerFactoryClass = PerRequestFactory.class;
            } else if (v instanceof String) {
                try {
                    providerFactoryClass = getSubclass(ReflectionHelper.classForNameWithException((String)v));
                } catch (ClassNotFoundException ex) {
                    throw new ContainerException(ex);
                }
            } else if (v instanceof Class) {
                providerFactoryClass = getSubclass((Class)v);
            } else {
                throw new IllegalArgumentException("Property value for "
View Full Code Here

            ComponentConstructor<ResourceComponentProviderFactory> cc =
                    new ComponentConstructor(ipc, providerFactoryClass, ci);

            return cc.getInstance();
        } catch (Exception ex) {
            throw new ContainerException("Unable to create resource component provider", ex);
        }
    }
View Full Code Here

                try {
                    return CollectionStringReaderExtractor.getInstance(
                            parameter, sr, parameterName, defaultValue);
                } catch (Exception e) {
                    throw new ContainerException("Could not process parameter type " + parameter, e);
                }
            }
        } else if (parameter == String.class) {
            return new StringExtractor(parameterName, defaultValue);
        } else if (parameter.isPrimitive()) {
            // Convert primitive to wrapper class
            parameter = PrimitiveMapper.primitiveToClassMap.get(parameter);
            if (parameter == null) {
                // Primitive type not supported
                return null;
            }

            // Check for static valueOf(String )
            Method valueOf = ReflectionHelper.getValueOfStringMethod(parameter);
            if (valueOf != null) {
                try {
                    Object defaultDefaultValue = PrimitiveMapper.primitiveToDefaultValueMap.get(parameter);
                    return new PrimitiveValueOfExtractor(valueOf, parameterName,
                            defaultValue, defaultDefaultValue);
                } catch (Exception e) {
                    throw new ContainerException(ImplMessages.DEFAULT_COULD_NOT_PROCESS_METHOD(defaultValue, valueOf));
                }
            }

        } else {
            final StringReader sr = w.getStringReader(parameter, parameterType, annotations);
            if (sr == null)
                return null;

            try {
                return new StringReaderExtractor(sr, parameterName, defaultValue);
            } catch (Exception e) {
                throw new ContainerException("Could not process parameter type " + parameter, e);
            }
        }

        return null;
    }
View Full Code Here

        int i = 0;
        for (Field f : singletonFields) {
            try {
                f.set(o, singletonFieldValues[i++]);
            } catch (IllegalAccessException ex) {
                throw new ContainerException(ex);
            }
        }
       
        i = 0;
        for (Field f : perRequestFields) {
            try {
                f.set(o, perRequestFieldInjectables[i++].getValue(c));
            } catch (IllegalAccessException ex) {
                throw new ContainerException(ex);
            }
        }
       
        i = 0;
        for (Method m : singletonSetters) {
            try {
                m.invoke(o, singletonSetterValues[i++]);
            } catch (Exception ex) {
                throw new ContainerException(ex);
            }
        }
       
        i = 0;
        for (Method m : perRequestSetters) {
            try {
                m.invoke(o, perRequestSetterInjectables[i++].getValue(c));
            } catch (Exception ex) {
                throw new ContainerException(ex);
            }
        }
    }
View Full Code Here

        if (classes.isEmpty() &&
                singletons.isEmpty() &&
                resourceConfig.getExplicitRootResources().isEmpty()) {
            LOGGER.severe(ImplMessages.NO_ROOT_RES_IN_RES_CFG());
            throw new ContainerException(ImplMessages.NO_ROOT_RES_IN_RES_CFG());
        }

        final Set<AbstractResource> rootResourcesSet = wa.getAbstractRootResources();
        final Map<String, AbstractResource> explicitRootResources = wa.getExplicitAbstractRootResources();
View Full Code Here

                // Buffer input
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                try {
                    ReaderWriter.writeTo(in, baos);
                } catch (IOException ex) {
                    throw new ContainerException(ex);
                }
                in = new ByteArrayInputStream(baos.toByteArray());
                request.setEntityInputStream(in);
            }
View Full Code Here

        if (u.isAbsolute()) {
            // TODO check if base is a base of u
            URI r = base.relativize(u);
            if (r == u) {
                throw new ContainerException("The URI " + u + " is not relative to the base URI " + base);
            }
        } else {
            u = UriBuilder.fromUri(base).
                    path(u.getRawPath()).
                    replaceQuery(u.getRawQuery()).
View Full Code Here

* @author Paul.Sandoz@Sun.Com
*/
public final class ErrorHelper {
   
    public static ContainerException objectNotAWebResource(Class resourceClass) {
        return new ContainerException(ImplMessages.OBJECT_NOT_A_WEB_RESOURCE(resourceClass.getName()));
    }
View Full Code Here

    public static ContainerException objectNotAWebResource(Class resourceClass) {
        return new ContainerException(ImplMessages.OBJECT_NOT_A_WEB_RESOURCE(resourceClass.getName()));
    }
   
    public static ContainerException badClassConsumes(Exception e, Class resourceClass, Consumes c) {
        return new ContainerException(ImplMessages.BAD_CLASS_CONSUMEMIME(resourceClass,
                                                                                           c.value()), e);
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.container.ContainerException

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.