Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 149 → Rev 150

/impl/conf/WEB-INF/web.xml
6,6 → 6,10
 
 
<filter>
<filter-name>CookieFilter</filter-name>
<filter-class>pt.estgp.estgweb.web.filters.CookieFilter</filter-class>
</filter>
<filter>
<filter-name>UserSessionFilter</filter-name>
<filter-class>pt.estgp.estgweb.web.filters.UserSessionFilter</filter-class>
</filter>
35,6 → 39,10
</filter>
 
<filter-mapping>
<filter-name>CookieFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Set-Character-Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
/impl/src/java/jomm/web/filter/SetCharacterEncodingFilter.java
26,7 → 26,9
import javax.servlet.ServletResponse;
 
public class SetCharacterEncodingFilter implements Filter{
 
private static Logger logger = Logger.getLogger(SetCharacterEncodingFilter.class);
 
private FilterConfig filterConfig = null;
private String encoding = null;
37,6 → 39,7
IOException, ServletException {
 
 
//try{
HttpServletRequest hrequest = (HttpServletRequest) request;
hrequest.getSession().setMaxInactiveInterval(900);
 
47,6 → 50,11
hrequest.setCharacterEncoding(encoding);
}
chain.doFilter(request, response);
/*}
catch (IllegalStateException e)
{
logger.warn(e);
}*/
}
public void init(FilterConfig filterConfig) throws
/impl/src/java/pt/estgp/estgweb/web/utils/RequestUtils.java
8,6 → 8,7
 
import org.apache.struts.action.ActionMessages;
import org.apache.struts.action.ActionMessage;
import jomm.utils.BytesUtils;
 
/**
* @author Jorge Machado
37,8 → 38,31
Cookie cookie = new Cookie("bacoSession", request.getSession().getId());
response.addCookie(cookie);
return cookie.getValue();
}
throw new NoCookiesException();
}
 
public static boolean existRequester(HttpServletRequest request, HttpServletResponse response) throws NoCookiesException
{
if(request.getCookies() == null || request.getCookies().length == 0)
{
Cookie cookie = new Cookie("bacoSession", BytesUtils.generateHexKey());
response.addCookie(cookie);
return false;
}
else if(request.getCookies() != null && request.getCookies().length > 0)
{
for(Cookie cookie: request.getCookies())
{
if(cookie.getName().equals("bacoSession"))
{
return true;
}
}
Cookie cookie = new Cookie("bacoSession",BytesUtils.generateHexKey());
response.addCookie(cookie);
return false;
}
throw new NoCookiesException();
}
 
/impl/src/java/pt/estgp/estgweb/web/filters/CookieFilter.java
New file
0,0 → 1,52
package pt.estgp.estgweb.web.filters;
 
import pt.estgp.estgweb.web.utils.RequestUtils;
 
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
 
/**
*
* @author Jorge Machado
*/
 
public class CookieFilter implements Filter
{
 
public CookieFilter()
{
}
 
public void init(FilterConfig config)
{
 
}
 
/**
*
* @param request The servlet request we are processing
* @param chain The filter chain we are processing
*
* @exception java.io.IOException if an input/output error occurs
* @exception javax.servlet.ServletException if a servlet error occurs
*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
if(RequestUtils.existRequester((HttpServletRequest)request,(HttpServletResponse)response))
{
chain.doFilter(request, response);
}
else
{
((HttpServletResponse)response).sendRedirect(((HttpServletRequest)request).getContextPath() + "/Welcome.do");
}
}
 
public void destroy()
{
// Nothing
}
}
/impl/src/java/pt/estgp/estgweb/web/filters/UserSessionFilter.java
75,6 → 75,10
}
chain.doFilter(request,response);
}
//catch (IllegalStateException e)
//{
// logger.warn(e);
//}
catch (Throwable e)
{
if(e instanceof NoCookiesException)
83,6 → 87,7
}
else
{
 
logger.error(e,e);
((HttpServletResponse)response).sendError(500);
}
/impl/src/web/index.jsp
1,3 → 1,4
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@page language="java" contentType="UTF-8" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<logic:forward name="welcome"/>
/impl/src/web/css/style.css
6,7 → 6,9
 
/****************************Text Size*************************************************/
 
form ul {
 
 
form ul,.errorPage ul {
margin-left: 15px;
}
 
39,7 → 41,7
.pFooter a {
font-style: italic;
}
.content .pFooter a:hover
#content .pFooter a:hover
{
color:white;
}
75,7 → 77,7
PADDING-TOP: 43px;
}
 
TD.rightPage, TD.rightPagePortal {
TD#rightPage, TD.rightPagePortal {
VERTICAL-ALIGN: top; /*WIDTH: 160px;*/
}
 
94,15 → 96,15
 
}
 
.content h2 a {
#content h2 a {
font-size: 0.8em;
}
 
.content h2 {
#content h2 {
font-size: 1em;
}
 
#pageStructure .content {
#pageStructure #content {
border-right: 0;
border-top: 0;
border-bottom: 0;
110,7 → 112,7
margin-right:1px;
}
 
#pageStructure td.content {
#pageStructure td#content {
border-left: 1px solid #8ec73f;
border-right: 1px solid #8ec73f;
border-bottom: 1px solid #8ec73f;
128,25 → 130,26
height: 167px;
}
 
.content .imageAnnouncement img {
#content .imageAnnouncement img {
width: 341px;
height: 167px;
}
 
 
.content {
#content {
border: 1px solid #8ec73f;
text-align:left;
}
 
.content a:link, .content a:visited {
#content a:link, .content a:visited {
color: #4d4d4d;
}
 
.content a:hover {
#content a:hover {
color: #8EC73F
}
 
.content, .contentPortal {
#content, .contentPortal {
LEFT: 0;
RIGHT: 0;
WIDTH: 100%;
508,7 → 511,7
 
/*Isto tem de ser generico o H1 jáe um header nao necessita da classe .header para nada*/
/*Block Titles*/
.content h1, #lastnews h1 {
#content h1, #lastnews h1 {
margin-bottom: 1px;
color: #FFFFFF;
background-color: #8EC73F;
/impl/src/web/layout/errorLayout.jsp
1,30 → 1,43
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ page contentType="text/html" %>
<%@ page pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
<html:html locale="true">
<head>
<html:base />
<title><bean:message key="site.title"/> - <tiles:getAsString name="title"/></title>
<html:base/>
<title>
<bean:message key="site.title"/>
-
<tiles:getAsString name="title"/>
</title>
<jsp:include page="/layout/scripts.jsp"/>
</head>
<body>
<div id="header">
<tiles:insert attribute="header"/>
</div>
<table id="bigtable">
<table width="100%">
<tr>
<td id="content">
<tiles:insert attribute="body" />
<td align="center">
<div id="body">
<div id="header">
<tiles:insert attribute="header"/>
</div>
<table id="page" width="100%">
<tr>
<td id="content" class="errorPage">
<tiles:insert attribute="body"/>
</td>
</tr>
</table>
<div id="footer">
<tiles:insert attribute="footer"/>
</div>
</div>
</td>
</tr>
</table>
<div id="footer">
<tiles:insert attribute="footer"/>
</div>
</body>
</html:html>
/impl/src/web/layout/layout1.jsp
34,7 → 34,7
<td id="leftPage">
<tiles:insert attribute="navigation"/>
</td>
<td class="content">
<td id="content">
<tiles:insert attribute="topnav"/>
<tiles:insert attribute="body"/>
</td>
/impl/src/web/layout/layout2.jsp
24,7 → 24,7
<td><tiles:insert attribute="navigationTop"/></td>
</tr>
<tr>
<td class="content">
<td id="content">
<tiles:insert attribute="topnav"/>
<tiles:insert attribute="body" />
</td>
/impl/src/web/layout/layoutPortal.jsp
38,7 → 38,7
 
<tiles:insert attribute="body" />
</td>
<td class="rightPagePortal">
<td id="rightPagePortal">
<tiles:insert attribute="navigationRight"/>
</td>
</tr>
/impl/src/web/layout/layout3.jsp
24,11 → 24,11
<td colspan="2"><tiles:insert attribute="navigationTop"/></td>
</tr>
<tr>
<td class="content">
<td id="content">
<tiles:insert attribute="topnav"/>
<tiles:insert attribute="body" />
</td>
<td class="rightPage">
<td id="rightPage">
<tiles:insert attribute="navigation" />
</td>
</tr>
/impl/src/web/layout/layout4.jsp
29,11 → 29,11
<td id="leftPage">
<tiles:insert attribute="navigationLeft" />
</td>
<td class="content">
<td id="content">
<tiles:insert attribute="topnav"/>
<tiles:insert attribute="body" />
</td>
<td class="rightPage">
<td id="rightPage">
<tiles:insert attribute="navigationRight"/>
</td>
</tr>
/impl/src/web/layout/layoutintranet.jsp
23,7 → 23,7
<td><tiles:insert attribute="navigationTop"/></td>
</tr>
<tr>
<td class="content">
<td id="content">
<tiles:insert attribute="topnav"/>
<tiles:insert attribute="separators"/>
<tiles:insert attribute="body" />
/impl/src/web/public/index.jsp
27,7 → 27,7
 
<script type="text/javascript">
<!--
getFlashNews('<%=request.getContextPath()%>/public/announcements/getFlashNews.jsp',<%=Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS_TIMEOUT%>);
getFlashNews('<%=request.getContextPath()%>/public/announcements/getFlashNews.jsp',<%=Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS_TIMEOUT%>);
-->
</script>