Package org.fcrepo.server.errors.servletExceptionExtensions

Examples of org.fcrepo.server.errors.servletExceptionExtensions.BadRequest400Exception


            throws ServletException, IOException {
        String actionLabel = "server control";
        String action = request.getParameter("action");

        if (action == null) {
            throw new BadRequest400Exception(request,
                                             actionLabel,
                                             "no action",
                                             new String[0]);
        }

        if (action.equals("status")) {
            statusAction(request, response);
        } else if (action.equals("reloadPolicies")) {
            reloadPoliciesAction(request, response);
        } else if (action.equals("modifyDatastreamControlGroup")) {
            modifyDatastreamControlGroupAction(request, response);
        } else {
            throw new BadRequest400Exception(request, actionLabel, "bad action:  "
                                             + action, new String[0]);
        }
    }
View Full Code Here


            // Request is either unversioned or versioned listMethods request
            try {
                PID = Server.getPID(URIArray[5]).toString(); // normalize PID
            } catch (Throwable th) {
                logger.error("Bad pid syntax in request", th);
                throw new BadRequest400Exception(request,
                                                 ACTION_LABEL,
                                                 "",
                                                 new String[0]);
            }
            if (URIArray.length == 7) {
                // Request is a versioned listMethods request
                try {
                    versDateTime = DateUtility.parseDateStrict(URIArray[6]);
                } catch(ParseException e) {
                    logger.error("Bad date format in request");
                    throw new BadRequest400Exception(request,
                                                     ACTION_LABEL,
                                                     "",
                                                     new String[0]);
                }
                asOfDateTime = versDateTime;
            }
            logger.debug("Listing methods (PID=" + PID + ", asOfDate="
                    + versDateTime + ")");
        } else {
            logger.error("Bad syntax (expected 6 or 7 parts) in request");
            throw new BadRequest400Exception(request,
                                             ACTION_LABEL,
                                             "",
                                             new String[0]);
        }
View Full Code Here

            // request
            try {
                PID = Server.getPID(URIArray[5]).toString(); // normalize PID
            } catch (Throwable th) {
                logger.error("Bad pid syntax in request", th);
                throw new BadRequest400Exception(request,
                                                 ACTION_LABEL,
                                                 "",
                                                 new String[0]);
            }
            if (URIArray.length == 7) {
                // Request is a versioned listDatastreams request
                try {
                versDateTime = DateUtility.parseDateStrict(URIArray[6]);
                } catch(ParseException e) {
                    logger.error("Bad date format in request");
                    throw new BadRequest400Exception(request,
                                                     ACTION_LABEL,
                                                     "",
                                                     new String[0]);
                }
                asOfDateTime = versDateTime;
            }
            logger.debug("Listing datastreams (PID=" + PID + ", asOfDate="
                    + versDateTime + ")");
        } else {
            logger.error("Bad syntax (expected 6 or 7 parts) in request");
            throw new BadRequest400Exception(request,
                                             ACTION_LABEL,
                                             "",
                                             new String[0]);
        }
View Full Code Here

        boolean xml = false;

        // Parse servlet URL.
        String[] URIArray = request.getRequestURL().toString().split("/");
        if (URIArray.length != 6 || !URIArray[4].equals("getObjectHistory")) {
            throw new BadRequest400Exception(request,
                                             ACTION_LABEL,
                                             "",
                                             new String[0]);
        }
View Full Code Here

                            Integer
                                    .parseInt(request
                                            .getParameter("maxResults"));
                } catch (NumberFormatException nfe) {
                    logger.error("Bad request (maxResults not an integer)", nfe);
                    throw new BadRequest400Exception(request,
                                                     ACTION_LABEL,
                                                     "",
                                                     new String[0]);
                }
            }
View Full Code Here

TOP

Related Classes of org.fcrepo.server.errors.servletExceptionExtensions.BadRequest400Exception

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.