java-ee-6

how to implement server-sent-events in JEE6

本秂侑毒 提交于 2019-12-13 03:57:33
问题 In PHP it really simple: I just added this to "b.php": header('Content-Type: text/event-stream'); echo "data: Hi\n\n"; flush(); and this to "a.html": var source = new EventSource("b.php"); source.onmessage = function (event) { document.body.innerHTML += event.data + "<br>"; I just need to go a.html and it's works! But in java I've tried to create servlet and in doGet I added this code: response.setContentType("text/event-stream"); PrintWriter out = response.getWriter(); out.println("data: Hi

Can you use bean validation 1.1 (JSR 349) in JBoss EAP 6.4.4?

匆匆过客 提交于 2019-12-13 02:39:58
问题 We are using bean validation in JBoss EAP 6.4.4 (resteasy & hibernate-validator 4) to validate REST payload data. As it seems JBoss 6.4.4 uses bean validation 1.0 which doesn't support method validation. So, requests are not being blocked by bean validation and reach the db. Is there any jboss deployment file or something similar where I can enable version 1.1? I cannot change the bundled libs because we'll lose jboss support for the AS. JBoss 7 seems to work out of the box, but it's still in

What are the design consideration questions in determining where to place the business logic in a Java EE application? [closed]

情到浓时终转凉″ 提交于 2019-12-13 02:07:38
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . Specifically, the EIS (database) Tier versus using the Web tier with POJO's and a light framework or the standard business logic tier using EJB's. Also, there may be other options besides these that I'm not aware of. Basically, it's design considerations for business logic with

Validation message not being displayed in login form when the user enters wrong password

本秂侑毒 提交于 2019-12-13 00:15:50
问题 I am trying to understand why my login form does not display the validation message that says "wrong email or password" when the password is entered wrong. In all the other cases it works correctly(Just case 4 doesnt work): Case 1 works with no problem(No input given): Case 2 works with no problem(Only input given for email): Case 3 works with no problem(Only input given for password): Case 4 doesn't work (Both inputs given wrong) It is the case 4 that doesn't work correctly here is the

glassfish-embedded-maven-plugin - how to deploy resources

筅森魡賤 提交于 2019-12-12 21:35:54
问题 I'm providing a quick and easy way for users to deploy my Java EE 6 application via glassfish-embedded-maven-plugin, so they don't have to install and configure a standalone glassfish. However, I'm running into trouble with resource deployment. The app needs a JavaMail resource from the container, and needs a JAAS realm with a suitable role->user/group mapping. When deploying to a standalone glassfish this is easily provided with a sun-resources.xml file and/or a couple of asadmin commands.

Multiple folders in Java EE 6 web pages

一个人想着一个人 提交于 2019-12-12 18:28:06
问题 Lets say that you have a following simple application: <form action="helloServlet" method="post"> Give name:<input type="text" name="name" /> <input type="submit" value="Send"/> </form> And a servlet handling that form: package org.servlets.hello; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http

How to get CDI in war AND EJB running if both are bundled in an EAR

会有一股神秘感。 提交于 2019-12-12 17:15:26
问题 I'm trying to build an enterprise application which is assembled in an EAR. This application should contain one or more ejb-jars and one or more war 's. I want to make heavily use of CDI , Interceptors and Producers. In the first step I want to use a Log-Producer which is placed in the ejb-jar in all areas of the application. What I did is creating a beans.xml in the ejb/META-INF and the war/WEB-INF/ folders. Creating the EAR works. But deploying to the Glassfish Server (3.1) fails with a

Is it possible to use @WebService, @Stateless and @Singleton altogether in one EJB 3 bean?

帅比萌擦擦* 提交于 2019-12-12 16:08:47
问题 I'm using EJB 3 and JBoss AS 6.0.0.Final. I have a stateless session bean with the annotations @Stateless and @WebService . When I add the annotation @Singleton , the deployment is in error showing the message: ...name=ServiceBean, service=ejb3 is already installed What can I do to avoid the deployment error? 回答1: You can use @WebService and @Stateless or @WebService and @Singleton in the same bean which makes perfectly sense if you want to expose a POJO as both a web service and EJB. Don't

Why does Eclipse not deploy dependency to Glassfish?

依然范特西╮ 提交于 2019-12-12 13:18:35
问题 I am using Eclipse Helios, Glassfish 3.0.1 (Full Platform) and myfaces 2.0 . There a two projects in the workspace: A simple Java project (=> JP) and a dynamic web project (=> WP). I added JP to the classpath of WP. I added one class from JP as a managed bean to the faces-config.xml file of WP. <managed-bean> <managed-bean-name>myBean</managed-bean-name> <managed-bean-class>myPackage.MyBean</managed-bean-class> <managed-bean-scope>application</managed-bean-scope> </managed-bean> When I deploy

Adding javax.validation capabilities to Tomcat

蓝咒 提交于 2019-12-12 12:25:57
问题 I'm trying to run a web application using Tomcat but the the application is using libraries such as: import javax.validation.constraints.Future; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; These libraries are not part of the Tomcat spec so I need to add them manually. What libraries should I add? 回答1: The javax.validation package is a Bean Validation (JSR-303) library. An implementation of this specification is i.e. the Hibernate Validator or the