protected void onPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try
{
final Queue sourceQueue = getQueueFromRequest(request);
ObjectMapper mapper = new ObjectMapper();
@SuppressWarnings("unchecked")
Map<String,Object> providedObject = mapper.readValue(request.getInputStream(), LinkedHashMap.class);
String destQueueName = (String) providedObject.get("destinationQueue");
Boolean move = (Boolean) providedObject.get("move");
final VirtualHost vhost = sourceQueue.getParent(VirtualHost.class);
boolean isMoveTransaction = move != null && Boolean.valueOf(move);
// FIXME: added temporary authorization check until we introduce management layer
// and review current ACL rules to have common rules for all management interfaces
String methodName = isMoveTransaction? "moveMessages":"copyMessages";
if (isQueueUpdateMethodAuthorized(methodName, vhost.getName()))
{
final Queue destinationQueue = getQueueFromVirtualHost(destQueueName, vhost);
final List messageIds = new ArrayList((List) providedObject.get("messages"));
QueueEntryTransaction txn =
isMoveTransaction
? new MoveTransaction(sourceQueue, messageIds, destinationQueue)
: new CopyTransaction(sourceQueue, messageIds, destinationQueue);