Refine search
/** * @author Arun Gupta */ @Named @RequestScoped public class FlowScopedBean { public String sayHello() { return "Hello there!"; } }
@Named @RequestScoped public class MyBean { @Inject private HttpServletRequest request; public String getText() { return "Called from CDI\n"; } public String getServletPath() { return request.getServletPath(); } }
@RequestScoped public class FormDataBean { private int age; @Inject private SecondBean injectedBean;
@Produces @Named @RequestScoped public FlashContext getFlashContext() { return currentContext; }
@RequestScoped public class RadioProducer { @Produces Radio<String, List<Integer>> radio = new Radio<String, List<Integer>>() { }; }
@RequestScoped @Path("req") public class RequestScopedResource { @Inject AppScopedResource appResource; @Inject RequestScopedBean bean; UriInfo uriInfo; @Inject App.JaxRsApplication jaxRsApplication;
@Named @RequestScoped public class CDIBean { @Inject private HttpServletRequest request; public String getText() { return "Called from CDI"; } public void setTextViaInjectedRequest() { request.setAttribute("text", "Called from CDI via injected request"); } }
@Named @Produces @RequestScoped public ExternalContext getExternalContext(final FacesContext context) { return context.getExternalContext(); } }
/** * @author Arun Gupta */ @Named @RequestScoped public class ScopedBean { public String sayHello() { return "Hello there!"; } }
@Produces @RequestScoped public int produce() { return 0; } }
@RequestScoped public class FieldInjectionResource { @Inject @Valid @BeanParam @Inject private ApplicationScopedBean appScoped;
@RequestScoped public class Pike { @Inject @Named // -> @Named("daphnia") Daphnia daphnia; public Daphnia getDaphnia() { return daphnia; } }
/** * Returns the web beans conversation controller */ @Produces @Named("javax.enterprise.context.conversation") @RequestScoped public ConversationContext getConversation() { return new ConversationContext(); }
/** * A {@link RequestScoped} bean * * @author Daniel Meyer * */ @Named @RequestScoped public class RequestScopedDelegateBean implements JavaDelegate { private int invocationCounter = 0; @Override public void execute(DelegateExecution execution) throws Exception { invocationCounter++; execution.setVariable("invocationCounter", invocationCounter); } }
@Produces @RequestScoped public String[] produce() { return new String[0]; }
@RequestScoped public class NumberConsumer { @Inject int number; public void ping(){}; }
@Produces @Named @RequestScoped public RenderContext getContextInstance() { if (currentContext == null) { initializeCurrentContext(); } return currentContext; }
/** * A request scoped Stateful Session Bean acting as as a JavaDelegate * * @author Daniel Meyer * */ @Named @Stateful @RequestScoped public class RequestScopedSFSBDelegate implements JavaDelegate { private int invocationCounter = 0; public void execute(DelegateExecution execution) throws Exception { invocationCounter++; execution.setVariable("invocationCounter", invocationCounter); } }
@Produces @RequestScoped public String[] produce() { return new String[0]; }
@RequestScoped class Farm { @Inject Stable stable; public void open() {}; }