@RequestMapping("stop")
 public String stop(@PathVariable("consumerName") String consumerName, ModelMap map)
     throws Exception {
   CamelConnection conn = connectionFactory.getConnection();
   ConsumerOperations ops = conn.getConsumerOperations(consumerName);
   ops.stop();
   map.put("message", "Context '" + consumerName + "' stopped");
   return getRedirect(consumerName);
 }
 @RequestMapping("browseMessageBody")
 @ResponseBody
 public String browseMessageBody(
     @RequestParam("endpointName") String endpointName, @RequestParam("offset") int offset)
     throws Exception {
   CamelConnection conn = connectionFactory.getConnection();
   String exchange = conn.getEndpointOperations(endpointName).browseMessageBody(offset);
   return exchange;
 }
 @RequestMapping
 public String show(
     @PathVariable("consumerName") String consumerName,
     ModelMap map,
     @RequestParam(value = "message", required = false) String message)
     throws Exception {
   CamelConnection conn = connectionFactory.getConnection();
   CamelBean consumer = conn.getConsumer(consumerName);
   map.put("consumer", consumer);
   map.put("message", message);
   return "consumer";
 }
  @RequestMapping(value = "message/{index}", method = RequestMethod.POST)
  public String message(
      @RequestParam("endpointName") String endpointName,
      @PathVariable("index") int index,
      ModelMap map)
      throws Exception {

    CamelConnection conn = connectionFactory.getConnection();
    EndpointOperations ops = conn.getEndpointOperations(endpointName);

    Message message = ops.browseMessageAsXml(index, true);
    map.put("message", message);

    return "message";
  }
  @RequestMapping(method = RequestMethod.POST)
  public String show(@RequestParam("endpointName") String endpointName, ModelMap map)
      throws Exception {

    CamelConnection conn = connectionFactory.getConnection();
    EndpointOperations ops = conn.getEndpointOperations(endpointName);

    CamelBean endpoint = conn.getEndpoint(endpointName);
    long queueSize = ops.queueSize();
    endpoint.getProperties().put("queueSize()", queueSize);

    map.put("endpoint", endpoint);

    try {
      List<Message> messages =
          ops.browseRangeMessagesAsXml(0, Math.min((int) queueSize, MAX_OVERVIEW_MESSAGES), false);
      map.put("messages", messages);
    } catch (Exception e) {
    }

    return "endpoint";
  }