First of it is ok to grieve in a sense and have a good old cry. I feel it is good to mope for a short period as it gives you more time to come round to the decision.
Reminding yourself that this feeling will pass and it will get better.
A great way to try not to pay all your attention to the feelings of rejection is to keep yourself distracted. This will make you not feed into the downward spiral of a downer instead you can do something practical and deal with the feelings at a later date when you are calmer.
Accepting the rejection and moving on. It may help to acknowledge that you are not the only person in the world to have experienced rejection. At some point in life, everyone will experience rejection even the most successful people can't run away from it either.
Rejection may be a good thing for you. For example, if you attended a job interview you could ask the interviewer the reasons behind their decision to not employ you. This could potentially help you learn and help make changes to improve if needed.
Finally, I feel it is important to praise yourself as it is an indication that you are living your life and taking that risk by putting yourself out there. It takes courage to put yourself in a venerable situation so take time to appreciate the work you have achieved.