Package javax.ws.rs

Examples of javax.ws.rs.BadRequestException


        } else if (statusCode == HttpStatus.SC_UNAUTHORIZED) {
            ex = new AccessControlException("Remote unauthorized exception");

            // 3. Map SC_BAD_REQUEST
        } else if (statusCode == HttpStatus.SC_BAD_REQUEST) {
            ex = new BadRequestException();

        } else {
            // 4. All other codes are mapped to runtime exception with HTTP code information
            ex = new WebServiceException(String.format("Remote exception with status code: %s",
                    Response.Status.fromStatusCode(statusCode).name()));
View Full Code Here


        return new InternalServerErrorException(checkResponse(response, 500), cause);
    }
   
    public static BadRequestException toBadRequestException(Throwable cause, Response response) {
       
        return new BadRequestException(checkResponse(response, 400), cause);
    }
View Full Code Here

                List<AuditLoggerName> auditNames = Arrays.asList(getRestTemplate().getForObject(
                        baseUrl + "logger/audit/list", AuditLoggerName[].class));
                return CollectionWrapper.unwrapLogger(auditNames);

            default:
                throw new BadRequestException();
        }
    }
View Full Code Here

            case AUDIT:
                try {
                    getRestTemplate().put(baseUrl + "logger/audit/enable", AuditLoggerName.fromLoggerName(name));
                } catch (Exception e) {
                    throw new BadRequestException(e);
                }
                break;

            default:
                throw new BadRequestException();
        }
    }
View Full Code Here

                break;
            case AUDIT:
                try {
                    getRestTemplate().put(baseUrl + "logger/audit/disable", AuditLoggerName.fromLoggerName(name));
                } catch (Exception e) {
                    throw new BadRequestException(e);
                }
                break;

            default:
                throw new BadRequestException();
        }

    }
View Full Code Here

        return new InternalServerErrorException(checkResponse(response, 500), cause);
    }
   
    public static BadRequestException toBadRequestException(Throwable cause, Response response) {
       
        return new BadRequestException(checkResponse(response, 400), cause);
    }
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 (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

             * If user asked for a null, give them a null.
             */
            return null;
        }
       
        throw new BadRequestException();
       
    }
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

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.