@RequestMapping(value = "/saveEvent", method = RequestMethod.POST)
 public String saveEvent(
     HttpServletRequest request,
     @ModelAttribute("event") EditEvent event,
     BindingResult result,
     SessionStatus status,
     Model uiModel) {
   User user = (User) request.getSession().getAttribute(Constants.KME_USER_KEY);
   EditEvent eventReturned = null;
   try {
     eventReturned =
         calendarEventOAuthService.saveEvent(user.getUserId(), event, event.getEventId());
     if (eventReturned.getResponseCode() == HttpStatus.UNPROCESSABLE_ENTITY.value()) {
       Errors errors = ((Errors) result);
       for (Iterator iterator = eventReturned.getErrors().entrySet().iterator();
           iterator.hasNext(); ) {
         Map.Entry<String, List<String>> entry = (Map.Entry<String, List<String>>) iterator.next();
         for (String error : entry.getValue()) {
           errors.rejectValue(entry.getKey(), "", error);
         }
       }
       event.setDefaultCategories(eventReturned.getDefaultCategories());
       return "calendar/editEvent";
     }
   } catch (PageLevelException pageLevelException) {
     uiModel.addAttribute("message", pageLevelException.getMessage());
     return "calendar/message";
   }
   return "redirect:/calendar/month";
 }
  @RequestMapping(value = "passes/{passTypeId}/{serialNo}", method = RequestMethod.GET)
  public void getPass(
      WebRequest webRequest,
      HttpServletResponse response,
      @PathVariable String passTypeId,
      @PathVariable String serialNo,
      @RequestHeader(value = "Authorization", defaultValue = "not_provided") String authorization)
      throws IOException {

    final String authToken = getAuthToken(authorization);
    //        if (null == authToken) {
    //            response.sendError(HttpStatus.UNAUTHORIZED.value());
    //            return;
    //        }

    try {
      //            final AbstractPassEntity pass = passbookService.getPass(passTypeId, serialNo,
      // authToken);
      //
      //            final long lastModified = pass.getUpdatedDate().getTime();
      //            if (webRequest.checkNotModified(lastModified)) {
      //                // shortcut exit - no further processing necessary
      //                return;
      //            }

      // write the .pkpass to the response
      ServletOutputStream out = response.getOutputStream();
      response.setContentType(CONTENT_TYPE_PASS);
      response.setHeader(CONTENT_DISPOSITION__NAME, CONTENT_DISPOSITION_VALUE);
      int length = passbookService.writePass(out, passTypeId, serialNo);
      out.flush();
      out.close();
      response.setStatus(HttpStatus.OK.value());
      LOG.info("Wrote pass of {} bytes", length);
      return;

      //        } catch (NoSuchPassException ex) {
      //            response.sendError(HttpStatus.NOT_FOUND.value());
      //            return;
    } catch (NoSuchPassTypeException ex) {
      response.sendError(HttpStatus.UNPROCESSABLE_ENTITY.value());
      return;
      //        } catch (InvalidAuthTokenException ex) {
      //            response.sendError(HttpStatus.UNAUTHORIZED.value());
      //            return;
    } catch (Exception ex) {
      LOG.error("Exception thrown by Service.writePass", ex);
      response.sendError(HttpStatus.INTERNAL_SERVER_ERROR.value());
      return;
    }
  }