# HG changeset patch # User František Kučera # Date 1234377388 -3600 # Node ID e3e2a3a4c36afdc65b91edb70631b8c3cf08b232 # Parent 08480e8e119981493f65ed319a9bf88f0937fed2 Zobrazování, zatím vycpávkového, denního souhrnu. diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/nbproject/genfiles.properties --- a/java/HrisniciSpameri/nbproject/genfiles.properties Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/nbproject/genfiles.properties Wed Feb 11 19:36:28 2009 +0100 @@ -1,8 +1,8 @@ -build.xml.data.CRC32=4b8c700f +build.xml.data.CRC32=0d6b07a9 build.xml.script.CRC32=20d691ac build.xml.stylesheet.CRC32=c0ebde35 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=4b8c700f +nbproject/build-impl.xml.data.CRC32=0d6b07a9 nbproject/build-impl.xml.script.CRC32=cde5e1cb nbproject/build-impl.xml.stylesheet.CRC32=174458fc diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/nbproject/private/private.properties --- a/java/HrisniciSpameri/nbproject/private/private.properties Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/nbproject/private/private.properties Wed Feb 11 19:36:28 2009 +0100 @@ -1,10 +1,16 @@ -deploy.ant.properties.file=/home/fiki/.netbeans/6.5/glassfish_2.properties +auxiliary.org-netbeans-modules-web-client-tools-api.clientdebug=false +auxiliary.org-netbeans-modules-web-client-tools-api.FIREFOX=true +auxiliary.org-netbeans-modules-web-client-tools-api.INTERNET_5f_EXPLORER=false +auxiliary.org-netbeans-modules-web-client-tools-api.serverdebug=true +deploy.ant.properties.file=/home/fiki/.netbeans/6.5/glassfish.properties j2ee.platform.classpath=/usr/local/glassfish-v2ur2/lib/javaee.jar:/usr/local/glassfish-v2ur2/lib/jsf-impl.jar:/usr/local/glassfish-v2ur2/lib/activation.jar:/usr/local/glassfish-v2ur2/lib/appserv-tags.jar:/usr/local/glassfish-v2ur2/lib/mail.jar:/usr/local/glassfish-v2ur2/lib/appserv-jstl.jar:/usr/local/glassfish-v2ur2/lib/webservices-tools.jar:/usr/local/glassfish-v2ur2/lib/webservices-rt.jar:/usr/local/glassfish-v2ur2/lib/appserv-ws.jar j2ee.platform.is.jsr109=true j2ee.platform.wscompile.classpath=/usr/local/glassfish-v2ur2/lib/j2ee.jar:/usr/local/glassfish-v2ur2/lib/saaj-api.jar:/usr/local/glassfish-v2ur2/lib/saaj-impl.jar:/usr/local/glassfish-v2ur2/lib/jaxrpc-api.jar:/usr/local/glassfish-v2ur2/lib/jaxrpc-impl.jar:/usr/local/glassfish-v2ur2/lib/endorsed/jaxp-api.jar:/usr/local/glassfish-v2ur2/lib/appserv-ws.jar:/usr/local/glassfish-v2ur2/lib/webservices-tools.jar:/usr/local/glassfish-v2ur2/lib/webservices-rt.jar j2ee.platform.wsgen.classpath=/usr/local/glassfish-v2ur2/lib/webservices-tools.jar:/usr/local/glassfish-v2ur2/lib/webservices-rt.jar:/usr/local/glassfish-v2ur2/lib/tools.jar:/usr/local/glassfish-v2ur2/lib/appserv-jstl.jar:/usr/local/glassfish-v2ur2/lib/javaee.jar:/usr/local/glassfish-v2ur2/lib/appserv-ws.jar:/usr/local/glassfish-v2ur2/lib/mail.jar:/usr/local/glassfish-v2ur2/lib/activation.jar j2ee.platform.wsimport.classpath=/usr/local/glassfish-v2ur2/lib/webservices-tools.jar:/usr/local/glassfish-v2ur2/lib/webservices-rt.jar:/usr/local/glassfish-v2ur2/lib/tools.jar:/usr/local/glassfish-v2ur2/lib/appserv-jstl.jar:/usr/local/glassfish-v2ur2/lib/javaee.jar:/usr/local/glassfish-v2ur2/lib/appserv-ws.jar:/usr/local/glassfish-v2ur2/lib/mail.jar:/usr/local/glassfish-v2ur2/lib/activation.jar j2ee.platform.wsit.classpath= -j2ee.server.instance=[/usr/local/glassfish-v2ur2]deployer:Sun:AppServer::hw.frantovo.cz:4949 +j2ee.server.instance=[/usr/local/glassfish-v2ur2]deployer:Sun:AppServer::frantovo.cz:4949 +javac.debug=true +javadoc.preview=true jaxws.endorsed.dir=/usr/local/netbeans-6.5/java2/modules/ext/jaxws21/api:/usr/local/netbeans-6.5/ide10/modules/ext/jaxb/api user.properties.file=/home/fiki/.netbeans/6.5/build.properties diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/nbproject/private/private.xml --- a/java/HrisniciSpameri/nbproject/private/private.xml Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/nbproject/private/private.xml Wed Feb 11 19:36:28 2009 +0100 @@ -1,6 +1,2 @@ - - - file:/home/fiki/src/HrisniciSpameri/web/index.jsp - - + diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/nbproject/project.properties --- a/java/HrisniciSpameri/nbproject/project.properties Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/nbproject/project.properties Wed Feb 11 19:36:28 2009 +0100 @@ -49,7 +49,6 @@ javadoc.windowtitle= jspcompilation.classpath=${jspc.classpath}:${javac.classpath} lib.dir=${web.docbase.dir}/WEB-INF/lib -no.dependencies=false persistence.xml.dir=${conf.dir} platform.active=default_platform resource.dir=setup diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/nbproject/project.xml --- a/java/HrisniciSpameri/nbproject/project.xml Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/nbproject/project.xml Wed Feb 11 19:36:28 2009 +0100 @@ -8,10 +8,10 @@ - + - + diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/DenniSouhrn.java --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/DenniSouhrn.java Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/DenniSouhrn.java Wed Feb 11 19:36:28 2009 +0100 @@ -1,12 +1,85 @@ package cz.frantovo.hrisniciSpameri; +import cz.frantovo.hrisniciSpameri.dto.Cil; +import cz.frantovo.hrisniciSpameri.dto.Souhrn; import java.io.Serializable; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.sql.Date; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.logging.Level; +import java.util.logging.Logger; /** - * Beana zprostředkovávající denní souhrn hříšníků + * Beana zprostředkovávající denní souhrn hříšníků. * @author fiki */ public class DenniSouhrn implements Serializable { private static final long serialVersionUID = 7932392366943861342L; + private static final Logger log = Logger.getLogger(DenniSouhrn.class.getName()); + private static final long DEN = 1000 * 60 * 60 * 24; + private static String formatDataVzor = "yyyy-mm-dd"; + public static DateFormat formatData = new SimpleDateFormat(formatDataVzor); + private Date den; + + public Date getDen() { + return den; + } + + public void setDen(Date den) { + if (den == null) { + nastavVychoziDen(); + } else { + this.den = den; + } + log.log(Level.INFO, "Den nastaven na: " + formatData.format(den)); + } + + public void setDen(String den) { + if (den == null || den.length() != formatDataVzor.length()) { + nastavVychoziDen(); + } + + try { + this.den = new Date(formatData.parse(den).getTime()); + } catch (ParseException e) { + log.log(Level.INFO, "Chybně zadané datum: " + den, e); + nastavVychoziDen(); + } + } + + /** + * Ve výchozím stavu zobrazujeme souhrn za předešlý den. + * @return včerejšek + */ + private static Date getVychoziDen() { + return new Date(System.currentTimeMillis() - DEN); + } + + private void nastavVychoziDen() { + log.log(Level.INFO, "Nastavuji den na výchozí hodnotu."); + setDen(getVychoziDen()); + } + + public Collection getSouhrn() { + Collection souhrn = new ArrayList(); + + Cil cil = new Cil(1, "Frantovo.cz", "http://frantovo.cz/blog/", null, null); + + for (int i = 1; i < 11; i++) { + try { + Souhrn s = new Souhrn(getVychoziDen(), InetAddress.getByName("127.0.0.1"), 100 + i, cil); + souhrn.add(s); + } catch (UnknownHostException e) { + log.log(Level.SEVERE, null, e); + } + } + + return souhrn; + } } diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Cil.java --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Cil.java Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Cil.java Wed Feb 11 19:36:28 2009 +0100 @@ -54,4 +54,15 @@ public void setDatabaze(String databaze) { this.databaze = databaze; } + + public Cil(int id, String nazev, String url, String selekt, String databaze) { + this.id = id; + this.nazev = nazev; + this.url = url; + this.selekt = selekt; + this.databaze = databaze; + } + + public Cil() { + } } diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Souhrn.java --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Souhrn.java Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dto/Souhrn.java Wed Feb 11 19:36:28 2009 +0100 @@ -47,4 +47,14 @@ public void setAdresa(InetAddress adresa) { this.adresa = adresa; } + + public Souhrn(Date den, InetAddress adresa, int pocet, Cil cil) { + this.den = den; + this.adresa = adresa; + this.pocet = pocet; + this.cil = cil; + } + + public Souhrn() { + } } diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/web/WEB-INF/sun-web.xml --- a/java/HrisniciSpameri/web/WEB-INF/sun-web.xml Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/web/WEB-INF/sun-web.xml Wed Feb 11 19:36:28 2009 +0100 @@ -1,11 +1,11 @@ - /HrisniciSpameri - - - - Keep a copy of the generated servlet class' java code. - - + /HrisniciSpameri + + + + Keep a copy of the generated servlet class' java code. + + diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/web/WEB-INF/web.xml --- a/java/HrisniciSpameri/web/WEB-INF/web.xml Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/web/WEB-INF/web.xml Wed Feb 11 19:36:28 2009 +0100 @@ -6,6 +6,7 @@ + index.jspx index.jsp diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/web/index.jsp --- a/java/HrisniciSpameri/web/index.jsp Wed Feb 11 17:52:08 2009 +0100 +++ b/java/HrisniciSpameri/web/index.jsp Wed Feb 11 19:36:28 2009 +0100 @@ -1,19 +1,28 @@ -<%-- - Document : index - Created on : 11.2.2009, 16:54:21 - Author : fiki ---%> - <%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +"http://www.w3.org/TR/html4/loose.dtd"> - JSP Page + + Hříšníci spameři -

Hello World!

+

Hříšníci spameři

+ + + + + + + + + + + + + diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/web/souhrn.jspx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/HrisniciSpameri/web/souhrn.jspx Wed Feb 11 19:36:28 2009 +0100 @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IP adresaDoménaPočet pokusůCíl útoku
+ +
diff -r 08480e8e1199 -r e3e2a3a4c36a java/HrisniciSpameri/web/styl.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/HrisniciSpameri/web/styl.css Wed Feb 11 19:36:28 2009 +0100 @@ -0,0 +1,13 @@ +table { + border: 1px solid black; + border-collapse:collapse; +} +td { + border: 1px solid black; + padding: 3px; +} +thead { + background: silver; + font-weight:bold; + +} \ No newline at end of file