@POST
  @Path("/feedback/location/{deviceId}")
  public Response getClientFeedback(
      @PathParam("deviceId") String deviceId,
      @FormParam("rating") String rating,
      @FormParam("comment") String comment) {
    WirelessClient client = mobileServerCacheService.getWirelessClientByUniqueID(deviceId);
    if (client == null) {
      // Forbidden better than File Not Found - it doesn't leak
      // information
      LOGGER.trace("Unable to determine client MAC address from device ID '{}'", deviceId);
      return Response.status(Response.Status.UNAUTHORIZED).build();
    }
    LOGGER.info("Rating and comment is", rating, comment);
    SendEmail sendMail =
        new SendEmail(
            EmailProperties.getInstance().getFeedbackToAddress(),
            EmailProperties.getInstance().getFeedbackFromAddress());
    StringBuffer mailBody =
        new StringBuffer("Rating is ").append(rating).append(EMAIL_LINE_FEED_CHAR);
    mailBody.append("Current Location:").append(EMAIL_LINE_FEED_CHAR);
    mailBody.append("MAC Address: ").append(client.getMacAddress()).append(EMAIL_LINE_FEED_CHAR);
    mailBody.append("Venue UDID: ").append(client.getVenueUdId()).append(EMAIL_LINE_FEED_CHAR);
    mailBody.append("Floor ID: ").append(client.getFloorId()).append(EMAIL_LINE_FEED_CHAR);
    mailBody.append("Zone ID: ").append(client.getZoneId()).append(EMAIL_LINE_FEED_CHAR);
    mailBody
        .append("Map Location : (")
        .append(client.getX())
        .append(",")
        .append(client.getY())
        .append(")")
        .append(EMAIL_LINE_FEED_CHAR);
    mailBody
        .append("GPS Location : Latitude - ")
        .append(client.getLatitude())
        .append(" Longitude - ")
        .append(client.getLongitude())
        .append(EMAIL_LINE_FEED_CHAR);
    mailBody
        .append("Last Update Time : ")
        .append(DateFormat.getInstance().format(new Date(client.getLastLocationUpdateTime())))
        .append(EMAIL_LINE_FEED_CHAR);
    mailBody
        .append("Last Calculation Time : ")
        .append(DateFormat.getInstance().format(new Date(client.getLastLocationCalculationTime())))
        .append(EMAIL_LINE_FEED_CHAR);
    mailBody.append("Comment is : ").append(comment);

    sendMail.sendMail(EmailProperties.getInstance().getFeedbackSubject(), mailBody.toString());
    return Response.ok().build();
  }
  @GET
  @Path("/location/{deviceId}")
  /*
   * @PreAuthorize( "hasRole('mobileAppUser')")
   */
  @Produces(MediaType.APPLICATION_JSON)
  public Response getClientsByMAC(@PathParam("deviceId") String deviceId) {
    MDC.put(MDCKeys.DEVICE_ID, deviceId);
    MobileAppStats.getInstance().incrementLocationRequestsCount();
    LOGGER.trace("Request to retrieve client current location for device ID '{}'", deviceId);

    WirelessClient macClientLocation =
        mobileServerCacheService.getWirelessClientByUniqueID(deviceId);
    if (macClientLocation == null) {
      // Forbidden better than File Not Found - it doesn't leak
      // information
      LOGGER.trace("Unable to determine client MAC address from device ID '{}'", deviceId);
      MDC.remove(MDCKeys.DEVICE_ID);
      return Response.status(Response.Status.UNAUTHORIZED).build();
    }
    JSONObject clientObject = new JSONObject();
    try {
      clientObject.accumulate("deviceId", macClientLocation.getUniqueID());
      clientObject.accumulate(
          "lastLocationUpdateTime", macClientLocation.getLastLocationUpdateTime());
      clientObject.accumulate("venueId", macClientLocation.getVenueUdId());
      clientObject.accumulate("floorId", macClientLocation.getFloorId());
      try {
        if (!macClientLocation.getZoneId().isEmpty()) {
          clientObject.accumulate("zoneId", macClientLocation.getZoneId());
          clientObject.accumulate("zoneName", macClientLocation.getZoneName());
          clientObject.accumulate("zonePoints", macClientLocation.getZonePoints());
        }
      } catch (Exception ex) {
        LOGGER.error(
            "Error during zone object creation for device ID '{}'",
            deviceId,
            ex.getLocalizedMessage());
      }
      JSONObject locationObject = new JSONObject();
      locationObject.accumulate("x", macClientLocation.getX());
      locationObject.accumulate("y", macClientLocation.getY());
      clientObject.accumulate("mapCoordinate", locationObject);

      JSONObject geoCoordinateObject = new JSONObject();
      geoCoordinateObject.accumulate("latitude", macClientLocation.getLatitude());
      geoCoordinateObject.accumulate("longitude", macClientLocation.getLongitude());
      clientObject.accumulate("geoCoordinate", geoCoordinateObject);

      LOGGER.trace(
          "Completed setting current location for device ID '{}' with MAC Address '{}'",
          deviceId,
          macClientLocation.getMacAddress());
    } catch (Exception e) {
      LOGGER.error(
          "Error during location object creation for device ID '{}'",
          deviceId,
          e.getLocalizedMessage());
    }
    LOGGER.trace("Returning JSON object with device ID '{}' : {}", deviceId, clientObject);
    MDC.remove(MDCKeys.DEVICE_ID);
    if (macClientLocation.getFloorId() == null
        || macClientLocation.getFloorId().length() <= 0
        || macClientLocation.getVenueUdId() == null
        || macClientLocation.getVenueUdId().length() <= 0) {
      return Response.status(Response.Status.NOT_FOUND).entity(clientObject).build();
    }
    return Response.status(Response.Status.OK).entity(clientObject).build();
  }