java-ee

@EJB annotation vs JNDI lookup

有些话、适合烂在心里 提交于 2019-12-18 17:25:14
问题 Is there any situation where it's better to use JNDI than to inject a stateless session bean using the @EJB annotation? We're using JSF 1.2 with Sun Application Server 9.0_01. Our team is debating which approach is better when using SLSBs in a Managed Bean. I've read the following questions, but was wondering if there was a situation where lookup is preferred. EJB3 - obtaining bean via injection vs lookup - what are the differences, implications, gotchas? @EJB injection vs lookup -

Jersey custom SecurityContext on EJB jax-rs resource

安稳与你 提交于 2019-12-18 17:11:54
问题 I am trying to implement my own ContainerRequestFilter and configure SecurityContext . It works well on jax-rs resources but EJB jax-rs throws javax.ejb.AccessLocalException Only relevant thing I found is 4 years old and the workaround doesn't seem pretty. https://java.net/projects/jersey/lists/users/archive/2010-05/message/265 My custom SecurityContext: @Provider @PreMatching public class SecurityFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext

Hibernate bidirectional @ManyToOne, updating the not owning side not working

余生长醉 提交于 2019-12-18 17:05:04
问题 I have a really simple setup to try out a bidirectional mapping with annotations: @Entity public class TypeA extends AbstractModel<TypeA> { @Id @GeneratedValue private int id; @OneToMany(mappedBy="a") private Collection<TypeB> bs; // Getters & Setters ... } and @Entity public class TypeB extends AbstractModel<TypeB> { private static final long serialVersionUID = -3526384868922938604L; @Id @GeneratedValue private int id; @ManyToOne() @JoinColumn(name="a_id") private TypeA a; } When I set the

Can CDI managed beans and JSF managed beans talk to each other?

烂漫一生 提交于 2019-12-18 16:57:41
问题 I have a Tomcat 6 JSF web application that I'd like to set up with CDI beans. I will have to convert the project to CDI gradually though. My question is: can CDI beans and traditional JSF managed beans be injected into each other? Thanks. 回答1: All JSF managed beans (JMB) either are CDI managed beans (CMB) automatically, or can be recognized as such using the beans.xml marker file. (The requirements of a CMB are set very low and basically just dictate the existence of a non-parameter

Wildfly caches roles after logout in a web application

二次信任 提交于 2019-12-18 16:51:24
问题 jboss-web.xml <?xml version="1.0" encoding="UTF-8"?> <jboss-web> <security-domain flushOnSessionInvalidation="true">my-aktion </security-domain> <valve> <class-name>utils.MyAuthenticator</class-name> </valve> </jboss-web> standalone.xml <security-domain name="my-aktion" cache-type="default"> <authentication> <login-module code="utils.MyAuthenticator" flag="required"> <module-option name="dsJndiName" value="java:jboss/datasources/MySQLDS"/> <module-option name="principalsQuery" value="SELECT

access class variable in aspect class

给你一囗甜甜゛ 提交于 2019-12-18 16:47:25
问题 i am creating an aspect class with spring aspectj as follow @Aspect public class AspectDemo { @Pointcut("execution(* abc.execute(..))") public void executeMethods() { } @Around("executeMethods()") public Object profile(ProceedingJoinPoint pjp) throws Throwable { System.out.println("Going to call the method."); Object output = pjp.proceed(); System.out.println("Method execution completed."); return output; } } now i want to access the property name of class abc then how to acccess it in aspect

Maven or Gradle build types/variants

拜拜、爱过 提交于 2019-12-18 15:47:29
问题 The Android Gradle plugin adds support for build types and build variants, which let you select which version of your application you want to build at the build step (ex, debug or release). This is a very useful feature for Gradle projects, as you can have 2 versions of your application that may behave differently in some situations, or have different configuration files or properties depending on the type of build. Now, my question is: is there a similar feature/implementation for non

Maven or Gradle build types/variants

杀马特。学长 韩版系。学妹 提交于 2019-12-18 15:47:29
问题 The Android Gradle plugin adds support for build types and build variants, which let you select which version of your application you want to build at the build step (ex, debug or release). This is a very useful feature for Gradle projects, as you can have 2 versions of your application that may behave differently in some situations, or have different configuration files or properties depending on the type of build. Now, my question is: is there a similar feature/implementation for non

Why nested transactions are not supported in JTA

旧城冷巷雨未停 提交于 2019-12-18 15:41:06
问题 Why aren't nested transactions supported by JTA? Is it because of the complexity of implementing them (which I doubt) or some design principle? 回答1: (As @Piotr Nowicki points out, JTA does allow nested transactions, but this is optional not mandatory.) Why? This is one of those questions that is impossible to answer with any certainty, unless you were one of the people "in the room" when the decisions were made. It could be the inherent complexity of including nested transactions as part of

Preserving session in Java with sendredirect

夙愿已清 提交于 2019-12-18 15:16:31
问题 I am creating a Login Application in JAVA.I am making the presentation in JSP and all the logic (Database connectivity) in Servlet [this is not a right approach I know that]. I check the username Password in Servlet and then create a session variable. and add the session like this sess.setAttribute("username",oName); Then I redirect the user to its homepage say student.jsp response.sendRedirect("student.jsp"); It removes the session variable.I need a way to preserve the session variable and