Skip to content

Commit 03dbde1

Browse files
committed
Ajustes
1 parent ac0a8a2 commit 03dbde1

File tree

5 files changed

+229
-196
lines changed

5 files changed

+229
-196
lines changed

pom.xml

Lines changed: 115 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,115 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<!--
3-
/*
4-
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5-
*
6-
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
7-
*
8-
* The contents of this file are subject to the terms of either the GNU
9-
* General Public License Version 2 only ("GPL") or the Common Development
10-
* and Distribution License("CDDL") (collectively, the "License"). You
11-
* may not use this file except in compliance with the License. You can
12-
* obtain a copy of the License at
13-
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
14-
* or packager/legal/LICENSE.txt. See the License for the specific
15-
* language governing permissions and limitations under the License.
16-
*
17-
* When distributing the software, include this License Header Notice in each
18-
* file and include the License file at packager/legal/LICENSE.txt.
19-
*
20-
* GPL Classpath Exception:
21-
* Oracle designates this particular file as subject to the "Classpath"
22-
* exception as provided by Oracle in the GPL Version 2 section of the License
23-
* file that accompanied this code.
24-
*
25-
* Modifications:
26-
* If applicable, add the following below the License Header, with the fields
27-
* enclosed by brackets [] replaced by your own identifying information:
28-
* "Portions Copyright [year] [name of copyright owner]"
29-
*
30-
* Contributor(s):
31-
* If you wish your version of this file to be governed by only the CDDL or
32-
* only the GPL Version 2, indicate your decision by adding "[Contributor]
33-
* elects to include this software in this distribution under the [CDDL or GPL
34-
* Version 2] license." If you don't indicate a single choice of license, a
35-
* recipient has the option to distribute your version of this file under
36-
* either the CDDL, the GPL Version 2 or to extend the choice of license to
37-
* its licensees as provided above. However, if you add GPL Version 2 code
38-
* and therefore, elected the GPL Version 2 license, then the option applies
39-
* only if the new code is made subject to such option by the copyright
40-
* holder.
41-
*/
42-
-->
43-
<project xmlns="http://maven.apache.org/POM/4.0.0"
44-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
45-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
46-
<modelVersion>4.0.0</modelVersion>
47-
48-
<groupId>org.glassfish</groupId>
49-
<artifactId>javaee-javascript</artifactId>
50-
<version>1.0-SNAPSHOT</version>
51-
<packaging>war</packaging>
52-
53-
<name>javaee-javascript</name>
54-
55-
<properties>
56-
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
57-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
58-
<netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
59-
</properties>
60-
61-
<dependencies>
62-
<dependency>
63-
<groupId>javax</groupId>
64-
<artifactId>javaee-api</artifactId>
65-
<version>7.0</version>
66-
<scope>provided</scope>
67-
</dependency>
68-
<dependency>
69-
<groupId>org.glassfish.jersey.containers</groupId>
70-
<artifactId>jersey-container-servlet-core</artifactId>
71-
<version>2.0</version>
72-
<type>jar</type>
73-
<scope>provided</scope>
74-
</dependency>
75-
<dependency>
76-
<groupId>org.glassfish.jersey.media</groupId>
77-
<artifactId>jersey-media-moxy</artifactId>
78-
<version>2.2</version>
79-
<type>jar</type>
80-
<scope>provided</scope>
81-
</dependency>
82-
</dependencies>
83-
84-
<build>
85-
<finalName>javaee-javascript</finalName>
86-
<plugins>
87-
<plugin>
88-
<groupId>org.apache.maven.plugins</groupId>
89-
<artifactId>maven-compiler-plugin</artifactId>
90-
<version>3.1</version>
91-
<configuration>
92-
<source>1.7</source>
93-
<target>1.7</target>
94-
<compilerArguments>
95-
<endorseddirs>${endorsed.dir}</endorseddirs>
96-
</compilerArguments>
97-
</configuration>
98-
</plugin>
99-
<plugin>
100-
<groupId>org.apache.maven.plugins</groupId>
101-
<artifactId>maven-war-plugin</artifactId>
102-
<version>2.3</version>
103-
<configuration>
104-
<failOnMissingWebXml>false</failOnMissingWebXml>
105-
</configuration>
106-
</plugin>
107-
</plugins>
108-
</build>
109-
110-
</project>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/*
4+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5+
*
6+
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
7+
*
8+
* The contents of this file are subject to the terms of either the GNU
9+
* General Public License Version 2 only ("GPL") or the Common Development
10+
* and Distribution License("CDDL") (collectively, the "License"). You
11+
* may not use this file except in compliance with the License. You can
12+
* obtain a copy of the License at
13+
* http://glassfish.java.net/public/CDDL+GPL_1_1.html
14+
* or packager/legal/LICENSE.txt. See the License for the specific
15+
* language governing permissions and limitations under the License.
16+
*
17+
* When distributing the software, include this License Header Notice in each
18+
* file and include the License file at packager/legal/LICENSE.txt.
19+
*
20+
* GPL Classpath Exception:
21+
* Oracle designates this particular file as subject to the "Classpath"
22+
* exception as provided by Oracle in the GPL Version 2 section of the License
23+
* file that accompanied this code.
24+
*
25+
* Modifications:
26+
* If applicable, add the following below the License Header, with the fields
27+
* enclosed by brackets [] replaced by your own identifying information:
28+
* "Portions Copyright [year] [name of copyright owner]"
29+
*
30+
* Contributor(s):
31+
* If you wish your version of this file to be governed by only the CDDL or
32+
* only the GPL Version 2, indicate your decision by adding "[Contributor]
33+
* elects to include this software in this distribution under the [CDDL or GPL
34+
* Version 2] license." If you don't indicate a single choice of license, a
35+
* recipient has the option to distribute your version of this file under
36+
* either the CDDL, the GPL Version 2 or to extend the choice of license to
37+
* its licensees as provided above. However, if you add GPL Version 2 code
38+
* and therefore, elected the GPL Version 2 license, then the option applies
39+
* only if the new code is made subject to such option by the copyright
40+
* holder.
41+
*/
42+
-->
43+
<project xmlns="http://maven.apache.org/POM/4.0.0"
44+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
45+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
46+
<modelVersion>4.0.0</modelVersion>
47+
48+
<groupId>org.glassfish</groupId>
49+
<artifactId>javaee-javascript</artifactId>
50+
<version>1.0-SNAPSHOT</version>
51+
<packaging>war</packaging>
52+
53+
<name>javaee-javascript</name>
54+
55+
<properties>
56+
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
57+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
58+
<netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
59+
</properties>
60+
61+
<dependencies>
62+
<dependency>
63+
<groupId>javax</groupId>
64+
<artifactId>javaee-api</artifactId>
65+
<version>7.0</version>
66+
<scope>provided</scope>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.glassfish.jersey.containers</groupId>
70+
<artifactId>jersey-container-servlet-core</artifactId>
71+
<version>2.0</version>
72+
<type>jar</type>
73+
<scope>provided</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>org.glassfish.jersey.media</groupId>
77+
<artifactId>jersey-media-moxy</artifactId>
78+
<version>2.2</version>
79+
<type>jar</type>
80+
<scope>provided</scope>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.glassfish</groupId>
84+
<artifactId>javax.json</artifactId>
85+
<version>1.0.4</version>
86+
</dependency>
87+
</dependencies>
88+
89+
<build>
90+
<finalName>javaee-javascript</finalName>
91+
<plugins>
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-compiler-plugin</artifactId>
95+
<version>3.1</version>
96+
<configuration>
97+
<source>1.7</source>
98+
<target>1.7</target>
99+
<compilerArguments>
100+
<endorseddirs>${endorsed.dir}</endorseddirs>
101+
</compilerArguments>
102+
</configuration>
103+
</plugin>
104+
<plugin>
105+
<groupId>org.apache.maven.plugins</groupId>
106+
<artifactId>maven-war-plugin</artifactId>
107+
<version>2.3</version>
108+
<configuration>
109+
<failOnMissingWebXml>false</failOnMissingWebXml>
110+
</configuration>
111+
</plugin>
112+
</plugins>
113+
</build>
114+
115+
</project>

src/main/webapp/META-INF/context.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<Context>
3+
<Resource name="jdbc/tutorial" auth="Container" type="javax.sql.DataSource"
4+
maxActive="-1" maxIdle="100" maxWait="5000" username="root"
5+
password="" driverClassName="com.mysql.jdbc.Driver"
6+
url="jdbc:mysql://localhost:3306/tutorial" />
7+
8+
<Realm className="org.apache.catalina.realm.DataSourceRealm"
9+
debug="99" dataSourceName="jdbc/tutorial" localDataSource="true"
10+
userTable="usuario" userNameCol="login" userCredCol="senha"
11+
userRoleTable="permissao" roleNameCol="nome" />
12+
</Context>

src/main/webapp/WEB-INF/web.xml

Lines changed: 71 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,72 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
5-
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
6-
version="3.1">
7-
<security-constraint>
8-
<display-name>Secure JavaScript Clients</display-name>
9-
<web-resource-collection>
10-
<web-resource-name>Secure Interfaces</web-resource-name>
11-
<url-pattern>/todo.jsp</url-pattern>
12-
<url-pattern>/chat.jsp</url-pattern>
13-
<!--
14-
<url-pattern>/resources/todo/*</url-pattern>
15-
<url-pattern>/chat</url-pattern>
16-
-->
17-
<http-method>GET</http-method>
18-
<!--
19-
<http-method>POST</http-method>
20-
<http-method>PUT</http-method>
21-
<http-method>DELETE</http-method>
22-
-->
23-
</web-resource-collection>
24-
<auth-constraint>
25-
<role-name>javascript</role-name>
26-
</auth-constraint>
27-
<user-data-constraint>
28-
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
29-
</user-data-constraint>
30-
</security-constraint>
31-
<security-constraint>
32-
<display-name>Secure Java EE Backend</display-name>
33-
<web-resource-collection>
34-
<web-resource-name>Secure Services</web-resource-name>
35-
<url-pattern>/resources/todo/*</url-pattern>
36-
<url-pattern>/chat</url-pattern>
37-
<http-method>GET</http-method>
38-
<http-method>POST</http-method>
39-
<http-method>PUT</http-method>
40-
<http-method>DELETE</http-method>
41-
</web-resource-collection>
42-
<user-data-constraint>
43-
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
44-
</user-data-constraint>
45-
</security-constraint>
46-
<deny-uncovered-http-methods/>
47-
<login-config>
48-
<auth-method>BASIC</auth-method>
49-
<realm-name>javascript-realm</realm-name>
50-
</login-config>
51-
<session-config>
52-
<session-timeout>
53-
30
54-
</session-timeout>
55-
</session-config>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
5+
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
6+
version="3.1">
7+
8+
<!-- Configurações para rodar no apache -->
9+
<!-- <resource-ref>
10+
<description>Web Database</description>
11+
<res-ref-name>jdbc/tutorial</res-ref-name>
12+
<res-type>javax.sql.DataSource</res-type>
13+
<res-auth>Container</res-auth>
14+
</resource-ref> -->
15+
16+
17+
<security-constraint>
18+
<display-name>Secure JavaScript Clients</display-name>
19+
<web-resource-collection>
20+
<web-resource-name>Secure Interfaces</web-resource-name>
21+
<url-pattern>/todo.jsp</url-pattern>
22+
<url-pattern>/chat.jsp</url-pattern>
23+
<!--
24+
<url-pattern>/resources/todo/*</url-pattern>
25+
<url-pattern>/chat</url-pattern>
26+
-->
27+
<http-method>GET</http-method>
28+
<!--
29+
<http-method>POST</http-method>
30+
<http-method>PUT</http-method>
31+
<http-method>DELETE</http-method>
32+
-->
33+
</web-resource-collection>
34+
<auth-constraint>
35+
<role-name>admin</role-name>
36+
</auth-constraint>
37+
<!-- <user-data-constraint>
38+
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
39+
</user-data-constraint> -->
40+
</security-constraint>
41+
<security-constraint>
42+
<display-name>Secure Java EE Backend</display-name>
43+
<web-resource-collection>
44+
<web-resource-name>Secure Services</web-resource-name>
45+
<url-pattern>/resources/todo/*</url-pattern>
46+
<url-pattern>/chat</url-pattern>
47+
<http-method>GET</http-method>
48+
<http-method>POST</http-method>
49+
<http-method>PUT</http-method>
50+
<http-method>DELETE</http-method>
51+
</web-resource-collection>
52+
<!-- <user-data-constraint>
53+
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
54+
</user-data-constraint> -->
55+
</security-constraint>
56+
<deny-uncovered-http-methods/>
57+
<login-config>
58+
<auth-method>BASIC</auth-method>
59+
<realm-name>javascript-realm</realm-name>
60+
</login-config>
61+
62+
<security-role>
63+
<description>The role that is required to access the HTML Manager pages</description>
64+
<role-name>admin</role-name>
65+
</security-role>
66+
67+
<session-config>
68+
<session-timeout>
69+
30
70+
</session-timeout>
71+
</session-config>
5672
</web-app>

0 commit comments

Comments
 (0)