Repository: deltaspike Updated Branches: refs/heads/master ce29f696b -> ba17e1f9e
DELTASPIKE-306 - Examples for the features of the JSF module Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/ba17e1f9 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/ba17e1f9 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/ba17e1f9 Branch: refs/heads/master Commit: ba17e1f9e3c5e327d5e0e32803f45d752d1d9eed Parents: ce29f69 Author: Rafael Benevides <[email protected]> Authored: Mon Apr 7 11:52:29 2014 -0300 Committer: Rafael Benevides <[email protected]> Committed: Tue May 27 12:34:45 2014 -0300 ---------------------------------------------------------------------- .../example/scope/ViewAccessScopedBean.java | 39 ++++++++++ .../example/scope/WindowScopedBean.java | 39 ++++++++++ .../viewconfig/DenyAllAccessDecisionVoter.java | 47 ++++++++++++ .../deltaspike/example/viewconfig/MyBean.java | 34 +++++++++ .../example/viewconfig/PageController.java | 73 ++++++++++++++++++ .../deltaspike/example/viewconfig/Pages.java | 78 ++++++++++++++++++++ .../message/ApplicationMessages_fr.properties | 2 +- .../jsf-examples/src/main/webapp/index.xhtml | 15 ++-- .../main/webapp/pages/message/jsfMessage.xhtml | 2 +- .../main/webapp/pages/scopes/scopePage1.xhtml | 70 ++++++++++-------- .../main/webapp/pages/scopes/scopePage2.xhtml | 70 ++++++++++-------- .../webapp/pages/viewconfig/allowedPage.xhtml | 41 ++++++++++ .../viewconfig/navigationParameterPage.xhtml | 49 ++++++++++++ .../pages/viewconfig/redirectedPage.xhtml | 41 ++++++++++ .../webapp/pages/viewconfig/securedPage.xhtml | 41 ++++++++++ .../pages/viewconfig/viewConfigPage.xhtml | 51 +++++++++++++ 16 files changed, 627 insertions(+), 65 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/ViewAccessScopedBean.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/ViewAccessScopedBean.java b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/ViewAccessScopedBean.java new file mode 100644 index 0000000..16d99bf --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/ViewAccessScopedBean.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.example.scope; + +import java.io.Serializable; + +import javax.annotation.PostConstruct; +import javax.inject.Named; + +import org.apache.deltaspike.core.api.scope.ViewAccessScoped; + +@ViewAccessScoped +@Named +public class ViewAccessScopedBean extends ScopedBean implements Serializable +{ + + @PostConstruct + public void init() + { + super.init(); + } + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/WindowScopedBean.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/WindowScopedBean.java b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/WindowScopedBean.java new file mode 100644 index 0000000..4c43915 --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/scope/WindowScopedBean.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.example.scope; + +import java.io.Serializable; + +import javax.annotation.PostConstruct; +import javax.inject.Named; + +import org.apache.deltaspike.core.api.scope.WindowScoped; + +@WindowScoped +@Named +public class WindowScopedBean extends ScopedBean implements Serializable +{ + + @PostConstruct + public void init() + { + super.init(); + } + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/DenyAllAccessDecisionVoter.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/DenyAllAccessDecisionVoter.java b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/DenyAllAccessDecisionVoter.java new file mode 100644 index 0000000..8288e9a --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/DenyAllAccessDecisionVoter.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.example.viewconfig; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.deltaspike.security.api.authorization.AccessDecisionVoter; +import org.apache.deltaspike.security.api.authorization.AccessDecisionVoterContext; +import org.apache.deltaspike.security.api.authorization.SecurityViolation; + +public class DenyAllAccessDecisionVoter implements AccessDecisionVoter +{ + + @Override + public Set<SecurityViolation> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext) + { + Set<SecurityViolation> violations = new HashSet<SecurityViolation>(); + violations.add(new SecurityViolation() + { + + @Override + public String getReason() + { + return "This is a deny all AccessDecisionVoter"; + } + }); + return violations; + } + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/MyBean.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/MyBean.java b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/MyBean.java new file mode 100644 index 0000000..fbd8912 --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/MyBean.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.example.viewconfig; + +import javax.enterprise.inject.Model; + +@Model +public class MyBean +{ + + private String aValue = "My bean value"; + + public String getaValue() + { + return aValue; + } + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/PageController.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/PageController.java b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/PageController.java new file mode 100644 index 0000000..be1fccf --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/PageController.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.example.viewconfig; + +import javax.enterprise.inject.Model; +import javax.inject.Inject; + +import org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter; +import org.apache.deltaspike.core.api.config.view.navigation.NavigationParameterContext; +import org.apache.deltaspike.core.api.config.view.navigation.ViewNavigationHandler; +import org.apache.deltaspike.example.viewconfig.Pages.SecuredPages; +import org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.AllowedPage; +import org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.NavigationParameterPage; +import org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.RedirectedPage; +import org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.SecuredPage; +import org.apache.deltaspike.example.viewconfig.Pages.ViewConfigFolder.ViewConfigPage; + +@Model +public class PageController +{ + + @Inject + private NavigationParameterContext navigationParameterContext; + + @Inject + private ViewNavigationHandler viewNavigationHandler; + + public Class<RedirectedPage> toRedirectedPage() + { + return RedirectedPage.class; + } + + public Class<ViewConfigPage> returnToMainPage() + { + return ViewConfigPage.class; + } + + @NavigationParameter(key = "param4", value = "Parameter from the Controller class") + public Class<NavigationParameterPage> toNavigationParameterPage() + { + this.navigationParameterContext.addPageParameter("param3", + "I also come from a navigation parameter using Dynamic Configuration via NavigationParameterContext"); + return NavigationParameterPage.class; + } + + public Class<? extends SecuredPages> toSecuredPage() + { + return SecuredPage.class; + } + + public void doAnyActionAndProceeed() + { + // action is performed + this.viewNavigationHandler.navigateTo(AllowedPage.class); + } + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/Pages.java ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/Pages.java b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/Pages.java new file mode 100644 index 0000000..f2c671f --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/java/org/apache/deltaspike/example/viewconfig/Pages.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.deltaspike.example.viewconfig; + +import org.apache.deltaspike.core.api.config.view.ViewConfig; +import org.apache.deltaspike.core.api.config.view.navigation.NavigationParameter; +import org.apache.deltaspike.jsf.api.config.view.Folder; +import org.apache.deltaspike.jsf.api.config.view.View; +import org.apache.deltaspike.jsf.api.config.view.View.NavigationMode; +import org.apache.deltaspike.jsf.api.config.view.View.ViewParameterMode; +import org.apache.deltaspike.security.api.authorization.Secured; + +public interface Pages extends ViewConfig +{ + + @View(navigation = NavigationMode.REDIRECT, viewParams = ViewParameterMode.INCLUDE) + public interface RedirectedPages extends ViewConfig + { + } + + @Secured(DenyAllAccessDecisionVoter.class) + public interface SecuredPages extends ViewConfig + { + + } + + @Folder(name = "./viewconfig/") + public interface ViewConfigFolder extends ViewConfig + { + + public class RedirectedPage implements RedirectedPages + { + + } + + public class ViewConfigPage implements RedirectedPages + { + + } + + @NavigationParameter.List({ + @NavigationParameter(key = "param1", value = "Hey, I come from a navigation parameter"), + @NavigationParameter(key = "param2", value = "Hey, It's an interpolated value: #{myBean.aValue}") + }) + public class NavigationParameterPage implements RedirectedPages + { + + } + + public class SecuredPage implements SecuredPages + { + + } + + public class AllowedPage implements ViewConfig + { + + } + + } + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/ApplicationMessages_fr.properties ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/ApplicationMessages_fr.properties b/deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/ApplicationMessages_fr.properties index 7cc8cab..25187e6 100644 --- a/deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/ApplicationMessages_fr.properties +++ b/deltaspike/examples/jsf-examples/src/main/resources/org/apache/deltaspike/example/message/ApplicationMessages_fr.properties @@ -16,4 +16,4 @@ #under the License. helloWorld=Bonjour %s -nowMessage=Current time is {0} \ No newline at end of file +nowMessage=L'heure actuelle est {0} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/index.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/index.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/index.xhtml index 4b0091a..1291668 100644 --- a/deltaspike/examples/jsf-examples/src/main/webapp/index.xhtml +++ b/deltaspike/examples/jsf-examples/src/main/webapp/index.xhtml @@ -22,16 +22,21 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core"> <h:head> - <title>Simple JSF Facelets page</title> + <title>Simple JSF Facelets page</title> </h:head> <h:body> - <h1>Deltaspike JSF module examples</h1> - <h:link value="Scopes" outcome="pages/scopes/scopePage1.jsf" /> <br/> - <h:link value="Messages" outcome="pages/message/jsfMessage.jsf" /> + <h1>Deltaspike JSF module examples</h1> + <h:link value="Scopes" outcome="pages/scopes/scopePage1.jsf" /> + <br /> + <h:link value="Messages" outcome="pages/message/jsfMessage.jsf" /> + <br /> + <h:link value="Type-Safe View-Config" + outcome="pages/viewconfig/viewConfigPage.jsf" /> </h:body> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/pages/message/jsfMessage.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/pages/message/jsfMessage.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/pages/message/jsfMessage.xhtml index a313ff4..5355b43 100644 --- a/deltaspike/examples/jsf-examples/src/main/webapp/pages/message/jsfMessage.xhtml +++ b/deltaspike/examples/jsf-examples/src/main/webapp/pages/message/jsfMessage.xhtml @@ -49,7 +49,7 @@ <br/> #{controllerView.now} <br/> - following text is revolved by CustomMessageResolver #{controllerView.customMessage} + following text is revolved by CustomMessageResolver: [#{controllerView.customMessage}] </h:form> </h:body> </f:view> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage1.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage1.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage1.xhtml index f60db63..34223fd 100644 --- a/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage1.xhtml +++ b/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage1.xhtml @@ -22,43 +22,55 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core"> <h:head> - <title>Simple JSF Facelets page</title> + <title>Simple JSF Facelets page</title> </h:head> <h:body> - <h1>JSF 2/CDI Scope testing</h1> - <h2>Page 1</h2> - <h:panelGrid columns="2" id="scopedValues"> - <h:outputLabel value="ApplicationScope : "/> - <h:outputText value="#{applicationScopedBean.creationDate}"> - <f:convertDateTime dateStyle="full" type="both" /> - </h:outputText> + <h1>JSF 2/CDI Scope testing</h1> + <h2>Page 1</h2> + <h:panelGrid columns="2" id="scopedValues"> + <h:outputLabel value="ApplicationScope : " /> + <h:outputText value="#{applicationScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> - <h:outputLabel value="SessionScope : "/> - <h:outputText value="#{sessionScopedBean.creationDate}"> - <f:convertDateTime dateStyle="full" type="both" /> - </h:outputText> + <h:outputLabel value="SessionScope : " /> + <h:outputText value="#{sessionScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> - <h:outputLabel value="ViewScope : "/> - <h:outputText value="#{viewScopedBean.creationDate}"> - <f:convertDateTime dateStyle="full" type="both" /> - </h:outputText> + <h:outputLabel value="WindowScope : " /> + <h:outputText value="#{windowScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> - <h:outputLabel value="RequestScope : "/> - <h:outputText value="#{requestScopedBean.creationDate}"> - <f:convertDateTime dateStyle="full" type="both" /> - </h:outputText> - </h:panelGrid> - <h:form> - <h:commandButton value="Same page"/> - <h:commandButton value="AJAX refresh"> - <f:ajax render=":scopedValues"/> - </h:commandButton> - <h:commandButton value="Next page" action="scopePage2"/> - </h:form> + <h:outputLabel value="ViewScope : " /> + <h:outputText value="#{viewScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> + + <h:outputLabel value="ViewAccessScope : " /> + <h:outputText value="#{viewAccessScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> + + <h:outputLabel value="RequestScope : " /> + <h:outputText value="#{requestScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> + + </h:panelGrid> + <h:form> + <h:commandButton value="Same page" /> + <h:commandButton value="AJAX refresh"> + <f:ajax render=":scopedValues" /> + </h:commandButton> + <h:commandButton value="Next page" action="scopePage2" /> + </h:form> </h:body> http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage2.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage2.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage2.xhtml index 401b610..cf6f5ee 100644 --- a/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage2.xhtml +++ b/deltaspike/examples/jsf-examples/src/main/webapp/pages/scopes/scopePage2.xhtml @@ -22,43 +22,55 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" - xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core"> <h:head> - <title>Simple JSF Facelets page</title> + <title>Simple JSF Facelets page</title> </h:head> <h:body> - <h1>JSF 2/CDI Scope testing</h1> - <h2>Page 2</h2> - <h:panelGrid columns="2" id="scopedValues"> - <h:outputLabel value="ApplicationScope : "/> - <h:outputText value="#{applicationScopedBean.creationDate}"> - <f:convertDateTime dateStyle="full" type="both" /> - </h:outputText> + <h1>JSF 2/CDI Scope testing</h1> + <h2>Page 2</h2> + <h:panelGrid columns="2" id="scopedValues"> + <h:outputLabel value="ApplicationScope : " /> + <h:outputText value="#{applicationScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> - <h:outputLabel value="SessionScope : "/> - <h:outputText value="#{sessionScopedBean.creationDate}"> - <f:convertDateTime dateStyle="full" type="both" /> - </h:outputText> + <h:outputLabel value="SessionScope : " /> + <h:outputText value="#{sessionScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> - <h:outputLabel value="ViewScope : "/> - <h:outputText value="#{viewScopedBean.creationDate}"> - <f:convertDateTime dateStyle="full" type="both" /> - </h:outputText> + <h:outputLabel value="WindowScope : " /> + <h:outputText value="#{windowScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> - <h:outputLabel value="RequestScope : "/> - <h:outputText value="#{requestScopedBean.creationDate}"> - <f:convertDateTime dateStyle="full" type="both" /> - </h:outputText> - </h:panelGrid> - <h:form> - <h:commandButton value="Same page"/> - <h:commandButton value="AJAX refresh"> - <f:ajax render=":scopedValues"/> - </h:commandButton> - <h:commandButton value="Index" action="/index"/> - </h:form> + <h:outputLabel value="ViewScope : " /> + <h:outputText value="#{viewScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> + + <h:outputLabel value="ViewAccessScope : " /> + <h:outputText value="#{viewAccessScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> + + <h:outputLabel value="RequestScope : " /> + <h:outputText value="#{requestScopedBean.creationDate}"> + <f:convertDateTime dateStyle="full" type="both" /> + </h:outputText> + + </h:panelGrid> + <h:form> + <h:commandButton value="Same page" /> + <h:commandButton value="AJAX refresh"> + <f:ajax render=":scopedValues" /> + </h:commandButton> + <h:commandButton value="Index" action="/index" /> + </h:form> </h:body> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/allowedPage.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/allowedPage.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/allowedPage.xhtml new file mode 100644 index 0000000..8db75e1 --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/allowedPage.xhtml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core"> + +<h:head> + <title>Simple JSF Facelets page</title> +</h:head> + +<h:body> + <h1>Allowed Page</h1> + <h:form> + <h:commandButton action="#{pageController.returnToMainPage()}" + value="Return to Main Page" /> + </h:form> + +</h:body> + +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/navigationParameterPage.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/navigationParameterPage.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/navigationParameterPage.xhtml new file mode 100644 index 0000000..d90d29d --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/navigationParameterPage.xhtml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core"> + +<h:head> + <title>Simple JSF Facelets page</title> +</h:head> + +<h:body> + <h1>Parameters Page</h1> + <h:form> + <h:outputText value="Param1: #{param['param1']}" /> + <br /> + <h:outputText value="Param2: #{param['param2']}" /> + <br /> + <h:outputText value="Param3: #{param['param3']}" /> + <br /> + <h:outputText value="Param4: #{param['param4']}" /> + <br /> + <h:commandButton action="#{pageController.returnToMainPage()}" + value="Return to Main Page" /> + </h:form> + +</h:body> + +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/redirectedPage.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/redirectedPage.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/redirectedPage.xhtml new file mode 100644 index 0000000..aa41093 --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/redirectedPage.xhtml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core"> + +<h:head> + <title>Simple JSF Facelets page</title> +</h:head> + +<h:body> + <h1>Redirected Page</h1> + <h:form> + <h:commandButton action="#{pageController.returnToMainPage()}" + value="Return to Main Page" /> + </h:form> + +</h:body> + +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/securedPage.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/securedPage.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/securedPage.xhtml new file mode 100644 index 0000000..f697a43 --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/securedPage.xhtml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core"> + +<h:head> + <title>Simple JSF Facelets page</title> +</h:head> + +<h:body> + <h1>Secured Page</h1> + <h:form> + <h:commandButton action="#{pageController.returnToMainPage()}" + value="Return to Main Page" /> + </h:form> + +</h:body> + +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ba17e1f9/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/viewConfigPage.xhtml ---------------------------------------------------------------------- diff --git a/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/viewConfigPage.xhtml b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/viewConfigPage.xhtml new file mode 100644 index 0000000..a189efc --- /dev/null +++ b/deltaspike/examples/jsf-examples/src/main/webapp/pages/viewconfig/viewConfigPage.xhtml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:f="http://java.sun.com/jsf/core"> + +<h:head> + <title>Simple JSF Facelets page</title> +</h:head> + +<h:body> + <h1>JSF 2/CDI Type-safe View-Config</h1> + <h:form> + <h:commandButton action="#{pageController.toRedirectedPage()}" + value="Navigate using redirect" /> + <br /> + <h:commandButton + action="#{pageController.toNavigationParameterPage()}" + value="Parameters page" /> + <br /> + <h:commandButton action="#{pageController.toSecuredPage()}" + value="Secured page" /> + <br /> + <h:commandButton action="#{pageController.doAnyActionAndProceeed()}" + value="Allowed page without redirection" /> + </h:form> + +</h:body> + +</html> \ No newline at end of file
