Package javax.ws.rs

Examples of javax.ws.rs.BadRequestException


                    && rawType.isInstance(requestContext)) {
                value = requestContext;
            } else {
                value = requestContext.readEntity(rawType, parameter.getType(), parameter.getAnnotations());
                if (rawType.isPrimitive() && value == null) {
                    throw new BadRequestException(Response.status(Response.Status.BAD_REQUEST)
                            .entity(LocalizationMessages.ERROR_PRIMITIVE_TYPE_NULL()).build());
                }
            }
            return value;
View Full Code Here


                if (translateNce) {
                    try {
                        entity = bodyReader.readFrom(context.getType(), context.getGenericType(), context.getAnnotations(),
                                context.getMediaType(), context.getHeaders(), input);
                    } catch (NoContentException ex) {
                        throw new BadRequestException(ex);
                    }
                } else {
                    entity = bodyReader.readFrom(context.getType(), context.getGenericType(), context.getAnnotations(),
                            context.getMediaType(), context.getHeaders(), input);
                }
View Full Code Here

                handleXMLStreamException(e, true);
            }
        } catch (WebApplicationException e) {
            throw e;
        } catch (Exception e) {
            throw new BadRequestException(e);
        } finally {
            StaxUtils.close(reader);
        }
        // unreachable
        return null;
View Full Code Here

        // Make sure the end user has authenticated, check if HTTPS is used
        SecurityContext securityContext = getAndValidateSecurityContext();
       
        // Make sure the session is valid
        if (!compareRequestAndSessionTokens(params.getFirst(OAuthConstants.SESSION_AUTHENTICITY_TOKEN))) {
            throw new BadRequestException();    
        }
        //TODO: additionally we can check that the Principal that got authenticated
        // in startAuthorization is the same that got authenticated in completeAuthorization
       
        Client client = getClient(params);
View Full Code Here

                handleXMLStreamException(e, true);
            }
        } catch (WebApplicationException e) {
            throw e;
        } catch (Exception e) {
            throw new BadRequestException(e);
        } finally {
            StaxUtils.close(reader);
        }
        // unreachable
        return null;
View Full Code Here

            result = parseXmlBean(type, r);

            xsr.close();

        } catch (XMLStreamException e) {
            throw new BadRequestException(e);
        }

        return result;
    }
View Full Code Here

                    new org.apache.cxf.common.i18n.Message("MULTTIPART_ID_NOT_FOUND",
                                                           BUNDLE,
                                                           id.value(),
                                                           mt.toString());
                LOG.warning(errorMsg.toString());
                throw new BadRequestException(
                          new MultipartReadException(id.value(), id.type(), errorMsg.toString()));
            } else {
                return null;
            }
        }
View Full Code Here

        XMLStreamReader xmlStreamReader = null;
        try {
            xmlStreamReader = createStreamReader(typeToRead, is);
            return type.cast(aegisReader.read(xmlStreamReader, typeToRead));
        } catch (Exception e) {
            throw new BadRequestException(e);
        } finally {
            try {
                StaxUtils.close(xmlStreamReader);
            } catch (XMLStreamException e) {
                throw new BadRequestException(e);
            }
        }
    }
View Full Code Here

                handleXMLStreamException(e, true);
            }
        } catch (WebApplicationException e) {
            throw e;
        } catch (Exception e) {
            throw new BadRequestException(e);
        } finally {
            try {
                StaxUtils.close(reader);
            } catch (XMLStreamException e) {
                throw new BadRequestException(e);
            }
        }
        // unreachable
        return null;
    }
View Full Code Here

            writer.writeEndDocument();
            writer.flush();
            writer.close();
            return unmarshalFromInputStream(unmarshaller, out.getInputStream(), mt);
        } catch (Exception ex) {
            throw new BadRequestException(ex);
        }
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.BadRequestException

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.