Hi,
I am implemented simple listener for PullEvent in Stash.
There are the following methods available: getRepository(), getDate(), getSource()
from pullEvent object.
Is it possible to get user's IP/Hostname who just took pull action?
Thank you in advance!
Michal
public class PullEventListener { @EventListener public void onPullEvent(RepositoryPullEvent pullEvent) { StashUser user = pullEvent.getUser(); Repository repository = pullEvent.getRepository(); Date date = pullEvent.getDate(); Source source = pull.getSource(); ... _mailService.submit( message ); } }
Try listening for a RequestStartedEvent instead.
This event has a
public RequestContext getRequestContext()
method. From the RequestContext object, you can get the raw request via
Object getRawRequest();
and cast the result down to a
RequestInfoProvider and from there call
String getRemoteAddress();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.