Skip to content

Commit d4d1566

Browse files
committed
Fixes issue #12 - Add @RequestCookieMap example
1 parent 11128f3 commit d4d1566

File tree

16 files changed

+134
-17
lines changed

16 files changed

+134
-17
lines changed

jsf/applicationMap/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<parent>
88
<artifactId>project</artifactId>
9-
<groupId>jakartaee.samples.jsf</groupId>
9+
<groupId>jakartaee.examples.jsf</groupId>
1010
<version>8-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>applicationMap</artifactId>

jsf/applicationMap/src/main/java/jakartaee/samples/jsf/applicationMap/ApplicationMapBean.java renamed to jsf/applicationMap/src/main/java/jakartaee/examples/jsf/applicationMap/ApplicationMapBean.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1111
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1212
*/
13-
package jakartaee.samples.jsf.applicationMap;
13+
package jakartaee.examples.jsf.applicationMap;
1414

1515
import java.io.Serializable;
1616
import java.util.Map;
@@ -21,7 +21,7 @@
2121
import javax.inject.Named;
2222

2323
/**
24-
* A request scoped bean injecting the ApplicatiobMap.
24+
* A request scoped bean injecting the application map.
2525
*
2626
* @author Manfred Riem ([email protected])
2727
*/
@@ -31,18 +31,18 @@
3131
public class ApplicationMapBean implements Serializable {
3232

3333
/**
34-
* Stores the ExternalContext.
34+
* Stores the application map.
3535
*/
3636
@Inject
3737
@ApplicationMap
3838
private Map<String, Object> applicationMap;
3939

4040
/**
41-
* Get the ExternalContext.
41+
* Get the application map.
4242
*
43-
* @return the ExternalContext.
43+
* @return the application map.
4444
*/
45-
public Map getApplicationMap() {
45+
public Map<String, Object> getApplicationMap() {
4646
return applicationMap;
4747
}
4848
}

jsf/applicationScoped/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<parent>
88
<artifactId>project</artifactId>
9-
<groupId>jakartaee.samples.jsf</groupId>
9+
<groupId>jakartaee.examples.jsf</groupId>
1010
<version>8-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>applicationScoped</artifactId>

jsf/externalContext/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<parent>
88
<artifactId>project</artifactId>
9-
<groupId>jakartaee.samples.jsf</groupId>
9+
<groupId>jakartaee.examples.jsf</groupId>
1010
<version>8-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>externalContext</artifactId>

jsf/facesContext/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<parent>
88
<artifactId>project</artifactId>
9-
<groupId>jakartaee.samples.jsf</groupId>
9+
<groupId>jakartaee.examples.jsf</groupId>
1010
<version>8-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>facesContext</artifactId>

jsf/managedProperty/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<parent>
88
<artifactId>project</artifactId>
9-
<groupId>jakartaee.samples.jsf</groupId>
9+
<groupId>jakartaee.examples.jsf</groupId>
1010
<version>8-SNAPSHOT</version>
1111
</parent>
1212
<artifactId>managedProperty</artifactId>

jsf/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
66
<modelVersion>4.0.0</modelVersion>
77
<parent>
8-
<groupId>jakartaee.samples</groupId>
8+
<groupId>jakartaee.examples</groupId>
99
<artifactId>project</artifactId>
1010
<version>8-SNAPSHOT</version>
1111
</parent>
12-
<groupId>jakartaee.samples.jsf</groupId>
12+
<groupId>jakartaee.examples.jsf</groupId>
1313
<artifactId>project</artifactId>
1414
<packaging>pom</packaging>
1515
<name>Jakarta EE - JSF - Examples</name>
@@ -19,6 +19,7 @@
1919
<module>externalContext</module>
2020
<module>facesContext</module>
2121
<module>managedProperty</module>
22+
<module>requestCookieMap</module>
2223
<module>requestScoped</module>
2324
<module>sessionScoped</module>
2425
<module>viewScoped</module>

jsf/requestCookieMap/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Jakarta EE - JSF - RequestCookieMap example
2+
3+
This example demonstrates how to use the @RequestCookieMap annotation into a bean.

jsf/requestCookieMap/pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
6+
<modelVersion>4.0.0</modelVersion>
7+
<parent>
8+
<artifactId>project</artifactId>
9+
<groupId>jakartaee.examples.jsf</groupId>
10+
<version>8-SNAPSHOT</version>
11+
</parent>
12+
<artifactId>requestCookieMap</artifactId>
13+
<packaging>war</packaging>
14+
<name>Jakarta EE - JSF - An injected RequestCookieMap example</name>
15+
<dependencies>
16+
<dependency>
17+
<groupId>javax</groupId>
18+
<artifactId>javaee-web-api</artifactId>
19+
<scope>provided</scope>
20+
</dependency>
21+
</dependencies>
22+
<properties>
23+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24+
</properties>
25+
</project>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Permission to use, copy, modify, and/or distribute this software for any
3+
* purpose with or without fee is hereby granted.
4+
*
5+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIMS ALL WARRANTIES
6+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
7+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR
8+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
9+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
10+
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
11+
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
12+
*/
13+
package jakartaee.examples.jsf.requestCookieMap;
14+
15+
import java.io.Serializable;
16+
import java.util.Map;
17+
import javax.enterprise.context.RequestScoped;
18+
import javax.faces.annotation.FacesConfig;
19+
import javax.faces.annotation.RequestCookieMap;
20+
import javax.inject.Inject;
21+
import javax.inject.Named;
22+
23+
/**
24+
* A request scoped bean injecting the request cookie map.
25+
*
26+
* @author Manfred Riem ([email protected])
27+
*/
28+
@Named(value = "requestCookieMapBean")
29+
@RequestScoped
30+
@FacesConfig(version = FacesConfig.Version.JSF_2_3)
31+
public class RequestCookieMapBean implements Serializable {
32+
33+
/**
34+
* Stores the request cookie map.
35+
*/
36+
@Inject
37+
@RequestCookieMap
38+
private Map<String, Object> requestCookieMap;
39+
40+
/**
41+
* Get the request cookie map.
42+
*
43+
* @return the request cookie map.
44+
*/
45+
public Map<String, Object> getRequestCookieMap() {
46+
return requestCookieMap;
47+
}
48+
}

0 commit comments

Comments
 (0)