java-ee

How to have Eclipse Java EE automatically generate the exploded WAR for a web project?

你。 提交于 2019-12-22 08:07:32
问题 I need to have a Java EE project generate a WAR file automatically - preferably exploded - as opposed to choosing Export -> War file. I have played with the various server definitions but have not been able to get either the Java EE preview or the HTTP server to work, and before installing each of the external container specific servers I'd like to hear if anybody has made this work. So, question is: Which steps to take to have a WAR deployment automatically created and maintained by Eclipse?

Prevent session from being replicated when JSESSIONID cookie copied

泄露秘密 提交于 2019-12-22 08:05:19
问题 Background: I have a javaee webapp deployed on tomcat which uses form based authentication. When the web server receives a login request, it sends the request to a dedicated authentication service which validates user login (User id and password). After successful authentication user's session is maintained in the web server. Problem: I have written a simple webpp source code here, to simulate the scenario. On successful login the current HttpSession instance is invalidated and new instance

request.getUserPrincipal() got null

僤鯓⒐⒋嵵緔 提交于 2019-12-22 08:04:12
问题 User successfully authenticated but after authentication when I go to next controller I got request.getUserPrincipal() null. I am using websphere 7 and my application is in spring mvc. System.out.println("subject.getPrincipals(): " + subject.getPrincipals()); WSSubject.setRunAsSubject(subject); After authentication in login controller subject.getPrincipals() returns principal but when I go to next controller I got request.getUserPrincipal() null. web.xml <security-role> <role-name

Arquillian: starts the server but doesn't deploy

 ̄綄美尐妖づ 提交于 2019-12-22 08:04:11
问题 I am adding Arquillian to my project, I started with helloworld example: @RunWith(Arquillian.class) public class AccountTest { @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap.create(JavaArchive.class).addClasses(CustomerLookupLocal.class, CustomerLookup.class); } @Test public void shouldBeAbleToReadSysPropAtStartup() { Assert.assertTrue(1 == 1); } I added to my pom such dependencies: <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.arquillian

Controlling CDI Startup inside EJB 3.1

試著忘記壹切 提交于 2019-12-22 07:24:49
问题 I'm new in here and also new to the CDI world, and the first task I got in my job was to find out a way to controlled CDI uploading. We are using both EJB 3.1 and CDI 1.0 , and because they are controlled by different containers, we can control when and in what order the EJB Managed Beans will be up by using @Startup and @Singleton annotations. But the @Inject CDI bean I have declared in my class is coming as null since the CDI Container hasn't started yet. I have been trying for several days

Tomcat 6 - The requested resource … is not available

我与影子孤独终老i 提交于 2019-12-22 07:02:53
问题 I am trying to start developing with Java and the Stripes Framework. I have the following in my web.xml file <?xml version="1.0" encoding="ISO-8859-1"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" > <filter> <filter-name>StripesFilter</filter-name> <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter

Transaction management and CDI

让人想犯罪 __ 提交于 2019-12-22 07:02:00
问题 I would like to develop an application with CDI (I use Spring usually) to discover this technology. I have read many articles about CDI to learn how it works. I have a simple question about transaction management (for persistence in database for example): Is it mandatory to use EJB 3.1 to have transaction management or is it possible to have it with CDI only ? Thanks. 回答1: No, you can do it with CDI. You simply need to create an interceptor that starts, commits or rollsback a transaction. It

Container Managed Security for Web APplication

家住魔仙堡 提交于 2019-12-22 06:57:06
问题 I am completely new to Container managed security and need some help with configuring it in my web application. I want to restrict access to the jsp's within my web application. This is how i have configured security in my web.xml <security-constraint> <display-name>PrivilegedConstraint</display-name> <web-resource-collection> <web-resource-name>JSP Files</web-resource-name> <description>All the jsp files in the web application</description> <url-pattern>*.jsp</url-pattern> </web-resource

How to deserialize an interface with json-b?

夙愿已清 提交于 2019-12-22 06:49:11
问题 I'm adapting this Jackson code: @JsonDeserialize(as = EntityImpl.class) public interface Entity { ... } The original code works well, even for nested Entity objects. How to do the same with the new json-b specification? I tried using @JsonbTypeDeserializer but Is that really the way to go? It seems to lack the simplicity of just specifying a class. It doesn't seem to work with nested entities, which is my biggest problem: javax.json.bind.JsonbException: Can't infer a type for unmarshalling

Java EE 7: Get @Schedule date when is set to persistent = true

倖福魔咒の 提交于 2019-12-22 06:32:31
问题 In my Java EE 7 application I have created a persistent Schedule task that runs every hour. I have used @Schedule annotation. When this job is called I want to perform some actions on events that have happened from the last hour until NOW. To obtain NOW I use "new Date()". This @Schedule has the default persistent attribute to "true", which is great because if the server stops during hours I want to perform these tasks when it restarts. The problem is that, if the server has been stopped