Created
February 25, 2011 01:07
-
-
Save johnament/843239 to your computer and use it in GitHub Desktop.
Demonstrates event firing, both observers get called when es3 is fired.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestScoped | |
@Path("/send") | |
public class SendEventResource { | |
@Inject @QualOne Event<String> es1; | |
@Inject @QualTwo Event<String> es2; | |
@Inject @QualOne @QualTwo Event<String> es3; | |
@Inject Logger logger; | |
@Path("/{data}") | |
@GET | |
@Produces("text/plain") | |
public String send(@PathParam("data") String s) { | |
es3.fire(s); | |
return s; | |
} | |
public void obsString(@Observes @QualOne String s) { | |
logger.info("Observed QualOne"); | |
} | |
public void obsString2(@Observes @QualTwo String s) { | |
logger.info("Observed QualTwo"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment