HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2010-09-21 64cb9b0a2a41f480aaa8986752fe3f75c1ff732a
Web-Client mit MyFaces 2.0 gestartet
25 files added
376 ■■■■■ changed files
hsarweb/build.xml 29 ●●●●● patch | view | raw | blame | history
hsarweb/lib/cas-client-core-3.1.10.jar patch | view | raw | blame | history
hsarweb/lib/commons-beanutils-1.7.0.jar patch | view | raw | blame | history
hsarweb/lib/commons-codec-1.3.jar patch | view | raw | blame | history
hsarweb/lib/commons-collections-3.2.jar patch | view | raw | blame | history
hsarweb/lib/commons-digester-1.8.jar patch | view | raw | blame | history
hsarweb/lib/commons-discovery-0.4.jar patch | view | raw | blame | history
hsarweb/lib/commons-logging-1.1.1.jar patch | view | raw | blame | history
hsarweb/lib/jstl-api-1.2.jar patch | view | raw | blame | history
hsarweb/lib/jstl-impl-1.2.jar patch | view | raw | blame | history
hsarweb/lib/myfaces-api-2.0.1.jar patch | view | raw | blame | history
hsarweb/lib/myfaces-impl-2.0.1.jar patch | view | raw | blame | history
hsarweb/src/de/hsadmin/web/Bean.java 23 ●●●●● patch | view | raw | blame | history
hsarweb/src/de/hsadmin/web/Context.java 26 ●●●●● patch | view | raw | blame | history
hsarweb/src/de/hsadmin/web/Modules.java 22 ●●●●● patch | view | raw | blame | history
hsarweb/src/texts/messages_de.properties 1 ●●●● patch | view | raw | blame | history
hsarweb/src/texts/messages_en.properties 1 ●●●● patch | view | raw | blame | history
hsarweb/webapp/WEB-INF/faces-config.xml 19 ●●●●● patch | view | raw | blame | history
hsarweb/webapp/WEB-INF/web.xml 70 ●●●●● patch | view | raw | blame | history
hsarweb/webapp/hello/index.xhtml 21 ●●●●● patch | view | raw | blame | history
hsarweb/webapp/index.jsp 12 ●●●●● patch | view | raw | blame | history
hsarweb/webapp/resources/images/logo.png patch | view | raw | blame | history
hsarweb/webapp/resources/styles/hsar.css 93 ●●●●● patch | view | raw | blame | history
hsarweb/webapp/templates/menu-template.xhtml 26 ●●●●● patch | view | raw | blame | history
hsarweb/webapp/templates/template.xhtml 33 ●●●●● patch | view | raw | blame | history
hsarweb/build.xml
New file
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="hsarweb" default="war">
    <path id="cp">
        <fileset dir="lib">
            <include name="**/*.jar"/>
        </fileset>
    </path>
    <target name="war" depends="compile">
        <war destfile="build/hsarweb.war" basedir="webapp">
            <lib dir="lib">
                <include name="**/*.jar"/>
            </lib>
            <classes dir="build/cls" />
            <classes dir="src">
                <include name="**/*.properties"/>
            </classes>
        </war>
    </target>
    <target name="compile">
        <mkdir dir="build/cls"/>
        <javac srcdir="src" destdir="build/cls"
             classpathref="cp" debug="on"
        />
    </target>
</project>
hsarweb/lib/cas-client-core-3.1.10.jar
Binary files differ
hsarweb/lib/commons-beanutils-1.7.0.jar
Binary files differ
hsarweb/lib/commons-codec-1.3.jar
Binary files differ
hsarweb/lib/commons-collections-3.2.jar
Binary files differ
hsarweb/lib/commons-digester-1.8.jar
Binary files differ
hsarweb/lib/commons-discovery-0.4.jar
Binary files differ
hsarweb/lib/commons-logging-1.1.1.jar
Binary files differ
hsarweb/lib/jstl-api-1.2.jar
Binary files differ
hsarweb/lib/jstl-impl-1.2.jar
Binary files differ
hsarweb/lib/myfaces-api-2.0.1.jar
Binary files differ
hsarweb/lib/myfaces-impl-2.0.1.jar
Binary files differ
hsarweb/src/de/hsadmin/web/Bean.java
New file
@@ -0,0 +1,23 @@
package de.hsadmin.web;
import java.text.DateFormat;
import java.util.Date;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class Bean {
    public final static DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
    public String getMessage() {
        return "Hallo Welt";
    }
    public String getTime() {
        return df.format(new Date());
    }
}
hsarweb/src/de/hsadmin/web/Context.java
New file
@@ -0,0 +1,26 @@
package de.hsadmin.web;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
@ManagedBean
@SessionScoped
public class Context {
    private ExternalContext getContext() {
        return FacesContext.getCurrentInstance().getExternalContext();
    }
    public String getUser() {
        Assertion assertion = (Assertion) getContext().getSessionMap().get(AbstractCasFilter.CONST_CAS_ASSERTION);
        AttributePrincipal principal = assertion.getPrincipal();
        return principal.getName();
    }
}
hsarweb/src/de/hsadmin/web/Modules.java
New file
@@ -0,0 +1,22 @@
package de.hsadmin.web;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
@ManagedBean
@ApplicationScoped
public class Modules {
    public String[] pageNames = new String[] { "hello" };
    public List<String> getPageNames() {
        ArrayList<String> names = new ArrayList<String>();
        for (String name : pageNames) {
            names.add(name);
        }
        return names;
    }
}
hsarweb/src/texts/messages_de.properties
New file
@@ -0,0 +1 @@
hello=Hallo
hsarweb/src/texts/messages_en.properties
New file
@@ -0,0 +1 @@
hello=Hello
hsarweb/webapp/WEB-INF/faces-config.xml
New file
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
        version="2.0">
    <application>
        <locale-config>
            <default-locale>de</default-locale>
            <supported-locale>en</supported-locale>
        </locale-config>
        <message-bundle>texts.messages</message-bundle>
        <resource-bundle>
            <base-name>texts.messages</base-name>
            <var>msgs</var>
        </resource-bundle>
    </application>
</faces-config>
hsarweb/webapp/WEB-INF/web.xml
New file
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5">
    <filter>
        <filter-name>CAS Authentication Filter</filter-name>
        <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
        <init-param>
            <param-name>casServerLoginUrl</param-name>
            <param-value>http://agnes.ostwall195.de:8080/cas/login</param-value>
        </init-param>
        <init-param>
            <param-name>serverName</param-name>
            <param-value>http://agnes.ostwall195.de:8080</param-value>
        </init-param>
        <init-param>
            <param-name>service</param-name>
            <param-value>http://agnes.ostwall195.de:8080/hsarweb</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>CAS Validation Filter</filter-name>
        <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
        <init-param>
            <param-name>casServerUrlPrefix</param-name>
            <param-value>http://agnes.ostwall195.de:8080/cas</param-value>
        </init-param>
        <init-param>
            <param-name>serverName</param-name>
            <param-value>http://agnes.ostwall195.de:8080</param-value>
        </init-param>
        <init-param>
            <param-name>proxyReceptorUrl</param-name>
            <param-value>/proxyReceptor</param-value>
        </init-param>
        <init-param>
            <param-name>service</param-name>
            <param-value>http://agnes.ostwall195.de:8080/hsarweb</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CAS Authentication Filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>CAS Validation Filter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>
hsarweb/webapp/hello/index.xhtml
New file
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!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:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
    <title>Hello World</title>
</head>
<body>
    <ui:composition template="/templates/menu-template.xhtml">
        <ui:param name="title" value="Hallo schöne Welt"/>
        <ui:define name="content">
            <f:view>
                Hallo&#160; <h:outputText value="#{context.user}"/>, es ist jetzt&#160; <h:outputText value="#{bean.time}"/> Uhr.
            </f:view>
        </ui:define>
    </ui:composition>
</body>
</html>
hsarweb/webapp/index.jsp
New file
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!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">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Hello World</title>
</head>
<body>
    <jsp:forward page="hello/index.html" />
</body>
</html>
hsarweb/webapp/resources/images/logo.png
hsarweb/webapp/resources/styles/hsar.css
New file
@@ -0,0 +1,93 @@
body {
  font-family:Arial,Helvetica,SansSerif;
  font-style:normal;
  font-variant:normal;
  font-size:12pt;
  font-weight:normal;
  margin:0px;
  padding:0px;
  min-height:1600px;
  color:#707172;
  background-color:#f0f0f0;
}
.page {
  width:944px;
  margin-left:auto;
  margin-top:2px;
  margin-right:auto;
  padding-top:0px;
  padding-left:0px;
  padding-right:0px;
  color:#707172;
  background-color:#ffffff;
}
.header {
  height:68px;
  width:944px;
  margin:0px;
  padding:0px;
  background-color:#005094;
  background-image:url(../resources/images/logo.png);
  background-repeat:no-repeat;
  border-style: none solid;
  border-width: 1px;
  border-color: #005094;
}
.main {
  width:936px;
  margin:0px;
  padding-top:10px;
  padding-left:4px;
  padding-right:4px;
  padding-bottom:0px;
  border-style: none solid;
  border-width: 1px;
  border-color: #dd4901;
}
.menu {
  float:left;
  width:300px;
  margin-left:0px;
  margin-top:0px;
  margin-right:0px;
  padding-top:0px;
  padding-left:0px;
  padding-right:0px;
}
.content {
  width:606px;
  margin-left:304px;
  margin-top:0px;
  margin-right:auto;
  margin-bottom:0px;
  padding-top:0px;
  padding-left:10px;
  padding-right:10px;
}
.footer {
  width:944px;
  clear:left;
  font-family:Arial,Helvetica,SansSerif;
  font-style:normal;
  font-variant:normal;
  font-size:10pt;
  font-weight:normal;
  text-decoration:none;
  text-align:center;
  padding-top:4px;
  padding-bottom:4px;
  padding-left:0px;
  padding-right:0px;
  border-top-color:#ede9e8;
  border-top-width:2pt;
  border-top-style:solid;
  border-left-style: solid;
  border-left-width: 1px;
  border-left-color: #dd4901;
  border-right-style: solid;
  border-right-width: 1px;
  border-right-color: #dd4901;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  border-bottom-color: #dd4901;
}
hsarweb/webapp/templates/menu-template.xhtml
New file
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!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:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
<head>
    <title>Hello World</title>
</head>
<body>
    <ui:composition template="/templates/template.xhtml">
        <ui:define name="menu">
            <f:view>
                <h:dataTable var="menuitem" value="#{modules.pageNames}">
                    <h:column>
                        <h:outputLink value="#{menuitem}/index.html">
                            <h:outputText value="#{msgs.hello}" />
                        </h:outputLink>
                    </h:column>
                </h:dataTable>
            </f:view>
        </ui:define>
    </ui:composition>
</body>
</html>
hsarweb/webapp/templates/template.xhtml
New file
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!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:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:insert name="metadata"/>
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>#{title}</title>
    </h:head>
    <h:body>
        <h:outputStylesheet library="styles" name="hsar.css"/>
        <h:outputScript library="javax.faces" name="jsf.js" target="head"/>
        <div class="page">
            <div class="header">
                <ui:insert name="header" />
            </div>
            <div class="main">
                <div class="menu">
                    <ui:insert name="menu">Default Menu</ui:insert>
                </div>
                <div class="content">
                    <ui:insert name="content">Default Content</ui:insert>
                </div>
            </div>
            <div class="footer">
                <ui:insert name="footer">Default Footer</ui:insert>
            </div>
        </div>
    </h:body>
</html>