java-ee-7

How can I get a cookie value inside websocket end-point

纵然是瞬间 提交于 2019-12-05 06:03:57
I'm using Websocket-API based on JavaEE 7, in my application. I'm required to access the values set in cookies inside my websocket endpoint [Annotated one : @ServerEndpoint ("/websocket") ] . How would I do that? @onOpen() method is there, which will be called automatically when a connection to this websocket endpoint is established. I want to access cookies values in there, inside this method. I know how to do that in a servlet or JSP, but I'm new to Websockets. Please help me doing this. Thanks in advance. Joakim Erdfelt Access to request parameters is done via the @ServerEndpoint

Maven not showing up in Eclipse (Kepler) even after m2e install

☆樱花仙子☆ 提交于 2019-12-05 04:07:34
I've seen that others have had this problem where Maven doesn't show up for them in Eclipse after installing the m2e plugin, but most of the solutions seem to suggest doing something like "Configure>Convert to Maven." But Maven is not showing up for me in the Configure list, nor is it showing up in Console>Open Console or the File>New list. I see some solutions refer to editing the project's classpath, but I don't have a clear understanding of how to do that. I'm trying to begin working through a book on Java EE7, and it uses Maven in the examples. Can someone help? Check the .log file in the

what is the purpose of @Nonbinding annotation in a Qualifier supposed to be in Java EE7?

不羁岁月 提交于 2019-12-05 02:34:44
I am reading through the CDI injections in JavaEE 7 particularly using @Qualifier and @Produces to inject a custom Data type into a bean. I have the following code taken from JBoss documentation towards ends of the page. @Qualifier @Retention(RUNTIME) @Target({TYPE, METHOD, FIELD, PARAMETER}) public @interface HttpParam { @Nonbinding public String value(); } import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.InjectionPoint; class HttpParams { @Produces @HttpParam("") String getParamValue(InjectionPoint ip) { ServletRequest request = (ServletRequest) FacesContext

Async Servlet - preferred implementation

末鹿安然 提交于 2019-12-05 02:02:25
问题 Lately, during my research about asynchronous processing in Servlets , I came across at at least three ways to implement some functionality using this approach. The questions are: Which one is the best? Maybe some of these approaches are not recommended? Maybe there is another one approach better than all of mentioned below? Found approaches: Using AsyncContext.start(Runnable) . This approach is quite simple and straightforward. But many serwers executes such a job in thread pool created for

Quartz vs Java EE 7 scheduler

我的梦境 提交于 2019-12-05 00:44:22
I'm a java EE developer which has used until now frameworks like Quartz to schedule tasks. I can see that Java EE 7 features a ManagedScheduledExecutorService to schedule single or repeating tasks. As I have never used in real projects this new features I wonder if there are still advantages of using Quartz (or others) when you have a portable way to do it ? Thanks! I believe that in future projects, there's really no need to use third-party libraries. Java EE 7 is full of scheduling features. Besides the new ManagedScheduledExecutorService , there's already the Schedule annotation for single

Which is better: multiple web socket endpoints or single web socket endpoint in Java EE7

拈花ヽ惹草 提交于 2019-12-04 18:56:20
问题 Java EE 7 allows you to create new endpoints very easily through annotations. However, I was wondering is having multiple endpoints one to handle each message type a good idea or should I have just one endpoint facade for everything? I am leaning towards having one single end-point facade based on the theory that each endpoint creates a new socket connection to the client. However, that theory could be incorrect and Web Socket may be implemented so that it will use just one TCP/IP socket

Stateless Session Beans Identity with @EJB and @Inject

巧了我就是萌 提交于 2019-12-04 15:33:32
I have been looking into section 3.4.7.2 of the EJB3.2 specifications lately und done some tests. The specifications: @EJB Cart cart 1 ; @EJB Cart cart 2 ; … if (cart1.equals(cart1)) { // this test must return true ...} … if (cart 1 .equals(cart 2 )) { // this test must also return true ...} The equals method always returns true when used to compare references to the same business interface type of the same stateless session bean. The specifications cite explicitly the @EJB Annotation so I did some tests and I could confirm - if (cart1.equals(cart2)) return always true - the identities

How do I upgrade an existing NetBeans Java EE 6 Web project to Java EE 7?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 15:29:05
The project uses JavaServer Faces and JPA. NetBeans 7.3.1 IDE does not allow to change the Java EE version. I already found this question: How do I upgrade an existing enterprise project from Java EE5 to Java EE 6 in Netbeans (6.9) tries to apply the changes as described. I have updated project.properties. endorsed.classpath=\ ${libs.javaee-endorsed-api-7.0.classpath} ... j2ee.platform=1.7-web ... javac.source=1.7 javac.target=1.7 I just had to do the same thing, I had an Java EE 6 Application and wanted to go to Java EE 7. I just made a new project in Netbeans, then I selected Java Web in

From JSON String to Java Object using javax.json

痴心易碎 提交于 2019-12-04 10:02:41
I'm using the com.google.gson.Gson API to convert a JSON string to a Java object: Gson gson = new Gson(); User u = gson.fromJson(jsonString, User.class); I'd like to know if there's an equivalent API in javax.json api to do the equivalent. Thanks! This is definitely not possible with an oneliner like as with Gson. The javax.json API is very low level. It only returns you a JSON object structure which you've to breakdown and map to a javabean further all by yourself. In order to achieve (nearly) the same effect as Gson#fromJson() , here's a kickoff example of the boilerplate code. Parameterized

Java EE 7 CDI - Injection doesn't work, sending NullPointerException

醉酒当歌 提交于 2019-12-04 09:31:39
I have a problem with my injection, it's the first time I try it. I'm working with Wildfly and Java EE 7. I've got a NullPointerException when trying to access Authenticator instance in LoginController . I use maven, my beans.xml is found under src/main/webapp/META-INF but I'v tried to put it in src/main/webapp/WEB-INF/classes without success. Here is my code : The class to inject : @Stateless public class Authenticator { @Inject HashGenerator hashGenerator; @Inject UserPersistance userPersistance; public boolean authenticate(final String username, final String password) { User user =