Put the gammon in a deep pan, cover with cold water and bring to the boil. Drain off the water and add half of the chopped onion, bay leaves, peppercorns and apple juice to the pan. Top up with cold water to cover the gammon and bring to the boil. Reduce the heat and simmer for 1½ hours, topping up the water level as needed.
Remove the gammon, discard the stock and cool slightly. Preheat the oven to 220°C, fan 200°C, gas 7. Cut away the skin and discard, leaving a layer of fat on the gammon. Score the fat in diamond shapes.
Mix the demerara sugar with half of the chilli, half the coriander and half the cumin seeds. Using a pastry brush, smear the mustard over the gammon fat, then pat on the sugar mixture. Put on a baking tray lined with greaseproof paper, and roast for 20 minutes until the skin is glazed and golden.
Meanwhile, make the chutney. Mix the rest of the chilli flakes, coriander, and cumin seeds together. Put the spices in a heavy-based pan and dry-fry until the aromas are released, then remove from the pan. Pour the oil and add the rest of the chopped onion to the pan and cook over a medium heat for 5 minutes. Add the spices, mango, sugar, vinegar and 200ml water. Simmer for 20 minutes until thickened. Transfer to a bowl and allow to cool before serving with slices of the warm or cold gammon.