java-ee-6

How do I upgrade an existing enterprise project from Java EE5 to Java EE 6 in Netbeans (6.9)

一世执手 提交于 2019-12-18 04:24:16
问题 The project has an EJB module & a web module. Changing the server is easy, but I'd like to switch to EJB 3.1 also but I believe I need to change all kind of configuration files since I can't do it from the project properties window(s). Any tips or links do useful documentation will be greatly appreciated. Thank you! 回答1: Apparently it's not that complicated. It worked for me by modifying the following files: <project-folder> /nbproject/project.properties change the following lines: j2ee

JSF2 Static resource caching

懵懂的女人 提交于 2019-12-18 04:24:12
问题 Glassfish 3.1.2, Mojarra 2.1.6, SSL activated I have an question about static resource caching. I´ve read some posts about this but I´m not sure which options we should use. This https://developers.google.com/speed/docs/best-practices/caching is also an good article about resource caching. Within our application server SSL is activated. We see that static resources (images, scripts, css) are not cached. Here is my test filter: @Override public void doFilter(ServletRequest request,

How to handle multiple submits before response is rendered?

此生再无相见时 提交于 2019-12-18 03:37:17
问题 It has been reported from testing that it is occasionally possible to press a button more than once if the response is not rendered fast enough, causing several invocations of the back-end code, which we do not want. Application is Java EE 6 Web Profile using JSF 2.0 inside Glassfish 3.1.1. I was wondering how this should be properly dealt with, and have thought of a few scenarios: Submitting should disable all buttons using javascript while response is being rendered. A flag in the Session

How to set JSF2 <welcome-file> with faces servlet mapping?

落花浮王杯 提交于 2019-12-18 03:11:29
问题 I have a simple JSF2 app using Facelets. My web.xml is set as follows:- <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> I want to set the app to default to the welcome page which is /pages/login.xhtml. I can't seem to get the welcome-file setting to pick up this when going to the context root in the browser. My web.xml welcome setting is as follows:- <welcome-file-list> <welcome-file>/pages/login.jsf</welcome-file> </welcome

How to set JSF2 <welcome-file> with faces servlet mapping?

不问归期 提交于 2019-12-18 03:11:05
问题 I have a simple JSF2 app using Facelets. My web.xml is set as follows:- <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> I want to set the app to default to the welcome page which is /pages/login.xhtml. I can't seem to get the welcome-file setting to pick up this when going to the context root in the browser. My web.xml welcome setting is as follows:- <welcome-file-list> <welcome-file>/pages/login.jsf</welcome-file> </welcome

Can't find javax.ws.rs package in jdk

穿精又带淫゛_ 提交于 2019-12-18 03:04:09
问题 I'm trying to get into JAX-RS. My project jdk is set to 1.7.03. Does there have to be definitions of annotations for JAX-RS(javax.ws.rs)? If not, where I can find them? 回答1: These classes (JSR 311: JAX-RS: The JavaTM API for RESTful Web Services) are not part of the JDK. You need to include appropriate JAR file to your CLASSPATH. You can find the API e.g. in maven repository. Also check out apache-cxf, jersey (reference implementation), resteasy from JBoss, restlet and few other JAX-RS

DCH class error with JavaMail

独自空忆成欢 提交于 2019-12-17 19:35:05
问题 I'm attempting to set up a simple logging test with JavaMail in Java EE 6, using the jar files provided with Glassfish 3.1. There seems to be a wealth of questions out there on this subject, but I haven't found any answers that have helped yet. My test code looks like this: import java.util.logging.Logger; public class MyClass { private static final Logger LOGGER = Logger.getLogger("MyClass"); public static void main(String[] args) { LOGGER.severe("This is a test"); } } My logging.properties

GlassFish: How to set Access-Control-Allow-Origin header

被刻印的时光 ゝ 提交于 2019-12-17 16:11:58
问题 I am using the latest version of GlassFish. I want to set the Access-Control-Allow-Origin header in response so that my API which is hosted on GlassFish can be called from any domain. But I am not able to find out where to set it. 回答1: In my case, the API requests are exclusively handled by Jersey, therefore I can set response headers in a ContainerResponseFilter : package my.app; import com.sun.jersey.spi.container.ContainerRequest; import com.sun.jersey.spi.container.ContainerResponse;

EJB 3.1 @EJB Injection into POJO

谁说胖子不能爱 提交于 2019-12-17 15:46:29
问题 With the new EJB 3.1 spec is it possible to inject an EJB into a pojo? I know in EJB 3.0 the @EJB annotation could be used to inject an EJB but this did not work on simple pojos. If it is not do I have to look the bean up in JNDI as I know you cannot simple use the new keyword. 回答1: Yes, use JNDI lookup. Since your POJO is created by you (I assume), the container is not responsible for injecting the dependencies. 回答2: With the new EJB 3.1 spec is it possible to inject an EJB into a pojo? I

EAR vs separate EJB + WAR

吃可爱长大的小学妹 提交于 2019-12-17 15:28:11
问题 What's the difference in deploying application as EAR (with 1 EJB and 1 WAR module) vs separate modules? I want to use GlassFish 3 web profile but it does not support EAR archive. Can I simply use EJB and WAR as separate modules? Any other options? 回答1: There seems to be some confusion between 3 variants of deployment: An EAR that includes an EJB and WEB module Deploying a separate EJB module and a separate WEB module Deploying a WEB module that includes EJB classes or an EJB jar. In the