Example usage for org.springframework.web.bind ServletRequestBindingException ServletRequestBindingException

List of usage examples for org.springframework.web.bind ServletRequestBindingException ServletRequestBindingException

Introduction

In this page you can find the example usage for org.springframework.web.bind ServletRequestBindingException ServletRequestBindingException.

Prototype

public ServletRequestBindingException(String msg, Throwable cause) 

Source Link

Document

Constructor for ServletRequestBindingException.

Usage

From source file:com.laxser.blitz.web.paramresolver.ServletRequestDataBinder.java

/**
 * Treats errors as fatal.// w  w  w . jav  a  2 s. co m
 * <p>
 * Use this method only if it's an error if the input isn't valid. This
 * might be appropriate if all input is from dropdowns, for example.
 * 
 * @throws ServletRequestBindingException subclass of ServletException
 *         on any binding problem
 */
public void closeNoCatch() throws ServletRequestBindingException {
    if (getBindingResult().hasErrors()) {
        throw new ServletRequestBindingException(
                "Errors binding onto object '" + getBindingResult().getObjectName() + "'",
                new BindException(getBindingResult()));
    }
}

From source file:org.kuali.rice.ken.web.spring.AdministerNotificationRequestController.java

/**
 * This method handles approval/disapproval/acknowledgement of the notification request
 * @param request the HttpServletRequest
 * @param response the HttpServletResponse
 * @param command the command object bound for this MultiActionController
 * @throws ServletException/*  ww w . ja  v  a 2  s  . c o m*/
 */
private void administerEventNotificationMessage(HttpServletRequest request, HttpServletResponse response,
        AdministerNotificationRequestCommand command, String action) throws ServletException {
    LOG.debug("remoteUser: " + request.getRemoteUser());

    BindException bindException = new BindException(command, "command");
    ValidationUtils.rejectIfEmpty(bindException, "docId", "Document id must be specified");
    if (bindException.hasErrors()) {
        throw new ServletRequestBindingException("Document id must be specified", bindException);
    }

    // obtain a workflow user object first
    //WorkflowIdDTO user = new WorkflowIdDTO(request.getRemoteUser());
    String userId = request.getRemoteUser();

    try {
        // now construct the workflow document, which will interact with workflow
        WorkflowDocument document = NotificationWorkflowDocument.loadNotificationDocument(userId,
                command.getDocId());

        NotificationBo notification = retrieveNotificationForWorkflowDocument(document);

        String initiatorPrincipalId = document.getInitiatorPrincipalId();
        Person initiator = KimApiServiceLocator.getPersonService().getPerson(initiatorPrincipalId);
        String notificationBlurb = notification.getContentType().getName() + " notification submitted by "
                + initiator.getName() + " for channel " + notification.getChannel().getName();
        if ("disapprove".equals(action)) {
            document.disapprove("User " + userId + " disapproving " + notificationBlurb);
        } else if ("approve".equals(action)) {
            document.approve("User " + userId + " approving " + notificationBlurb);
        } else if ("acknowledge".equals(action)) {
            document.acknowledge("User " + userId + " acknowledging " + notificationBlurb);
        }
    } catch (Exception e) {
        LOG.error("Exception occurred taking action on notification request", e);
        throw new ServletException("Exception occurred taking action on notification request", e);
    }
}