Last active
May 22, 2017 10:31
-
-
Save chongma/6d06c598656a3967a2e20dfc24facb00 to your computer and use it in GitHub Desktop.
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
package tld.domain.example; | |
import javax.enterprise.context.ApplicationScoped; | |
import javax.inject.Inject; | |
import javax.servlet.http.HttpServletRequest; | |
@ApplicationScoped | |
public class MyApplicationScoped { | |
@Inject | |
private HttpServletRequest httpServletRequest; | |
public void checkUserInRole() { | |
httpServletRequest.isUserInRole("somerole"); | |
} | |
} |
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
package tld.domain.example; | |
import javax.ejb.AccessTimeout; | |
import javax.ejb.Asynchronous; | |
import javax.inject.Inject; | |
import javax.ejb.Lock; | |
import javax.ejb.LockType; | |
import javax.ejb.Singleton; | |
import tld.domain.example.MyApplicationScoped; | |
@Singleton | |
public class Save { | |
@Inject | |
private MyApplicationScoped myApplicationScoped; | |
@Asynchronous | |
@Lock(LockType.READ) | |
@AccessTimeout(-1) | |
public void addJob(String something) { | |
doSomething(something); | |
} | |
private void doSomething(String something) { | |
myApplicationScoped.checkUserInRole(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment