Package javax.ws.rs

Examples of javax.ws.rs.BadRequestException


            throw new WebApplicationException(413);
        } catch (WebApplicationException e) {
            throw e;
        } catch (Exception e) {
            LOG.warning(getStackTrace(e));
            throw new BadRequestException(e);       
        } finally {
            try {
                StaxUtils.close(reader);
            } catch (XMLStreamException e) {
                // Ignore
View Full Code Here


                //
                if (pType == ParameterType.PATH || pType == ParameterType.QUERY
                    || pType == ParameterType.MATRIX) {
                    throw new NotFoundException(nfe);
                }
                throw new BadRequestException(nfe);
            }
        }
       
        boolean adapterHasToBeUsed = false;
        Class<?> cls = pClass;       
View Full Code Here

            }
            String cdName = cd == null ? null : cd.getParameter("name");
            String contentId = a.getContentId();
            String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"", "").replace("'", "");
            if (StringUtils.isEmpty(name)) {
                throw new BadRequestException();
            }
            if (CONTENT_DISPOSITION_FILES_PARAM.equals(name)) {
                // this is a reserved name in Content-Disposition for parts containing files
                continue;
            }
            try {
                String value = IOUtils.toString(a.getDataHandler().getInputStream());
                params.add(HttpUtils.urlDecode(name),
                           decode ? HttpUtils.urlDecode(value) : value);
            } catch (IllegalArgumentException ex) {
                LOG.warning("Illegal URL-encoded characters, make sure that no "
                    + "@FormParam and @Multipart annotations are mixed up");
                throw new InternalServerErrorException();
            } catch (IOException ex) {
                throw new BadRequestException();
            }
        }
    }
View Full Code Here

             * If user asked for a null, give them a null.
             */
            return null;
        }
       
        throw new BadRequestException();
       
    }
View Full Code Here

                                                     parameterAnnotations,
                                                     is,
                                                     type,
                                                     m);   
                } catch (NoContentException e) {
                    throw new BadRequestException(e);
                } catch (IOException e) {
                    throw e;
                } catch (WebApplicationException ex) {
                    throw ex;
                } catch (Exception ex) {
View Full Code Here

    protected static void handleExceptionEnd(Throwable t, String message, boolean read) {
        Response.Status status = read
            ? Response.Status.BAD_REQUEST : Response.Status.INTERNAL_SERVER_ERROR;
        Response r = Response.status(status)
            .type(MediaType.TEXT_PLAIN).entity(message).build();
        throw read ? new BadRequestException(r, t) : new InternalServerErrorException(r, t);
    }
View Full Code Here

            reader = createReader(clazz, genericType, is);
            DataReader<XMLStreamReader> dataReader = binding.createReader(XMLStreamReader.class);
            Object o = dataReader.read(null, reader, clazz);
            return o == null ? null : clazz.cast(o);
        } catch (Exception ex) {
            throw new BadRequestException(ex);
        } finally {
            try {
                StaxUtils.close(reader);
            } catch (XMLStreamException e) {
                // Ignore
View Full Code Here

           
            return getFormObject(clazz, params);
        } catch (WebApplicationException e) {
            throw e;
        } catch (Exception e) {
            throw new BadRequestException(e);
        }
    }
View Full Code Here

                    return Response.ok().type(MediaType.APPLICATION_XML_TYPE).entity(new DOMSource(docEl))
                        .build();
                }
            } catch (Exception ex) {
                throw new BadRequestException();
            }

        }
        return null;
    }
View Full Code Here

            OAuthAuthorizationData secData = new OAuthAuthorizationData();
            if (!compareRequestSessionTokens(request, oAuthMessage)) {
                if (decision != null) {
                    // this is a user decision request, the session has expired or been possibly hijacked
                    LOG.warning("Session authenticity token is missing or invalid");
                    throw new BadRequestException();
                }
                // assume it is an initial authorization request
                addAuthenticityTokenToSession(secData, request);
                return Response.ok(
                        addAdditionalParams(secData, dataProvider, token)).build();
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.