java-ee

EntityManager is null inside Pojo class in ejb container

橙三吉。 提交于 2020-01-06 15:02:07
问题 I have a Java web service module and ejb modulein netbeans (All part of an enterprise application). the web service is consuming the ejb class using @EJB injection. Inside the ejb module i have a TransactionManager class which is not an enterprise bean. just a POJO class. I am trying to inject the EntityManager using @PersistanceContext(unitName = "testPU") EntityManager em; but the em is allways null. I am calling the TransactionManager class from by bean, and if i declare the EntityManager

Application context path at JAX-RS 2.0 resource instance construction

北战南征 提交于 2020-01-06 14:45:15
问题 Is it possible to get the context path for a Java EE 7 application at JAX-RS 2.0 resource class instance construction time (and possibly at static class initialization time, too), or is it only available during requests to endpoints in the resource class? By context path I mean the String that would be returned by a call to a HttpServletRequest#getContextPath() within the Java EE 7 application. I imagine that you probably could have multiple context path aliases for a deployed application. If

Application context path at JAX-RS 2.0 resource instance construction

删除回忆录丶 提交于 2020-01-06 14:45:14
问题 Is it possible to get the context path for a Java EE 7 application at JAX-RS 2.0 resource class instance construction time (and possibly at static class initialization time, too), or is it only available during requests to endpoints in the resource class? By context path I mean the String that would be returned by a call to a HttpServletRequest#getContextPath() within the Java EE 7 application. I imagine that you probably could have multiple context path aliases for a deployed application. If

How to change response before send

末鹿安然 提交于 2020-01-06 14:26:11
问题 Is it possible to intercept sending response to client, and send modified response in final ? I want to remove "WWW-Authenticate" header from Basic Auth response or change error code from 401 to 403 in wrong authentication case. P.S. I have the same problem: http://www.java.net/forum/topic/glassfish/glassfish/suppress-www-authenticate-header-if-basic-auth-fails 回答1: I tried use Filter with HttpServletResponseWrapper but my Filter was never called before JAAS Basic HTTP Authentication. I

How to change response before send

折月煮酒 提交于 2020-01-06 14:26:11
问题 Is it possible to intercept sending response to client, and send modified response in final ? I want to remove "WWW-Authenticate" header from Basic Auth response or change error code from 401 to 403 in wrong authentication case. P.S. I have the same problem: http://www.java.net/forum/topic/glassfish/glassfish/suppress-www-authenticate-header-if-basic-auth-fails 回答1: I tried use Filter with HttpServletResponseWrapper but my Filter was never called before JAAS Basic HTTP Authentication. I

How does Grails handle security, and why should I use a plugin?

我怕爱的太早我们不能终老 提交于 2020-01-06 14:21:12
问题 For 90% of every security-related Grails tutorial, they tell you to store your User objects in a session-scoped variable. That's all nice and easy, but I wonder if it's too good to be true, especially with plugins like Spring Security that offer many times more features. For the simple, "I am a user and therefore I am entitled to view/edit my own domain objects" applications that I develop, I store my User objects in a session. However, this got me thinking how Grails supports J2EE security

WebServiceContext is not injected using @Resource

风格不统一 提交于 2020-01-06 14:12:25
问题 I know that has been asked before, but none of the solutions worked for me. Probably because they were mostly using EE compliant application servers, which is NOT my case. I'm running my web service on jetty (through Eclipse) for development only. But even for deployment, I'll use Tomcat 7. So for either development or production, I won't be using a JavaEE compliant server. So is it still possible to inject WebServiceContext into my web services ? I've tried the following but it didn't work

WebServiceContext is not injected using @Resource

☆樱花仙子☆ 提交于 2020-01-06 14:09:12
问题 I know that has been asked before, but none of the solutions worked for me. Probably because they were mostly using EE compliant application servers, which is NOT my case. I'm running my web service on jetty (through Eclipse) for development only. But even for deployment, I'll use Tomcat 7. So for either development or production, I won't be using a JavaEE compliant server. So is it still possible to inject WebServiceContext into my web services ? I've tried the following but it didn't work

Maven: Generate different wars from different profiles

耗尽温柔 提交于 2020-01-06 13:43:30
问题 I have a web application project. This project has different maven profiles (for countries and environments) with filtered properties. I have to execute many times to obtain the different wars but I would like to get all the wars in a single maven execution. Is this possible? 回答1: Maybe you can write scipt with all those maven commands 回答2: It's not quite clear from your question, but if you simply want to "run" several profiles in one maven execution, it's as easy as mvn -Pprofile1,profile2,

Maven: Generate different wars from different profiles

淺唱寂寞╮ 提交于 2020-01-06 13:43:15
问题 I have a web application project. This project has different maven profiles (for countries and environments) with filtered properties. I have to execute many times to obtain the different wars but I would like to get all the wars in a single maven execution. Is this possible? 回答1: Maybe you can write scipt with all those maven commands 回答2: It's not quite clear from your question, but if you simply want to "run" several profiles in one maven execution, it's as easy as mvn -Pprofile1,profile2,