Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <context-param>
- <param-name>com.ibm.ws.jsf.JSP_UPDATE_CHECK</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.CONFIG_FILES</param-name>
- <param-value>/WEB-INF/faces-config.xml</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.jsp</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.DISABLE_JWL_MULTIPART_CONTEXT</param-name>
- <param-value>false</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.RESOURCE_EXPIRE_MS</param-name>
- <param-value>31536000000</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.DATETIME_ASSIST_STRICTNESS</param-name>
- <param-value>1</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.NUMBER_ASSIST_STRICTNESS</param-name>
- <param-value>1</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.USE_UNENCODED_CONTEXT_PATH</param-name>
- <param-value></param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.JS_RESOURCE_SERVLET_CACHE</param-name>
- <param-value>false</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.ENCODING_MAPPING</param-name>
- <param-value>converter.properties</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.USE_HXCLIENT_FULL</param-name>
- <param-value>false</param-value>
- </context-param>
- <context-param>
- <param-name>com.ibm.faces.MAX_REQUEST_CONTENT_SIZE</param-name>
- <param-value>0</param-value>
- </context-param>
- <context-param>
- <param-name>com.sun.faces.numberOfLogicalViews</param-name>
- <param-value>100</param-value>
- </context-param>
- <context-param>
- <param-name>com.sun.faces.numberOfViewsInSession</param-name>
- <param-value>100</param-value>
- </context-param>
- <context-param>
- <param-name>com.sun.faces.displayConfiguration</param-name>
- <param-value>false</param-value>
- </context-param>
- <listener>
- <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
- </listener>
- <filter>
- <display-name>AaFilter</display-name>
- <filter-name>AaFilter</filter-name>
- <filter-class>orgmanager.AaFilter</filter-class>
- <init-param>
- <param-name>loginpage</param-name>
- <param-value>/orgmanagerWeb/faces/Login.jsp</param-value>
- </init-param>
- <init-param>
- <param-name>logoutpage</param-name>
- <param-value>/orgmanagerWeb/faces/Logout.jsp</param-value>
- </init-param>
- </filter>
- <filter-mapping>
- <filter-name>AaFilter</filter-name>
- <url-pattern>/faces/Jsp/*</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>/faces/*</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.faces</url-pattern>
- </servlet-mapping>
- <welcome-file-list>
- <welcome-file>index.html</welcome-file>
- <welcome-file>index.htm</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>default.html</welcome-file>
- <welcome-file>default.htm</welcome-file>
- <welcome-file>default.jsp</welcome-file>
- </welcome-file-list>
- <jsp-config>
- <taglib>
- <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
- <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
- </taglib>
- </jsp-config>
- <error-page>
- <error-code>500</error-code>
- <location>/error.jsp</location>
- </error-page>
- <jsp-config>
- <taglib>
- <taglib-uri>http://www.ibm.com/jsf/html_extended</taglib-uri>
- <taglib-location>/WEB-INF/tld/html_extended.tld</taglib-location>
- </taglib>
- </jsp-config>
- <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_1_2.xsd"
- version="1.2">
- <application>
- <message-bundle>Messages</message-bundle>
- <state-manager>com.ibm.faces.application.DevelopmentStateManager</state-manager>
- <property-resolver>com.ibm.faces.databind.SelectItemsPropResolver</property-resolver>
- <variable-resolver>com.ibm.faces.databind.SelectItemsVarResolver</variable-resolver>
- </application>
- <factory>
- <faces-context-factory>com.ibm.faces.context.AjaxFacesContextFactory</faces-context-factory>
- <render-kit-factory>com.ibm.faces.renderkit.AjaxRenderKitFactory</render-kit-factory>
- </factory>
- <managed-bean>
- <managed-bean-name>aaController</managed-bean-name>
- <managed-bean-class>orgmanager.aaController</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>role</property-name>
- <property-class>java.lang.String</property-class>
- <value>INTERNAL</value>
- </managed-property>
- </managed-bean>
- <navigation-rule>
- <from-view-id>/Login.jsp</from-view-id>
- <navigation-case>
- <from-outcome>ok</from-outcome>
- <to-view-id>/Jsp/ManagerFrontpage.jsp</to-view-id>
- <redirect />
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <navigation-case>
- <from-action>#{aaController.logout}</from-action>
- <from-outcome>ok</from-outcome>
- <to-view-id>/Logout.jsp</to-view-id>
- <redirect />
- </navigation-case>
- </navigation-rule>
- <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
- <%@ taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
- <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <HTML>
- <HEAD>
- <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <META name="GENERATOR" content="IBM Software Development Platform">
- <META http-equiv="Content-Style-Type" content="text/css">
- <LINK href="theme/Master.css" rel="stylesheet" type="text/css">
- <TITLE>Organisation Manager</TITLE>
- <LINK rel="stylesheet" href="theme/standardiwsadpan.css"
- type="text/css">
- <LINK rel="stylesheet" type="text/css" href="theme/stylesheet.css"
- title="Style">
- </HEAD>
- <f:view>
- <BODY>
- <h:form styleClass="form" id="loginform">
- <TABLE border="0" class="SisaankirjausTaulukko">
- <TBODY>
- <TR>
- <TD colspan="2" align="center" class="Mustalihavoitu">Organisation manager</TD>
- </TR>
- <TR>
- <TD colspan="2" height="5"><IMG border="0" src="kuvat/tyhja.gif"></TD>
- </TR>
- <TR>
- <TD class="Mustalihavoitu">Login</TD>
- <TD><h:inputText styleClass="inputText" tabindex="1" id="kayttajatunnus" size="8"
- value="#{aaController.loginView.login}"></h:inputText></TD>
- </TR>
- <TR>
- <TD class="Mustalihavoitu">Password</TD>
- <TD><h:inputSecret styleClass="inputText" tabindex="2" id="password" size="8"
- value="#{aaController.loginView.password}"></h:inputSecret></TD>
- </TR>
- <TR>
- <TD colspan="2" height="5"><IMG border="0" src="kuvat/tyhja.gif"></TD>
- </TR>
- <TR>
- <TD colspan="2" align="right"><hx:commandExButton type="submit"
- value="Sign in" styleClass="submit-button90"
- id="button1" action="#{aaController.login}"
- tabindex="3"></hx:commandExButton></TD>
- </TR>
- </TBODY>
- </TABLE>
- </h:form>
- </BODY>
- public class AaController extends BaseController {
- public static final int ROLE_INTERNAL = 1;
- public static final int ROLE_EXTERNAL = 2;
- private loginView loginView = new loginView();
- private int role;
- public String login() throws OrgHallintaException {
- String result = null;
- AaFasadi aaFasadi = new AaFasadi();
- log.info("Loggin in");
- if (aaFasadi.login(loginView.getLogin(), loginView.getPassword())) {
- if (aaFasadi.getEnviroment().trim().equals("PRODUCTION")) {
- loginView.setEnviroment(" ");
- } else {
- loginView.setEnviroment(aaFasadi.getEnviroment());
- }
- result = "ok";
- } else {
- result = "error";
- }
- return result;
- }
- public String logout() {
- AaFasadi aaFasadi = new AaFasadi();
- aaFasadi.logout();
- return "ok";
- }
- public loginView getloginView() {
- return loginView;
- }
- public Kayttaja getUser() {
- return AaFasadi.getUser();
- }
- public class AaFasadi {
- private String enviroment="";
- private static final String USER_SESSION_KEY = "orgmanager.User";
- public static User getUser() {
- ServletRequest req = (ServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
- return getUser(req);
- }
- public static User getUser(ServletRequest req) {
- HttpServletRequest request = (HttpServletRequest) req;
- User user = (User) request.getSession(true).getAttribute(USER_SESSION_KEY);
- return user;
- }
- public boolean login(String LoginName, String password) throws OrgHallintaException {
- User user = null;
- try {
- PersonelLoginTask personelLoginTask = new PersonelLoginTask();
- PersonelLoginView personelLoginView = toimihenkiloSisaankirjausTehtava.execute(LoginName.toUpperCase(), password);
- if (personelLoginView != null) {
- if (personelLoginView.getEnviroment().trim().equals("PRODUCTION"))
- personelLoginView.setEnviroment(" ");
- User = new DefaultUserImpl(personelLoginView);
- Enviroment = personelLoginView.getEnviroment();
- }
- } catch (TehtavanHallintaException e) {
- System.out.println("User " + Usertunnus + " Login failed " + e);
- }
- if (User != null) {
- ServletRequest req = (ServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
- HttpServletRequest request = (HttpServletRequest) req;
- request.getSession(true).setAttribute(User_SESSION_KEY, User);
- return true;
- } else {
- return false;
- }
- }
- public void logout() {
- ServletRequest req = (ServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
- HttpServletRequest request = (HttpServletRequest) req;
- request.getSession(true).removeAttribute(User_SESSION_KEY);
- request.getSession().invalidate();
- }
- public String getEnviroment() {
- return enviroment;
- }
- public void setEnviroment(String ymparisto) {
- this.enviroment = enviroment;
- }
- public class loginView extends BaseView {
- private String login;
- private String password;
- private String Enviroment;
- private Date date = new Date(System.currentTimeMillis());
- public String getlogin() {
- return login;
- }
- public void setlogin(String login) {
- this.login = login;
- }
- public String getpassword() {
- return password;
- }
- public void setpassword(String password) {
- this.password = password;
- }
- public String getEnviroment() {
- return Enviroment;
- }
- public void setEnviroment(String Enviroment) {
- this.Enviroment = Enviroment;
- }
- public void setDate(Date date) {
- this.date = date;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement