Commit 41c6f5ab by juhosa

Merge branch 'master' of g:/bortal/bortal

Conflicts:
	code/external/tuomari

asd
2 parents 0ba5b72f 2ac8beb0
[submodule "code/external/tuomari"]
path = code/external/tuomari
url = tuomari.iki.fi:/home/tuomari/git/iudex/
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/LanBortalAuthModuleClient"/> <classpathentry combineaccessrules="false" exported="true" kind="src" path="/LanBortalAuthModuleClient"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<attribute name="owner.project.facets" value="jst.utility"/> <attribute name="owner.project.facets" value="jst.utility"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
......
...@@ -18,50 +18,68 @@ import javax.mail.internet.MimeMessage.RecipientType; ...@@ -18,50 +18,68 @@ import javax.mail.internet.MimeMessage.RecipientType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.clientutils.BortalLocalContextHolder;
import fi.insomnia.bortal.util.MailMessage; import fi.insomnia.bortal.util.MailMessage;
/** /**
* Message-Driven Bean implementation class for: MailMessageBean * Message-Driven Bean implementation class for: MailMessageBean
* *
*/ */
@MessageDriven( @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") }, mappedName = "jms/mailque")
activationConfig = { @ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Queue" ) },
mappedName = "jms/mailque")
public class MailMessageBean implements MessageListener { public class MailMessageBean implements MessageListener {
@Resource(name = "mail/lanbortal")
private Session mailSession;
private static final Logger logger = LoggerFactory.getLogger(MailMessageBean.class);
/** @Resource(name = "mail/lanbortal")
* Default constructor. private Session mailSession;
*/ private static final Logger logger = LoggerFactory
public MailMessageBean() { .getLogger(MailMessageBean.class);
// TODO Auto-generated constructor stub
}
/** /**
* @see MessageListener#onMessage(Message) * Default constructor.
*/ */
public void onMessage(Message message) { public MailMessageBean() {
// TODO Auto-generated constructor stub
}
MailMessage mailmsg = null; /**
try { * @see MessageListener#onMessage(Message)
mailmsg = (MailMessage) ((ObjectMessage) message).getObject(); */
logger.debug("Got message {}", mailmsg.getToName()); @Override
MimeMessage msg = new MimeMessage(mailSession); public void onMessage(Message message) {
msg.setSubject(mailmsg.getSubject());
msg.setFrom(mailmsg.getFrom());
msg.setRecipient(RecipientType.TO, mailmsg.getTo());
msg.setText(mailmsg.getMessage(), mailmsg.getCharset());
Transport.send(msg);
} catch (JMSException e) { MailMessage mailmsg = null;
logger.debug("Error receiving jms for {}", mailmsg, e); try {
} catch (MessagingException e) { mailmsg = (MailMessage) ((ObjectMessage) message).getObject();
logger.debug("Unsupported encoding exception while sending mail to {}", mailmsg, e); logger.debug("Got message {}", mailmsg.getToName());
} catch (UnsupportedEncodingException e) {
logger.debug("Unsupported encoding exception while sending mail to {}", mailmsg, e);
}
} if (BortalLocalContextHolder.isInDevelopmentMode()) {
String dmessage = " To: "
+ mailmsg.getTo() + "\n Subject: "
+ mailmsg.getSubject() + "\n Text: "
+ mailmsg.getMessage() + "\n";
logger.debug("Not sendet mail (debug -mode): {}", dmessage);
} else {
MimeMessage msg = new MimeMessage(mailSession);
msg.setSubject(mailmsg.getSubject());
msg.setFrom(mailmsg.getFrom());
msg.setRecipient(RecipientType.TO, mailmsg.getTo());
msg.setText(mailmsg.getMessage(), mailmsg.getCharset());
Transport.send(msg);
}
} catch (JMSException e) {
logger.debug("Error receiving jms for {}", mailmsg, e);
} catch (MessagingException e) {
logger.debug(
"Unsupported encoding exception while sending mail to {}",
mailmsg, e);
} catch (UnsupportedEncodingException e) {
logger.debug(
"Unsupported encoding exception while sending mail to {}",
mailmsg, e);
}
}
} }
package fi.insomnia.bortal.beans.mail;
import javax.ejb.Local;
@Local
public interface MailBeanLocal {
}
...@@ -11,6 +11,8 @@ public class BortalLocalContextHolder { ...@@ -11,6 +11,8 @@ public class BortalLocalContextHolder {
private String hostname; private String hostname;
private final Map<IAppPermission, Boolean> rightcache = new HashMap<IAppPermission, Boolean>(); private final Map<IAppPermission, Boolean> rightcache = new HashMap<IAppPermission, Boolean>();
private static boolean inDevelopmentMode = false;
public BortalLocalContextHolder() { public BortalLocalContextHolder() {
} }
...@@ -63,4 +65,16 @@ public class BortalLocalContextHolder { ...@@ -63,4 +65,16 @@ public class BortalLocalContextHolder {
return getThread(); return getThread();
} }
public static boolean isInDevelopmentMode() {
return inDevelopmentMode;
}
public static void setInDevelopmentMode(boolean developmentMode) {
inDevelopmentMode = developmentMode;
}
} }
\ No newline at end of file
...@@ -8,105 +8,105 @@ import javax.mail.internet.InternetAddress; ...@@ -8,105 +8,105 @@ import javax.mail.internet.InternetAddress;
import fi.insomnia.bortal.model.User; import fi.insomnia.bortal.model.User;
public class MailMessage implements Serializable { public class MailMessage implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = -4769468394850407107L; private static final long serialVersionUID = -4769468394850407107L;
private static final String DEFAULT_MAIL_CHARSET = "iso-8859-1"; private static final String DEFAULT_MAIL_CHARSET = "iso-8859-1";
private String subject; private String subject;
private String fromName = "Insomnia lippukauppa"; private String fromName = "Insomnia lippukauppa";
private String fromAddress = "info@insomnia.fi"; private String fromAddress = "info@insomnia.fi";
private String toName; private String toName;
private String toAddress; private String toAddress;
private String message; private String message;
private String charset = DEFAULT_MAIL_CHARSET; private String charset = DEFAULT_MAIL_CHARSET;
public InternetAddress getTo() throws UnsupportedEncodingException { public InternetAddress getTo() throws UnsupportedEncodingException {
return new InternetAddress(toAddress, toName, getCharset()); return new InternetAddress(toAddress, toName, getCharset());
} }
public InternetAddress getFrom() throws UnsupportedEncodingException { public InternetAddress getFrom() throws UnsupportedEncodingException {
return new InternetAddress(fromAddress, fromName, getCharset()); return new InternetAddress(fromAddress, fromName, getCharset());
} }
public String getSubject() { public String getSubject() {
return subject; return subject;
} }
public void setSubject(String subject) { public void setSubject(String subject) {
this.subject = subject; this.subject = subject;
} }
public String getFromName() { public String getFromName() {
return fromName; return fromName;
} }
public void setFromName(String fromName) { public void setFromName(String fromName) {
this.fromName = fromName; this.fromName = fromName;
} }
public String getFromAddress() { public String getFromAddress() {
return fromAddress; return fromAddress;
} }
public void setFromAddress(String fromAddress) { public void setFromAddress(String fromAddress) {
this.fromAddress = fromAddress; this.fromAddress = fromAddress;
} }
public String getToName() { public String getToName() {
return toName; return toName;
} }
public void setToName(String toName) { public void setToName(String toName) {
this.toName = toName; this.toName = toName;
} }
public String getToAddress() { public String getToAddress() {
return toAddress; return toAddress;
} }
public void setToAddress(String toAddress) { public void setToAddress(String toAddress) {
this.toAddress = toAddress; this.toAddress = toAddress;
} }
public String getMessage() { public String getMessage() {
return message; return message;
} }
public void setMessage(Object... msgpart) { public void setMessage(Object... msgpart) {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
for (Object o : msgpart) { for (Object o : msgpart) {
msg.append(o); msg.append(o);
} }
message = msg.toString(); message = msg.toString();
} }
public void setMessage(String message) { public void setMessage(String message) {
this.message = message; this.message = message;
} }
public static String getDefaultMailCharset() { public static String getDefaultMailCharset() {
return DEFAULT_MAIL_CHARSET; return DEFAULT_MAIL_CHARSET;
} }
public void setCharset(String charset) { public void setCharset(String charset) {
this.charset = charset; this.charset = charset;
} }
public String getCharset() { public String getCharset() {
return charset; return charset;
} }
public void setTo(User user) { public void setTo(User user) {
setToName(user.getWholeName()); setToName(user.getWholeName());
setToAddress(user.getEmail()); setToAddress(user.getEmail());
} }
@Override @Override
public String toString() { public String toString() {
return new StringBuilder("fi.insomnia.bortal.util.MailMessage[to=").append(toAddress).append("]").toString(); return new StringBuilder("fi.insomnia.bortal.util.MailMessage[to=").append(toAddress).append("]").toString();
} }
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<attribute name="owner.project.facets" value="jst.utility"/> <attribute name="owner.project.facets" value="jst.utility"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
......
...@@ -14,6 +14,7 @@ public class GenericEntity extends EntityEquals implements ModelInterface<Intege ...@@ -14,6 +14,7 @@ public class GenericEntity extends EntityEquals implements ModelInterface<Intege
private static final long serialVersionUID = -9041737052951021560L; private static final long serialVersionUID = -9041737052951021560L;
public static final String ID_COLUMN = "id"; public static final String ID_COLUMN = "id";
@Id @Id
@Column(name = ID_COLUMN, nullable = false) @Column(name = ID_COLUMN, nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
......
...@@ -47,7 +47,6 @@ public class User extends GenericEntity { ...@@ -47,7 +47,6 @@ public class User extends GenericEntity {
private static final long serialVersionUID = -1632200627103418206L; private static final long serialVersionUID = -1632200627103418206L;
@Column(name = "created", nullable = false) @Column(name = "created", nullable = false)
// , columnDefinition = "timestamptz default now()")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar created = Calendar.getInstance(); private Calendar created = Calendar.getInstance();
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0"> id="WebApp_ID" version="3.0">
<display-name>LanBortalWeb</display-name> <display-name>LanBortalWeb</display-name>
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
<session-timeout>30</session-timeout> <session-timeout>30</session-timeout>
</session-config> </session-config>
<context-param> <context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
<!--param-value>Production</param-value-->
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value> <param-value>true</param-value>
</context-param> </context-param>
...@@ -49,7 +54,7 @@ ...@@ -49,7 +54,7 @@
<servlet-name>UserCardServlet</servlet-name> <servlet-name>UserCardServlet</servlet-name>
<url-pattern>/UserCard</url-pattern> <url-pattern>/UserCard</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
<servlet-name>CardTemplateServlet</servlet-name> <servlet-name>CardTemplateServlet</servlet-name>
<servlet-class>fi.insomnia.bortal.servlet.CardTemplateServlet</servlet-class> <servlet-class>fi.insomnia.bortal.servlet.CardTemplateServlet</servlet-class>
...@@ -58,7 +63,7 @@ ...@@ -58,7 +63,7 @@
<servlet-name>CardTemplateServlet</servlet-name> <servlet-name>CardTemplateServlet</servlet-name>
<url-pattern>/CardTemplate</url-pattern> <url-pattern>/CardTemplate</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
<servlet-name>PlaceMap</servlet-name> <servlet-name>PlaceMap</servlet-name>
...@@ -119,23 +124,12 @@ ...@@ -119,23 +124,12 @@
<servlet-name>PrintBill</servlet-name> <servlet-name>PrintBill</servlet-name>
<url-pattern>/PrintBill</url-pattern> <url-pattern>/PrintBill</url-pattern>
</servlet-mapping> </servlet-mapping>
<!-- <error-page> <!-- <error-page> <error-code>401</error-code> <location>/permissionDeniedRedirect.jsp</location>
<error-code>401</error-code> </error-page> <error-page> <error-code>403</error-code> <location>/permissionDeniedRedirect.jsp</location>
<location>/permissionDeniedRedirect.jsp</location> </error-page> <error-page> <exception-type>fi.insomnia.bortal.exceptions.PermissionDeniedException</exception-type>
</error-page> <location>/permissionDeniedRedirect.jsp</location> </error-page> <error-page>
<error-page> <exception-type>javax.servlet.ServletException</exception-type> <location>/permissionDeniedRedirect.jsp</location>
<error-code>403</error-code> </error-page> -->
<location>/permissionDeniedRedirect.jsp</location>
</error-page>
<error-page>
<exception-type>fi.insomnia.bortal.exceptions.PermissionDeniedException</exception-type>
<location>/permissionDeniedRedirect.jsp</location>
</error-page>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/permissionDeniedRedirect.jsp</location>
</error-page>
-->
<persistence-unit-ref> <persistence-unit-ref>
<persistence-unit-ref-name>BortalEMF</persistence-unit-ref-name> <persistence-unit-ref-name>BortalEMF</persistence-unit-ref-name>
</persistence-unit-ref> </persistence-unit-ref>
...@@ -150,4 +144,6 @@ ...@@ -150,4 +144,6 @@
<url-pattern>/PlaceGroupPdf</url-pattern> <url-pattern>/PlaceGroupPdf</url-pattern>
</servlet-mapping> </servlet-mapping>
</web-app> </web-app>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
<ui:define name="content">
<h1>#{i18n['actionlog.messagelist.header']}</h1>
<h:dataTable styleClass="bordertable" id="message" value="#{actionLogMessageView.messages}" var="message">
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.user']}" />
</f:facet>
<h:outputText value="#{message.user}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.crew']}" />
</f:facet>
<h:outputText value="#{message.crew}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.message']}" />
</f:facet>
<h:outputText value="#{message.message}" />
</h:column>
</h:dataTable>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
...@@ -23,14 +23,19 @@ ...@@ -23,14 +23,19 @@
</h:inputText> </h:inputText>
<h:outputLabel value="#{i18n['bill.billNumber']}:" /> <h:outputLabel value="#{i18n['bill.billNumber']}:" />
<h:inputText value="#{billEditView.bill.billNumber}" /> <h:inputText value="#{billEditView.bill.billNumber}" />
<h:outputLabel value="#{i18n['bill.addr1']}:" /> <h:outputLabel value="#{i18n['bill.addr1']}:" />
<h:inputText value="#{billEditView.bill.addr1}" /> <h:inputText value="#{billEditView.bill.addr1}" />
<h:outputLabel value="#{i18n['bill.addr2']}:" /> <h:outputLabel value="#{i18n['bill.addr2']}:" />
<h:inputText value="#{billEditView.bill.addr2}" /> <h:inputText value="#{billEditView.bill.addr2}" />
<h:outputLabel value="#{i18n['bill.addr3']}:" /> <h:outputLabel value="#{i18n['bill.addr3']}:" />
<h:inputText value="#{billEditView.bill.addr3}" /> <h:inputText value="#{billEditView.bill.addr3}" />
<h:outputLabel value="#{i18n['bill.addr4']}:" /> <h:outputLabel value="#{i18n['bill.addr4']}:" />
<h:inputText value="#{billEditView.bill.addr4}" /> <h:inputText value="#{billEditView.bill.addr4}" />
<h:outputLabel value="#{i18n['bill.addr5']}:" /> <h:outputLabel value="#{i18n['bill.addr5']}:" />
<h:inputText value="#{billEditView.bill.addr5}" /> <h:inputText value="#{billEditView.bill.addr5}" />
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<ui:define name="content"> <ui:define name="content">
<h:outputLabel rendered="#{sessionHandler.isInDevelopmentMode()}">
Development-tilassa.
Vaihda web.xml-tiedostosta ohjelman tila (javax.faces.PROJECT_STAGE) Productioniksi ennen kuin julkaiset ohjelman tuotantoon.
</h:outputLabel>
<h1>Insomnia lippukauppa</h1> <h1>Insomnia lippukauppa</h1>
<h3>Lippujen hinnat</h3> <h3>Lippujen hinnat</h3>
<ul> <ul>
......
...@@ -19,7 +19,16 @@ ...@@ -19,7 +19,16 @@
<div id="header"> <div id="header">
<div id="logo"> <div id="logo">
<img src="#{request.contextPath}/resources/style/insomnia2/img/logo.png" /> <c:choose>
<c:when test="#{sessionHandler.isInDevelopmentMode()}">
<img src="#{request.contextPath}/resources/style/insomnia2/img/devel_logo.png" />
</c:when>
<c:otherwise>
<img src="#{request.contextPath}/resources/style/insomnia2/img/logo.png" />
</c:otherwise>
</c:choose>
</div> </div>
<div id="login"> <div id="login">
<h:outputText rendered="#{sessionHandler.loggedIn}" <h:outputText rendered="#{sessionHandler.loggedIn}"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
<f:event type="preRenderView" listener="#{newsListView.initView}" /> <f:event type="preRenderView" listener="#{newsListView.initView}" />
</f:metadata> </f:metadata>
<ui:param name="thispage" value="page.user.create" />
<ui:define name="content"> <ui:define name="content">
<h1>#{i18n['newslist.header']}</h1> <h1>#{i18n['newslist.header']}</h1>
......
...@@ -2,6 +2,7 @@ package fi.insomnia.bortal; ...@@ -2,6 +2,7 @@ package fi.insomnia.bortal;
import java.io.IOException; import java.io.IOException;
import javax.faces.context.FacesContext;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
...@@ -23,7 +24,9 @@ import fi.insomnia.bortal.model.User; ...@@ -23,7 +24,9 @@ import fi.insomnia.bortal.model.User;
*/ */
public class HostnameFilter implements Filter { public class HostnameFilter implements Filter {
private static final Logger logger = LoggerFactory.getLogger(HostnameFilter.class); private static final Logger logger = LoggerFactory
.getLogger(HostnameFilter.class);
private boolean developmentMode = false;
/** /**
* Default constructor. * Default constructor.
...@@ -44,7 +47,9 @@ public class HostnameFilter implements Filter { ...@@ -44,7 +47,9 @@ public class HostnameFilter implements Filter {
* @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
*/ */
@Override @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = null; HttpServletRequest httpRequest = null;
if (request != null && request instanceof HttpServletRequest) { if (request != null && request instanceof HttpServletRequest) {
...@@ -66,16 +71,19 @@ public class HostnameFilter implements Filter { ...@@ -66,16 +71,19 @@ public class HostnameFilter implements Filter {
} }
String hostname = url.substring(beginindex, lastindex); String hostname = url.substring(beginindex, lastindex);
httpRequest.getSession().setAttribute(EventBeanLocal.HTTP_URL_HOSTNAME, hostname); httpRequest.getSession().setAttribute(
EventBeanLocal.HTTP_URL_HOSTNAME, hostname);
BortalLocalContextHolder.setHostname(hostname); BortalLocalContextHolder.setHostname(hostname);
BortalLocalContextHolder.setInDevelopmentMode(developmentMode);
if (httpRequest.getUserPrincipal() == null) { if (httpRequest.getUserPrincipal() == null) {
try { try {
httpRequest.login(User.ANONYMOUS_LOGINNAME, null); httpRequest.login(User.ANONYMOUS_LOGINNAME, null);
} catch (Throwable t) { } catch (Throwable t) {
logger.warn("Error logging in as anonymous... ignoring.. ", t); logger.warn("Error logging in as anonymous... ignoring.. ",
t);
} }
} }
...@@ -94,7 +102,16 @@ public class HostnameFilter implements Filter { ...@@ -94,7 +102,16 @@ public class HostnameFilter implements Filter {
*/ */
@Override @Override
public void init(FilterConfig fConfig) throws ServletException { public void init(FilterConfig fConfig) throws ServletException {
// Nothing... // check if software is in development -mode
FacesContext fc = FacesContext.getCurrentInstance();
String stage = fc.getExternalContext().getInitParameter(
"javax.faces.PROJECT_STAGE");
if (stage.trim().equalsIgnoreCase("Development")) {
developmentMode = true;
}
} }
public static String getCurrentHostname(HttpSession sess) { public static String getCurrentHostname(HttpSession sess) {
...@@ -108,4 +125,5 @@ public class HostnameFilter implements Filter { ...@@ -108,4 +125,5 @@ public class HostnameFilter implements Filter {
return ret; return ret;
} }
} }
...@@ -17,9 +17,11 @@ import javax.servlet.http.HttpServletRequest; ...@@ -17,9 +17,11 @@ import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.HostnameFilter;
import fi.insomnia.bortal.beans.EventBeanLocal; import fi.insomnia.bortal.beans.EventBeanLocal;
import fi.insomnia.bortal.beans.PermissionBeanLocal; import fi.insomnia.bortal.beans.PermissionBeanLocal;
import fi.insomnia.bortal.beans.RoleBeanLocal; import fi.insomnia.bortal.beans.RoleBeanLocal;
import fi.insomnia.bortal.clientutils.BortalLocalContextHolder;
import fi.insomnia.bortal.enums.apps.IAppPermission; import fi.insomnia.bortal.enums.apps.IAppPermission;
import fi.insomnia.bortal.model.User; import fi.insomnia.bortal.model.User;
...@@ -152,4 +154,8 @@ public class SessionHandler { ...@@ -152,4 +154,8 @@ public class SessionHandler {
} }
return preurlString; return preurlString;
} }
public boolean isInDevelopmentMode() {
return BortalLocalContextHolder.isInDevelopmentMode();
}
} }
package fi.insomnia.bortal.web.cdiview.actionlog;
import java.util.ArrayList;
import javax.faces.bean.RequestScoped;
import javax.inject.Named;
import fi.insomnia.bortal.web.cdiview.actionlog.ActionMessage;
import fi.insomnia.bortal.web.cdiview.GenericCDIView;
@Named
@RequestScoped
public class ActionLogMessageView extends GenericCDIView {
private static final long serialVersionUID = 1L;
ArrayList<ActionMessage> messages = null;
public ArrayList<ActionMessage> getMessages() {
if(messages == null) {
messages = new ArrayList<ActionMessage>();
ActionMessage test = new ActionMessage();
test.setTimestamp("test123");
test.setUser("homo");
test.setCrew("oijdsaofdsa");
test.setMessage("pupu on siella");
messages.add(test);
messages.add(test);
messages.add(test);
messages.add(test);
}
return messages;
}
}
package fi.insomnia.bortal.web.cdiview.actionlog;
public class ActionMessage {
private String timestamp;
private String user;
private String crew;
private String message;
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getCrew() {
return crew;
}
public void setCrew(String crew) {
this.crew = crew;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
\ No newline at end of file
...@@ -42,6 +42,7 @@ public class UserView extends GenericCDIView { ...@@ -42,6 +42,7 @@ public class UserView extends GenericCDIView {
private CroppedImage croppedImage; private CroppedImage croppedImage;
private User user; private User user;
@Inject @Inject
private transient Conversation conversation; private transient Conversation conversation;
...@@ -56,6 +57,7 @@ public class UserView extends GenericCDIView { ...@@ -56,6 +57,7 @@ public class UserView extends GenericCDIView {
private boolean canSave = false; private boolean canSave = false;
private String password; private String password;
private String passwordcheck; private String passwordcheck;
@EJB @EJB
private CardTemplateBeanLocal cardBean; private CardTemplateBeanLocal cardBean;
......
TuomariUtils @ a91e217e
Subproject commit a91e217e681f3baa8e73f1edd22b263a99a6828d
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!