Created
October 30, 2014 10:38
-
-
Save dtelaroli/534d8d5fd1d42805c527 to your computer and use it in GitHub Desktop.
VRaptor Velocity @nAmed Components
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
@ApplicationScoped | |
public class VelocityInjectNameds { | |
private ServletContext context; | |
private final LinkToHandler linkTo; | |
private final Translator t; | |
/** | |
* @deprecated CDI eyes only | |
*/ | |
protected VelocityInjectNameds() { | |
this(null, null, null); | |
} | |
/** | |
* LinkTo and Translator of i18n plugin | |
*/ | |
@Inject | |
public VelocityInjectNameds(ServletContext context, LinkToHandler linkTo, Translator t) { | |
this.context = context; | |
this.linkTo = linkTo; | |
this.t = t; | |
} | |
public void init(@Observes VRaptorInitialized init) { | |
context.setAttribute("linkTo", linkTo); | |
context.setAttribute("t", t); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment