initial commit
This commit is contained in:
30
nb-configuration.xml
Normal file
30
nb-configuration.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-shared-configuration>
|
||||||
|
<!--
|
||||||
|
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||||
|
The configuration is intended to be shared among all the users of project and
|
||||||
|
therefore it is assumed to be part of version control checkout.
|
||||||
|
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||||
|
-->
|
||||||
|
<libraries xmlns="http://www.netbeans.org/ns/cdnjs-libraries/1"/>
|
||||||
|
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||||
|
<!--
|
||||||
|
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||||
|
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||||
|
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||||
|
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||||
|
-->
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.5</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>WildFly</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
|
||||||
|
<org-netbeans-modules-javascript2-requirejs.enabled>true</org-netbeans-modules-javascript2-requirejs.enabled>
|
||||||
|
<netbeans.hint.license>apache20</netbeans.hint.license>
|
||||||
|
<org-netbeans-modules-css-prep.less_2e_mappings>/less:/css</org-netbeans-modules-css-prep.less_2e_mappings>
|
||||||
|
<org-netbeans-modules-css-prep.less_2e_enabled>false</org-netbeans-modules-css-prep.less_2e_enabled>
|
||||||
|
<org-netbeans-modules-css-prep.sass_2e_enabled>false</org-netbeans-modules-css-prep.sass_2e_enabled>
|
||||||
|
<org-netbeans-modules-css-prep.sass_2e_compiler_2e_options/>
|
||||||
|
<org-netbeans-modules-css-prep.less_2e_compiler_2e_options/>
|
||||||
|
<org-netbeans-modules-css-prep.sass_2e_mappings>/scss:/css</org-netbeans-modules-css-prep.sass_2e_mappings>
|
||||||
|
<org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>js/libs</org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder>
|
||||||
|
<org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>false</org-netbeans-modules-maven-j2ee.netbeans_2e_deploy_2e_on_2e_save>
|
||||||
|
</properties>
|
||||||
|
</project-shared-configuration>
|
||||||
8
nb_jr_remoting.cfg
Normal file
8
nb_jr_remoting.cfg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||||
|
<properties>
|
||||||
|
<entry key="remoting.autosync">false</entry>
|
||||||
|
<entry key="remoting.syncbuffertime">200</entry>
|
||||||
|
<entry key="remoting.notifications">true</entry>
|
||||||
|
<entry key="com.zeroturnaround.jrebel.remoting.ModuleSpecificSingleRemoteServer">{"syncEnabled":"false","serverAuthenticationPassword":"","httpBasicAuthenticationUser":"","httpBasicAuthenticationPassword":"","useServerAuthentication":"false","deleteFilesOnServer":"true","useHttpBasicAuthentication":"false","url":"http:\/\/127.0.0.1"}</entry>
|
||||||
|
</properties>
|
||||||
61
nbactions.xml
Normal file
61
nbactions.xml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<actions>
|
||||||
|
<action>
|
||||||
|
<actionName>run</actionName>
|
||||||
|
<packagings>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<packaging>ear</packaging>
|
||||||
|
<packaging>ejb</packaging>
|
||||||
|
</packagings>
|
||||||
|
<goals>
|
||||||
|
<goal>package</goal>
|
||||||
|
</goals>
|
||||||
|
<properties>
|
||||||
|
<netbeans.deploy>true</netbeans.deploy>
|
||||||
|
<netbeans.deploy.clientUrlPart>main.action</netbeans.deploy.clientUrlPart>
|
||||||
|
</properties>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<actionName>debug</actionName>
|
||||||
|
<packagings>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<packaging>ear</packaging>
|
||||||
|
<packaging>ejb</packaging>
|
||||||
|
</packagings>
|
||||||
|
<goals>
|
||||||
|
<goal>package</goal>
|
||||||
|
</goals>
|
||||||
|
<properties>
|
||||||
|
<netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
|
||||||
|
<netbeans.deploy>true</netbeans.deploy>
|
||||||
|
<netbeans.deploy.clientUrlPart>main.action</netbeans.deploy.clientUrlPart>
|
||||||
|
</properties>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<actionName>profile</actionName>
|
||||||
|
<packagings>
|
||||||
|
<packaging>ejb</packaging>
|
||||||
|
<packaging>ear</packaging>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
</packagings>
|
||||||
|
<goals>
|
||||||
|
<goal>package</goal>
|
||||||
|
</goals>
|
||||||
|
<properties>
|
||||||
|
<netbeans.deploy>true</netbeans.deploy>
|
||||||
|
<netbeans.deploy.profilemode>true</netbeans.deploy.profilemode>
|
||||||
|
<netbeans.deploy.clientUrlPart>main.action</netbeans.deploy.clientUrlPart>
|
||||||
|
</properties>
|
||||||
|
</action>
|
||||||
|
<action>
|
||||||
|
<actionName>rebuild</actionName>
|
||||||
|
<packagings>
|
||||||
|
<packaging>*</packaging>
|
||||||
|
</packagings>
|
||||||
|
<goals>
|
||||||
|
<goal>clean</goal>
|
||||||
|
<goal>install</goal>
|
||||||
|
|
||||||
|
</goals>
|
||||||
|
</action>
|
||||||
|
</actions>
|
||||||
112
pom.xml
Normal file
112
pom.xml
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>it.jee_book</groupId>
|
||||||
|
<artifactId>JakiWiki</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<name>JakiWiki</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository> <!-- for javaee:javaee-api -->
|
||||||
|
<id>java.net2</id>
|
||||||
|
<url>http://download.java.net/maven/2/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet.jsp</groupId>
|
||||||
|
<artifactId>jsp-api</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
|
<artifactId>eclipselink</artifactId>
|
||||||
|
<version>2.5.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-entitymanager</artifactId>
|
||||||
|
<version>4.3.1.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.javax.persistence</groupId>
|
||||||
|
<artifactId>hibernate-jpa-2.1-api</artifactId>
|
||||||
|
<version>1.0.0.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- http://mvnrepository.com/artifact/mysql/mysql-connector-java -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>6.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
|
<artifactId>selenium-java</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<version>2.44.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.opera</groupId>
|
||||||
|
<artifactId>operadriver</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<version>1.5</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
|
<artifactId>selenium-remote-driver</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<version>4.11</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javaee</groupId>
|
||||||
|
<artifactId>javaee-api</artifactId>
|
||||||
|
<version>5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>it.jee_book</groupId>
|
||||||
|
<artifactId>JakiWiki</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<type>war</type>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.5</source>
|
||||||
|
<target>1.5</target>
|
||||||
|
<showDeprecation>true</showDeprecation>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.actions;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.business.pagine.PaginaManager;
|
||||||
|
import it.jee_book.jakiwiki.business.pagine.PaginaManagerDelegate;
|
||||||
|
import it.jee_book.jakiwiki.context.ContextObjectFactory;
|
||||||
|
import it.jee_book.jakiwiki.context.RequestObject;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseAndView;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseObject;
|
||||||
|
import it.jee_book.jakiwiki.controller.action.Action;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
class ListaPagineAction implements Action {
|
||||||
|
|
||||||
|
private PaginaManager paginaManager = new PaginaManagerDelegate();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseAndView createResponseAndView(RequestObject requestObject) {
|
||||||
|
ResponseObject response = ContextObjectFactory.getResponseObject();
|
||||||
|
String tipoRichiesta = (String) requestObject.getValue("tipo_richiesta");
|
||||||
|
|
||||||
|
if ("tutte".equals(tipoRichiesta)) {
|
||||||
|
response.setValue("intestazione", "Tutte le pagine");
|
||||||
|
response.setValue("lista", paginaManager.elencaPagine());
|
||||||
|
} else {
|
||||||
|
response.setValue("intestazione", "Ultime pagine modificate");
|
||||||
|
response.setValue("lista", paginaManager.elencaPagineRecenti());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ResponseAndView(response, "list");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.actions;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.business.pagine.PaginaManager;
|
||||||
|
import it.jee_book.jakiwiki.business.pagine.PaginaManagerDelegate;
|
||||||
|
import it.jee_book.jakiwiki.context.ContextObjectFactory;
|
||||||
|
import it.jee_book.jakiwiki.context.RequestObject;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseAndView;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseObject;
|
||||||
|
import it.jee_book.jakiwiki.controller.action.Action;
|
||||||
|
import it.jee_book.jakiwiki.exception.JakiWikiException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class ModificaPaginaAction implements Action {
|
||||||
|
|
||||||
|
private PaginaManager paginaManager = new PaginaManagerDelegate();
|
||||||
|
|
||||||
|
public ResponseAndView createResponseAndView(RequestObject requestObject) throws JakiWikiException {
|
||||||
|
ResponseObject response = ContextObjectFactory.getResponseObject();
|
||||||
|
String titolo = (String) requestObject.getValue("titolo");
|
||||||
|
|
||||||
|
response.setValue("titolo", titolo);
|
||||||
|
response.setValue("contenuto", paginaManager.leggi(titolo));
|
||||||
|
|
||||||
|
return new ResponseAndView(response, "edit");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.actions;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.context.RequestObject;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseAndView;
|
||||||
|
import it.jee_book.jakiwiki.controller.action.Action;
|
||||||
|
import it.jee_book.jakiwiki.exception.JakiWikiException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class PulsantieraAction implements Action {
|
||||||
|
|
||||||
|
private final String PRINCIPALE = "principale";
|
||||||
|
private final String RECENTI = "recenti";
|
||||||
|
private final String TUTTE = "tutte";
|
||||||
|
private final String EMAIL = "email";
|
||||||
|
private final String CONFIGURA = "configura";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseAndView createResponseAndView(RequestObject requestObject) throws JakiWikiException {
|
||||||
|
|
||||||
|
if (requestObject.getValue(PRINCIPALE) != null) {
|
||||||
|
requestObject.setValue("titolo", null);
|
||||||
|
return new VediPaginaAction().createResponseAndView(requestObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestObject.getValue(TUTTE) != null) {
|
||||||
|
requestObject.setValue("tipo_richiesta", "tutte");
|
||||||
|
return new ListaPagineAction().createResponseAndView(requestObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestObject.getValue(RECENTI) != null) {
|
||||||
|
requestObject.setValue("tipo_richiesta", "recenti");
|
||||||
|
return new ListaPagineAction().createResponseAndView(requestObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestObject.getValue(EMAIL) != null) {
|
||||||
|
return new ResponseAndView(null, "email");
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new JakiWikiException("Action non valida");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.actions;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.business.pagine.PaginaManager;
|
||||||
|
import it.jee_book.jakiwiki.business.pagine.PaginaManagerDelegate;
|
||||||
|
import it.jee_book.jakiwiki.context.RequestObject;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseAndView;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseObject;
|
||||||
|
import it.jee_book.jakiwiki.controller.action.Action;
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import it.jee_book.jakiwiki.utils.TextConverter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class VediPaginaAction implements Action {
|
||||||
|
|
||||||
|
private PaginaManager paginaManager = new PaginaManagerDelegate();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseAndView createResponseAndView(RequestObject requestObject) {
|
||||||
|
ResponseObject response = new ResponseObject();
|
||||||
|
String titolo = (String) requestObject.getValue("titolo");
|
||||||
|
|
||||||
|
if (titolo == null) {
|
||||||
|
titolo = "PaginaPrincipale";
|
||||||
|
}
|
||||||
|
|
||||||
|
Pagina pagina = paginaManager.leggi(titolo);
|
||||||
|
response.setValue("titolo", titolo);
|
||||||
|
response.setValue("contenuto", TextConverter.convert(pagina.getContenuto()));
|
||||||
|
|
||||||
|
return new ResponseAndView(response, "main");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.business;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.exception.JakiWikiException;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public abstract class AbstractDelegate {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In ogni delegato è necessario implementare questo metodo in modo che
|
||||||
|
* ritorni il nome jndi del servizio.
|
||||||
|
*
|
||||||
|
* @return il nome del servizio
|
||||||
|
*/
|
||||||
|
protected abstract String getServiceName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accede al servizio
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected Object getService() throws JakiWikiException {
|
||||||
|
InitialContext context;
|
||||||
|
|
||||||
|
try {
|
||||||
|
context = new InitialContext();
|
||||||
|
Object lookup = context.lookup(getServiceName());
|
||||||
|
return lookup;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new JakiWikiException(JakiWikiException.SERVICE_CONNECTION_ERROR, "Non esiste il servizio denominato "
|
||||||
|
+ getServiceName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.business.email;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Local
|
||||||
|
public interface EmailManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param mittente
|
||||||
|
* @param destinatario
|
||||||
|
* @param commento
|
||||||
|
* @param titolo
|
||||||
|
*/
|
||||||
|
public void sendEmail(String mittente, String destinatario, String commento, String titolo);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.business.email;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.business.AbstractDelegate;
|
||||||
|
import it.jee_book.jakiwiki.exception.JakiWikiException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class EmailManagerDelegate extends AbstractDelegate implements EmailManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getServiceName() {
|
||||||
|
return "java:global/JakiWiki/EmailManager";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendEmail(String mittente, String destinatario, String commento, String titolo) {
|
||||||
|
try {
|
||||||
|
((EmailManager) getService()).sendEmail(mittente, destinatario, commento, titolo);
|
||||||
|
} catch (JakiWikiException ex) {
|
||||||
|
Logger.getLogger(EmailManagerDelegate.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.business.email;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.integration.dao.PaginaDao;
|
||||||
|
import it.jee_book.jakiwiki.integration.mail.EmailIntegrator;
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.ejb.Stateless;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Stateless
|
||||||
|
public class EmailManagerImplementation implements EmailManager {
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private EmailIntegrator emailIntegrator;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private PaginaDao dao;
|
||||||
|
|
||||||
|
public void sendEmail(String mittente, String destinatario, String commento, String titolo) {
|
||||||
|
Pagina pagina = dao.leggi(titolo);
|
||||||
|
emailIntegrator.sendEmail(mittente, destinatario, commento, pagina);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.business.pagine;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.ejb.Local;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Local
|
||||||
|
public interface PaginaManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pagina
|
||||||
|
*/
|
||||||
|
public void save(Pagina pagina);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param titolo
|
||||||
|
*/
|
||||||
|
public void elimina(String titolo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param titolo
|
||||||
|
* @return la pagina con che si chiama titolo
|
||||||
|
*/
|
||||||
|
public Pagina leggi(String titolo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return l'elenco di tutte le pagine
|
||||||
|
*/
|
||||||
|
public List elencaPagine();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return l'elenco di tutte le recenti pagine
|
||||||
|
*/
|
||||||
|
public List elencaPagineRecenti();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.business.pagine;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.business.AbstractDelegate;
|
||||||
|
import it.jee_book.jakiwiki.exception.JakiWikiException;
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class PaginaManagerDelegate extends AbstractDelegate implements PaginaManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getServiceName() {
|
||||||
|
return "java:global/JakiWiki/PaginaManagerImplementation";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(Pagina pagina) {
|
||||||
|
try {
|
||||||
|
((PaginaManager) getService()).save(pagina);
|
||||||
|
} catch (JakiWikiException ex) {
|
||||||
|
Logger.getLogger(PaginaManagerDelegate.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void elimina(String titolo) {
|
||||||
|
try {
|
||||||
|
((PaginaManager) getService()).elimina(titolo);
|
||||||
|
} catch (JakiWikiException ex) {
|
||||||
|
Logger.getLogger(PaginaManagerDelegate.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pagina leggi(String titolo) {
|
||||||
|
try {
|
||||||
|
return ((PaginaManager) getService()).leggi(titolo);
|
||||||
|
} catch (JakiWikiException ex) {
|
||||||
|
Logger.getLogger(PaginaManagerDelegate.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List elencaPagine() {
|
||||||
|
try {
|
||||||
|
((PaginaManager) getService()).elencaPagine();
|
||||||
|
} catch (JakiWikiException ex) {
|
||||||
|
Logger.getLogger(PaginaManagerDelegate.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List elencaPagineRecenti() {
|
||||||
|
try {
|
||||||
|
return ((PaginaManager) getService()).elencaPagineRecenti();
|
||||||
|
} catch (JakiWikiException ex) {
|
||||||
|
Logger.getLogger(PaginaManagerDelegate.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.business.pagine;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.integration.dao.PaginaDao;
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.ejb.Stateless;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Stateless
|
||||||
|
public class PaginaManagerImplementation implements PaginaManager {
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private PaginaDao dao;
|
||||||
|
|
||||||
|
public void save(Pagina pagina) {
|
||||||
|
dao.salva(pagina);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void elimina(String titolo) {
|
||||||
|
Pagina pagina = leggi(titolo);
|
||||||
|
dao.elimina(pagina);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pagina leggi(String titolo) {
|
||||||
|
Pagina p = dao.leggi(titolo);
|
||||||
|
|
||||||
|
if (p == null) {
|
||||||
|
p = new Pagina();
|
||||||
|
p.setTitolo("");
|
||||||
|
p.setUltimaModifica(new Date());
|
||||||
|
p.setContenuto("Questa è una nuova pagina");
|
||||||
|
}
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List elencaPagine() {
|
||||||
|
return dao.elencaPagine(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List elencaPagineRecenti() {
|
||||||
|
return dao.elencaPagine(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.context;
|
||||||
|
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class ContextObjectFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static RequestObject getRequestObject(HttpServletRequest request) {
|
||||||
|
|
||||||
|
RequestObject ret = new RequestObject();
|
||||||
|
String path = request.getServletPath().split(".action")[0];
|
||||||
|
|
||||||
|
if (path.startsWith("/")) {
|
||||||
|
path.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.setRequestCommand(path);
|
||||||
|
|
||||||
|
// mappa i parametri della request
|
||||||
|
Map pMap = request.getParameterMap();
|
||||||
|
for (Iterator listaParams = pMap.keySet().iterator(); listaParams.hasNext();) {
|
||||||
|
String key = (String) listaParams.next();
|
||||||
|
ret.request.put(key, pMap.get(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
// mappa i parametri della sessione
|
||||||
|
for (Enumeration listaSession = request.getSession().getAttributeNames(); listaSession.hasMoreElements();) {
|
||||||
|
String key = (String) listaSession.nextElement();
|
||||||
|
ret.session.put(key, request.getSession().getAttribute(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResponseObject getResponseObject() {
|
||||||
|
return new ResponseObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.context;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class RequestObject {
|
||||||
|
|
||||||
|
protected Map request = new HashMap();
|
||||||
|
protected Map session = new HashMap();
|
||||||
|
|
||||||
|
protected String requestCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imposta una chiave-valore nella richiesta corrente
|
||||||
|
*/
|
||||||
|
public void setValue(String key, Object value) {
|
||||||
|
request.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imposta chiave-valore nella sessione corrente
|
||||||
|
*/
|
||||||
|
public void setValueInSession(String key, Object value) {
|
||||||
|
session.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ritorna il valore associato ad una chiave, cercandolo prima nell
|
||||||
|
* richiesta corrente e poi nella sessione.
|
||||||
|
*/
|
||||||
|
public Object getValue(String key) {
|
||||||
|
Object value = request.get(key);
|
||||||
|
|
||||||
|
if (value == null) {
|
||||||
|
return value = session.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value instanceof Object[]) {
|
||||||
|
value = ((Object[]) value)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ritorna tutte le chiavi a cui sono associati dei valore nella richiesta
|
||||||
|
* corrente.
|
||||||
|
*/
|
||||||
|
public Set getRequestKeys() {
|
||||||
|
return request.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ritorna tutte le chiavi a cui sono associati dei valori nella sessione
|
||||||
|
* corrente.
|
||||||
|
*/
|
||||||
|
public Set getSessionKeys() {
|
||||||
|
return session.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRequestCommand() {
|
||||||
|
return requestCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequestCommand(String requestCommand) {
|
||||||
|
this.requestCommand = requestCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class ResponseAndView {
|
||||||
|
|
||||||
|
protected String view;
|
||||||
|
protected ResponseObject responseObject;
|
||||||
|
|
||||||
|
public ResponseAndView(ResponseObject responseObject, String viewName) {
|
||||||
|
this.view = viewName;
|
||||||
|
this.responseObject = responseObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getView() {
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setView(String view) {
|
||||||
|
this.view = view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseObject getResponseObject() {
|
||||||
|
return responseObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponseObject(ResponseObject responseObject) {
|
||||||
|
this.responseObject = responseObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.context;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class ResponseObject {
|
||||||
|
|
||||||
|
protected Map response = new HashMap();
|
||||||
|
protected Map session = new HashMap();
|
||||||
|
|
||||||
|
protected String responseCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imposta una chiave-valore nella richiesta corrente
|
||||||
|
*/
|
||||||
|
public void setValue(String key, Object value) {
|
||||||
|
response.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imposta chiave-valore nella sessione corrente
|
||||||
|
*/
|
||||||
|
public void setValueInSession(String key, Object value) {
|
||||||
|
session.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ritorna il valore associato ad una chiave, cercandolo prima nell
|
||||||
|
* richiesta corrente e poi nella sessione.
|
||||||
|
*/
|
||||||
|
public Object getValue(String key) {
|
||||||
|
Object value = response.get(key);
|
||||||
|
|
||||||
|
if (value == null) {
|
||||||
|
return value = session.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value instanceof Object[]) {
|
||||||
|
value = ((Object[]) value)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ritorna tutte le chiavi a cui sono associati dei valore nella richiesta
|
||||||
|
* corrente.
|
||||||
|
*/
|
||||||
|
public Set getResponseKeys() {
|
||||||
|
return response.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ritorna tutte le chiavi a cui sono associati dei valori nella sessione
|
||||||
|
* corrente.
|
||||||
|
*/
|
||||||
|
public Set getSessionKeys() {
|
||||||
|
return session.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResponseCommand() {
|
||||||
|
return responseCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponseCommand(String responseCommand) {
|
||||||
|
this.responseCommand = responseCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.context;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class ViewDispatcher {
|
||||||
|
|
||||||
|
protected RequestDispatcher dispatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param requestDispatcher
|
||||||
|
*/
|
||||||
|
public ViewDispatcher(RequestDispatcher requestDispatcher) {
|
||||||
|
dispatcher = requestDispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @param responseAndView
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void forward(HttpServletRequest request, HttpServletResponse response, ResponseAndView responseAndView)
|
||||||
|
throws ServletException, IOException {
|
||||||
|
mergeDataRequest(request, responseAndView.getResponseObject());
|
||||||
|
dispatcher.forward(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mergeDataRequest(HttpServletRequest request, ResponseObject responseObject) {
|
||||||
|
|
||||||
|
if (responseObject == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Iterator listaParams = responseObject.getResponseKeys().iterator(); listaParams.hasNext();) {
|
||||||
|
String key = (String) listaParams.next();
|
||||||
|
request.setAttribute(key, responseObject.getValue(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Iterator listaParams = responseObject.getSessionKeys().iterator(); listaParams.hasNext();) {
|
||||||
|
String key = (String) listaParams.next();
|
||||||
|
request.getSession().setAttribute(key, responseObject.getValue(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.controller;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.context.RequestObject;
|
||||||
|
import it.jee_book.jakiwiki.controller.action.Action;
|
||||||
|
import it.jee_book.jakiwiki.exception.JakiWikiException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class ActionFactory {
|
||||||
|
|
||||||
|
protected static Map actions = new HashMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param requestObject
|
||||||
|
* @return
|
||||||
|
* @throws JakiWikiException
|
||||||
|
*/
|
||||||
|
public static Action createAction(RequestObject requestObject) throws JakiWikiException {
|
||||||
|
|
||||||
|
String requestCommand = requestObject.getRequestCommand().substring(1);
|
||||||
|
Action action = (Action) actions.get(requestCommand);
|
||||||
|
|
||||||
|
if (action == null) {
|
||||||
|
String actionClassName = Configuration.getAction(requestCommand);
|
||||||
|
|
||||||
|
if (actionClassName == null) {
|
||||||
|
throw new JakiWikiException(JakiWikiException.ACTION_ERROR, "Non esiste nessuna action");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
action = (Action) Class.forName(actionClassName).newInstance();
|
||||||
|
actions.put(requestCommand, action);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
throw new JakiWikiException(JakiWikiException.ACTION_ERROR, actionClassName, t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.controller;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
import javax.servlet.ServletConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class Configuration {
|
||||||
|
|
||||||
|
protected static Properties views;
|
||||||
|
protected static Properties actions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
|
public static void init(ServletConfig config) {
|
||||||
|
String actionFile = config.getServletContext().getRealPath("WEB-INF/actions.properties");
|
||||||
|
String viewsFile = config.getServletContext().getRealPath("WEB-INF/views.properties");
|
||||||
|
views = new Properties();
|
||||||
|
actions = new Properties();
|
||||||
|
try {
|
||||||
|
views.load(new FileInputStream(viewsFile));
|
||||||
|
actions.load(new FileInputStream(actionFile));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param view
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getViewPage(String view) {
|
||||||
|
return views.getProperty(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param action
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getAction(String action) {
|
||||||
|
return actions.getProperty(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.controller.action;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.context.RequestObject;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseAndView;
|
||||||
|
import it.jee_book.jakiwiki.exception.JakiWikiException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public interface Action {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param requestObject
|
||||||
|
* @return
|
||||||
|
* @throws it.jee_book.jakiwiki.exception.JakiWikiException
|
||||||
|
*/
|
||||||
|
ResponseAndView createResponseAndView(RequestObject requestObject) throws JakiWikiException;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class JakiWikiException extends Throwable {
|
||||||
|
|
||||||
|
public static final String ACTION_ERROR = "Azione errata";
|
||||||
|
public static String SERVICE_CONNECTION_ERROR = "Errore di connessione al servizio";
|
||||||
|
|
||||||
|
private String error;
|
||||||
|
private String msg;
|
||||||
|
private Throwable exception;
|
||||||
|
|
||||||
|
public JakiWikiException(String error, String msg) {
|
||||||
|
this(error, msg, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public JakiWikiException(String error, String msg, Throwable exception) {
|
||||||
|
this.error = error;
|
||||||
|
this.msg = msg;
|
||||||
|
this.exception = exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JakiWikiException(String string) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError(String error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Throwable getException() {
|
||||||
|
return exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setException(Throwable exception) {
|
||||||
|
this.exception = exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.integration.dao;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.ejb.Local;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Local
|
||||||
|
public interface PaginaDao {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pagina
|
||||||
|
*/
|
||||||
|
public void salva(Pagina pagina);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pagina
|
||||||
|
*/
|
||||||
|
public void elimina(Pagina pagina);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param titolo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Pagina leggi(String titolo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param maxRisultati
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List elencaPagine(int maxRisultati);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.integration.dao;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.ejb.Stateless;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.PersistenceContext;
|
||||||
|
import javax.persistence.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Stateless
|
||||||
|
public class PaginaDaoImplementation implements PaginaDao {
|
||||||
|
|
||||||
|
@PersistenceContext
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
public void salva(Pagina pagina) {
|
||||||
|
entityManager.merge(pagina);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void elimina(Pagina pagina) {
|
||||||
|
entityManager.remove(pagina);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pagina leggi(String titolo) {
|
||||||
|
return entityManager.find(Pagina.class, titolo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List elencaPagine(int maxRisultati) {
|
||||||
|
Query query = entityManager.createQuery("SELECT p FROM Pagina p");
|
||||||
|
|
||||||
|
if (maxRisultati > 0) {
|
||||||
|
query.setMaxResults(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
return query.getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.integration.mail;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import javax.ejb.Local;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Local
|
||||||
|
public interface EmailIntegrator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param mittente
|
||||||
|
* @param destinatario
|
||||||
|
* @param commento
|
||||||
|
* @param pagina
|
||||||
|
*/
|
||||||
|
public void sendEmail(String mittente, String destinatario, String commento, Pagina pagina);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.integration.mail;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import java.util.Properties;
|
||||||
|
import javax.ejb.Stateless;
|
||||||
|
import javax.mail.Authenticator;
|
||||||
|
import javax.mail.Message;
|
||||||
|
import javax.mail.PasswordAuthentication;
|
||||||
|
import javax.mail.Session;
|
||||||
|
import javax.mail.Transport;
|
||||||
|
import javax.mail.internet.InternetAddress;
|
||||||
|
import javax.mail.internet.MimeMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Stateless
|
||||||
|
public class EmailIntegratorImplementation implements EmailIntegrator {
|
||||||
|
|
||||||
|
public void sendEmail(String mittente, String destinatario, String commento, Pagina pagina) {
|
||||||
|
Properties prop = new Properties();
|
||||||
|
|
||||||
|
Authenticator auth = new PasswordAuthenticator();
|
||||||
|
Session session = Session.getDefaultInstance(prop, auth);
|
||||||
|
|
||||||
|
MimeMessage message = new MimeMessage(session);
|
||||||
|
try {
|
||||||
|
message.setFrom(new InternetAddress(mittente));
|
||||||
|
message.addRecipient(Message.RecipientType.TO, new InternetAddress(destinatario));
|
||||||
|
message.setSubject(pagina.getTitolo());
|
||||||
|
message.setText(pagina.getContenuto());
|
||||||
|
Transport.send(message);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PasswordAuthenticator extends Authenticator {
|
||||||
|
|
||||||
|
protected PasswordAuthentication getPasswordAuthentication() {
|
||||||
|
return new PasswordAuthentication("utente", "password");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
73
src/main/java/it/jee_book/jakiwiki/model/Pagina.java
Normal file
73
src/main/java/it/jee_book/jakiwiki/model/Pagina.java
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.model;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "PAGINE")
|
||||||
|
public class Pagina implements Serializable {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "TITOLO", nullable = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private String titolo;
|
||||||
|
|
||||||
|
@Column(name = "CONTENUTO")
|
||||||
|
private String contenuto;
|
||||||
|
|
||||||
|
@Column(name = "ULTIMA_MODIFICA")
|
||||||
|
@Temporal(TemporalType.DATE)
|
||||||
|
private Date ultimaModifica;
|
||||||
|
|
||||||
|
public String getTitolo() {
|
||||||
|
return titolo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitolo(String titolo) {
|
||||||
|
this.titolo = titolo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContenuto() {
|
||||||
|
return contenuto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContenuto(String contenuto) {
|
||||||
|
this.contenuto = contenuto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUltimaModifica() {
|
||||||
|
return ultimaModifica;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUltimaModifica(Date ultimaModifica) {
|
||||||
|
this.ultimaModifica = ultimaModifica;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
126
src/main/java/it/jee_book/jakiwiki/servlet/MainController.java
Normal file
126
src/main/java/it/jee_book/jakiwiki/servlet/MainController.java
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.servlet;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.context.ContextObjectFactory;
|
||||||
|
import it.jee_book.jakiwiki.context.RequestObject;
|
||||||
|
import it.jee_book.jakiwiki.context.ResponseAndView;
|
||||||
|
import it.jee_book.jakiwiki.context.ViewDispatcher;
|
||||||
|
import it.jee_book.jakiwiki.controller.ActionFactory;
|
||||||
|
import it.jee_book.jakiwiki.controller.Configuration;
|
||||||
|
import it.jee_book.jakiwiki.controller.action.Action;
|
||||||
|
import it.jee_book.jakiwiki.exception.JakiWikiException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import javax.servlet.ServletConfig;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class MainController extends HttpServlet {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param config
|
||||||
|
* @throws ServletException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init(ServletConfig config) throws ServletException {
|
||||||
|
Configuration.init(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||||
|
* methods.
|
||||||
|
*
|
||||||
|
* @param request servlet request
|
||||||
|
* @param response servlet response
|
||||||
|
* @throws ServletException if a servlet-specific error occurs
|
||||||
|
* @throws IOException if an I/O error occurs
|
||||||
|
*/
|
||||||
|
protected void handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws ServletException, IOException, JakiWikiException {
|
||||||
|
RequestObject requestObject = ContextObjectFactory.getRequestObject(request);
|
||||||
|
Action action = ActionFactory.createAction(requestObject);
|
||||||
|
ResponseAndView responseObject = action.createResponseAndView(requestObject);
|
||||||
|
dispatchView(request, response, responseObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the HTTP <code>GET</code> method.
|
||||||
|
*
|
||||||
|
* @param request servlet request
|
||||||
|
* @param response servlet response
|
||||||
|
* @throws ServletException if a servlet-specific error occurs
|
||||||
|
* @throws IOException if an I/O error occurs
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws ServletException, IOException {
|
||||||
|
try {
|
||||||
|
handleRequest(request, response);
|
||||||
|
} catch (JakiWikiException ex) {
|
||||||
|
Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the HTTP <code>POST</code> method.
|
||||||
|
*
|
||||||
|
* @param request servlet request
|
||||||
|
* @param response servlet response
|
||||||
|
* @throws ServletException if a servlet-specific error occurs
|
||||||
|
* @throws IOException if an I/O error occurs
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws ServletException, IOException {
|
||||||
|
try {
|
||||||
|
handleRequest(request, response);
|
||||||
|
} catch (JakiWikiException ex) {
|
||||||
|
Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @param responseAndView
|
||||||
|
* @throws JakiWikiException
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private void dispatchView(HttpServletRequest request, HttpServletResponse response, ResponseAndView responseAndView) throws JakiWikiException, ServletException, IOException {
|
||||||
|
String view = responseAndView.getView();
|
||||||
|
|
||||||
|
String resultPage = Configuration.getViewPage(view);
|
||||||
|
|
||||||
|
if (resultPage == null) {
|
||||||
|
throw new JakiWikiException(JakiWikiException.ACTION_ERROR, "Non è configurata alcuna action con il nome: " + view);
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewDispatcher viewDispatcher = new ViewDispatcher(request.getRequestDispatcher(resultPage));
|
||||||
|
viewDispatcher.forward(request, response, responseAndView);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
64
src/main/java/it/jee_book/jakiwiki/tag/ListaPagine.java
Normal file
64
src/main/java/it/jee_book/jakiwiki/tag/ListaPagine.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.tag;
|
||||||
|
|
||||||
|
import it.jee_book.jakiwiki.model.Pagina;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.jsp.JspException;
|
||||||
|
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class ListaPagine extends SimpleTagSupport {
|
||||||
|
|
||||||
|
private List pagine;
|
||||||
|
|
||||||
|
public List getPagine() {
|
||||||
|
return pagine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagine(List pagine) {
|
||||||
|
this.pagine = pagine;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doTag() throws JspException, IOException {
|
||||||
|
if (getPagine() == null || getPagine().size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getJspContext().getOut().write("<table cellpadding = '10'>"
|
||||||
|
+ "<tr><td><b>Titolo</b></td><td><b>Data ultima"
|
||||||
|
+ " modifica</b></td><td></td><td></td></tr>");
|
||||||
|
|
||||||
|
for (int i = 0; i < getPagine().size(); i++) {
|
||||||
|
Pagina pagina = (Pagina) getPagine().get(i);
|
||||||
|
String line = "<tr><td><a href='main.action?titolo="
|
||||||
|
+ pagina.getTitolo() + "'>" + pagina.getTitolo()
|
||||||
|
+ "</a></td>\n";
|
||||||
|
line += "<td>" + pagina.getUltimaModifica() + "</td>\n";
|
||||||
|
line += "<td><a href='edit.action?titolo=" + pagina.getTitolo()
|
||||||
|
+ "'>Modifica</a></td>\n";
|
||||||
|
line += "<td><a href='elimina.action?titolo=" + pagina.getTitolo()
|
||||||
|
+ "'>Elimina</a></td></tr>\n";
|
||||||
|
getJspContext().getOut().write(line);
|
||||||
|
}
|
||||||
|
getJspContext().getOut().write("</table>");
|
||||||
|
}
|
||||||
|
}
|
||||||
73
src/main/java/it/jee_book/jakiwiki/utils/TextConverter.java
Normal file
73
src/main/java/it/jee_book/jakiwiki/utils/TextConverter.java
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Fabio Scotto di Santolo.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package it.jee_book.jakiwiki.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Fabio Scotto di Santolo
|
||||||
|
*/
|
||||||
|
public class TextConverter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converte il testo inserito dall'utente in sintassi wiki
|
||||||
|
*
|
||||||
|
* @param input
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String convert(String input) {
|
||||||
|
|
||||||
|
// sostituisce gli a capo con <br>
|
||||||
|
input = input.replaceAll("\n", " <br /> ");
|
||||||
|
|
||||||
|
// crea la wiki-syntax
|
||||||
|
String[] tokens = input.split(" ");
|
||||||
|
for (int i = 0; i < tokens.length; i++) {
|
||||||
|
if (isWikiWord(tokens[i])) {
|
||||||
|
tokens[i] = creaLink(tokens[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return componiToken(tokens);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isWikiWord(String word) {
|
||||||
|
if (word == null || word.length() < 4) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Character.isUpperCase(word.charAt(0)) && Character.isLowerCase(word.charAt(1))
|
||||||
|
&& !(word.substring(2).toLowerCase().equals(word.substring(2)))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String componiToken(String[] tokens) {
|
||||||
|
String output = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; i++) {
|
||||||
|
output += tokens[i] + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String creaLink(String word) {
|
||||||
|
return "<a href='main.action?titolo=" + word + "'>" + word + "</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
8
src/main/resources/META-INF/persistence.xml
Normal file
8
src/main/resources/META-INF/persistence.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
||||||
|
<persistence-unit name="defaultPersistenceUnit" transaction-type="JTA">
|
||||||
|
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||||
|
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
|
||||||
|
<class>it.jee_book.jakiwiki.model.Pagina</class>
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
||||||
2
src/main/webapp/META-INF/context.xml
Normal file
2
src/main/webapp/META-INF/context.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Context antiJARLocking="true" path="/JakiWiki"/>
|
||||||
9
src/main/webapp/WEB-INF/actions.properties
Normal file
9
src/main/webapp/WEB-INF/actions.properties
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# To change this license header, choose License Headers in Project Properties.
|
||||||
|
# To change this template file, choose Tools | Templates
|
||||||
|
# and open the template in the editor.
|
||||||
|
|
||||||
|
main=it.jee_book.jakiwiki.actions.VediPaginaAction
|
||||||
|
edit=it.jee_book.jakiwiki.actions.ModificaPaginaAction
|
||||||
|
pulsantiera=it.jee_book.jakiwiki.actions.PulsantieraAction
|
||||||
|
salva-pagina=it.jee_book.jakiwiki.actions.SalvaPaginaAction
|
||||||
|
invia-mail=it.jee_book.jakiwiki.actions.InviaMailAction
|
||||||
21
src/main/webapp/WEB-INF/jakiwiki.tld
Normal file
21
src/main/webapp/WEB-INF/jakiwiki.tld
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
|
||||||
|
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
|
||||||
|
|
||||||
|
<taglib>
|
||||||
|
|
||||||
|
<tlib-version>1.0</tlib-version>
|
||||||
|
<jsp-version>2.0</jsp-version>
|
||||||
|
<short-name>JakiWiki taglibs</short-name>
|
||||||
|
|
||||||
|
<tag>
|
||||||
|
<name>lista_pagine</name>
|
||||||
|
<tag-class>it.jee_book.jakiwiki.tag.ListaPagine</tag-class>
|
||||||
|
<attribute>
|
||||||
|
<name>pagine</name>
|
||||||
|
<required>true</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
</tag>
|
||||||
|
|
||||||
|
</taglib>
|
||||||
4
src/main/webapp/WEB-INF/jboss-web.xml
Normal file
4
src/main/webapp/WEB-INF/jboss-web.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<jboss-web version="8.0" xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/schema/jbossas/jboss-web_8_0.xsd">
|
||||||
|
<context-root>/JakiWiki</context-root>
|
||||||
|
</jboss-web>
|
||||||
8
src/main/webapp/WEB-INF/views.properties
Normal file
8
src/main/webapp/WEB-INF/views.properties
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# To change this license header, choose License Headers in Project Properties.
|
||||||
|
# To change this template file, choose Tools | Templates
|
||||||
|
# and open the template in the editor.
|
||||||
|
|
||||||
|
main=WEB-INF/views/main.jsp
|
||||||
|
edit=WEB-INF/views/edit.jsp
|
||||||
|
list=WEB-INF/views/list.jsp
|
||||||
|
email=WEB-INF/views/email.jsp
|
||||||
43
src/main/webapp/WEB-INF/views/edit.jsp
Normal file
43
src/main/webapp/WEB-INF/views/edit.jsp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<%--
|
||||||
|
Document : edit
|
||||||
|
Created on : 25-mag-2016, 21.15.50
|
||||||
|
Author : morgoth
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>JakiWiki: Modifica di ${titolo}</title>
|
||||||
|
</head>
|
||||||
|
<body style="font-family: Verdana; font-size: 16px;">
|
||||||
|
<div id="title" style="font-family: Verdana; font-size: 32px; font-variant: small-caps;" >
|
||||||
|
JakiWiki: modifica '${titolo}'
|
||||||
|
</div>
|
||||||
|
<table style="width: 80%; height: 600px;">
|
||||||
|
<form action="salva-pagina.action" method="post">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<textarea name="contenuto" cols="110" rows="15">
|
||||||
|
<c:out value="${contenuto}" />
|
||||||
|
</textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="height: 60px">
|
||||||
|
<input type="hidden" name="titolo" value="${titolo}" />
|
||||||
|
<input type="submit" style="font-family: Verdana; font-size: 16px" value="Salva" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<hr>
|
||||||
|
<c:import url="fragments/pulsantiera.jsp" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
29
src/main/webapp/WEB-INF/views/fragments/pulsantiera.jsp
Normal file
29
src/main/webapp/WEB-INF/views/fragments/pulsantiera.jsp
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<%--
|
||||||
|
Document : pulsantiera
|
||||||
|
Created on : 22-mag-2016, 15.54.39
|
||||||
|
Author : morgoth
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>JSP Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form method="post" action="pulsantiera.action" name="pulsantieraForm">
|
||||||
|
<input type="hidden" name="titolo" value="${titolo}" />
|
||||||
|
<input type="submit" name="principale" style="font-family: Verdana; font-size: 16px;" value="PRINCIPALE" />
|
||||||
|
<input type="submit" name="tutte" style="font-family: Verdana; font-size: 16px;" value="TUTTE" />
|
||||||
|
<input type="submit" name="recenti" style="font-family: Verdana; font-size: 16px;" value="RECENTI" />
|
||||||
|
<input type="submit" id="email" name="email" style="font-family: Verdana; font-size: 16px;" value="EMAIL" disabled="true" />
|
||||||
|
</form>
|
||||||
|
<br />
|
||||||
|
<div id="title" style="font-family: Verdana; font-size: 16px;" >
|
||||||
|
JakiWiki - a cool Java Wiki
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
35
src/main/webapp/WEB-INF/views/list.jsp
Normal file
35
src/main/webapp/WEB-INF/views/list.jsp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<%--
|
||||||
|
Document : list
|
||||||
|
Created on : 25-mag-2016, 21.57.11
|
||||||
|
Author : morgoth
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||||
|
<%@taglib uri="/WEB-INF/jakiwiki.tld" prefix="jakiwiki" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>JakiWiki: ${intestazione}</title>
|
||||||
|
</head>
|
||||||
|
<body style="font-family: Verdana; font-size: 16px;">
|
||||||
|
<div id="title" style="font-family: Verdana; font-size: 16px; font-variant: small-caps;">
|
||||||
|
JakiWiki: ${intestazione}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table style="width: 80%; height: 600px;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<jakiwiki:lista_pagine pagine="${lista}"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<hr>
|
||||||
|
<c:import url="fragments/pulsantiera.jsp" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
45
src/main/webapp/WEB-INF/views/main.jsp
Normal file
45
src/main/webapp/WEB-INF/views/main.jsp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<%--
|
||||||
|
Document : main
|
||||||
|
Created on : 22-mag-2016, 15.37.31
|
||||||
|
Author : morgoth
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>JakiWiki: ${titolo}</title>
|
||||||
|
</head>
|
||||||
|
<body onload="document.getElementById('email').disabled = false;"
|
||||||
|
style="font-family: Verdana; font-size: 16px;">
|
||||||
|
|
||||||
|
<div id="title" style="font-family: Verdana; font-size: 32px; font-variant: small-caps;" >
|
||||||
|
JakiWiki: ${titolo}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table style="width: 80%; height: 600px;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<form name="modificaForm" action="edit.action" method="post">
|
||||||
|
<input type="hidden" name="titolo" value="${titolo}" />
|
||||||
|
<input type="submit" style="font-family: Verdana; font-size: 11px" value="Modifica" />
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<c:out value="${contenuto}" default="" escapeXml="false" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<hr>
|
||||||
|
<c:import url="fragments/pulsantiera.jsp" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
28
src/main/webapp/WEB-INF/web.xml
Normal file
28
src/main/webapp/WEB-INF/web.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="2.5" 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">
|
||||||
|
<display-name>JakiWiki</display-name>
|
||||||
|
<description>JakiWiki, un wiki in Java</description>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>MainController</servlet-name>
|
||||||
|
<servlet-class>it.jee_book.jakiwiki.servlet.MainController</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>MainController</servlet-name>
|
||||||
|
<url-pattern>*.action</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<ejb-local-ref>
|
||||||
|
<ejb-ref-name>ejb/PaginaManager</ejb-ref-name>
|
||||||
|
<ejb-ref-type>Session</ejb-ref-type>
|
||||||
|
<local>it.jee_book.jakiwiki.business.pagine.PaginaManager</local>
|
||||||
|
</ejb-local-ref>
|
||||||
|
|
||||||
|
<ejb-local-ref>
|
||||||
|
<ejb-ref-name>ejb/EmailManager</ejb-ref-name>
|
||||||
|
<ejb-ref-type>Session</ejb-ref-type>
|
||||||
|
<local>it.jee_book.jakiwiki.business.email.EmailManager</local>
|
||||||
|
</ejb-local-ref>
|
||||||
|
|
||||||
|
</web-app>
|
||||||
BIN
target/JakiWiki-1.0-SNAPSHOT.war
Normal file
BIN
target/JakiWiki-1.0-SNAPSHOT.war
Normal file
Binary file not shown.
2
target/JakiWiki-1.0-SNAPSHOT/META-INF/context.xml
Normal file
2
target/JakiWiki-1.0-SNAPSHOT/META-INF/context.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Context antiJARLocking="true" path="/JakiWiki"/>
|
||||||
9
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/actions.properties
Normal file
9
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/actions.properties
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# To change this license header, choose License Headers in Project Properties.
|
||||||
|
# To change this template file, choose Tools | Templates
|
||||||
|
# and open the template in the editor.
|
||||||
|
|
||||||
|
main=it.jee_book.jakiwiki.actions.VediPaginaAction
|
||||||
|
edit=it.jee_book.jakiwiki.actions.ModificaPaginaAction
|
||||||
|
pulsantiera=it.jee_book.jakiwiki.actions.PulsantieraAction
|
||||||
|
salva-pagina=it.jee_book.jakiwiki.actions.SalvaPaginaAction
|
||||||
|
invia-mail=it.jee_book.jakiwiki.actions.InviaMailAction
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
||||||
|
<persistence-unit name="defaultPersistenceUnit" transaction-type="JTA">
|
||||||
|
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||||
|
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
|
||||||
|
<class>it.jee_book.jakiwiki.model.Pagina</class>
|
||||||
|
</persistence-unit>
|
||||||
|
</persistence>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/glassfish-web.xml
Normal file
10
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/glassfish-web.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
|
||||||
|
<glassfish-web-app error-url="">
|
||||||
|
<class-loader delegate="true"/>
|
||||||
|
<jsp-config>
|
||||||
|
<property name="keepgenerated" value="true">
|
||||||
|
<description>Keep a copy of the generated servlet class' java code.</description>
|
||||||
|
</property>
|
||||||
|
</jsp-config>
|
||||||
|
</glassfish-web-app>
|
||||||
21
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/jakiwiki.tld
Normal file
21
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/jakiwiki.tld
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
|
||||||
|
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
|
||||||
|
|
||||||
|
<taglib>
|
||||||
|
|
||||||
|
<tlib-version>1.0</tlib-version>
|
||||||
|
<jsp-version>2.0</jsp-version>
|
||||||
|
<short-name>JakiWiki taglibs</short-name>
|
||||||
|
|
||||||
|
<tag>
|
||||||
|
<name>lista_pagine</name>
|
||||||
|
<tag-class>it.jee_book.jakiwiki.tag.ListaPagine</tag-class>
|
||||||
|
<attribute>
|
||||||
|
<name>pagine</name>
|
||||||
|
<required>true</required>
|
||||||
|
<rtexprvalue>true</rtexprvalue>
|
||||||
|
</attribute>
|
||||||
|
</tag>
|
||||||
|
|
||||||
|
</taglib>
|
||||||
4
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/jboss-web.xml
Normal file
4
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/jboss-web.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<jboss-web version="8.0" xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/schema/jbossas/jboss-web_8_0.xsd">
|
||||||
|
<context-root>/JakiWiki</context-root>
|
||||||
|
</jboss-web>
|
||||||
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/antlr-2.7.7.jar
Normal file
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/antlr-2.7.7.jar
Normal file
Binary file not shown.
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/commons-lang3-3.4.jar
Normal file
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/commons-lang3-3.4.jar
Normal file
Binary file not shown.
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/dom4j-1.6.1.jar
Normal file
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/dom4j-1.6.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/jandex-1.1.0.Final.jar
Normal file
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/jandex-1.1.0.Final.jar
Normal file
Binary file not shown.
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/javassist-3.18.1-GA.jar
Normal file
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/javassist-3.18.1-GA.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/xml-apis-1.0.b2.jar
Normal file
BIN
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/lib/xml-apis-1.0.b2.jar
Normal file
Binary file not shown.
8
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/views.properties
Normal file
8
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/views.properties
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# To change this license header, choose License Headers in Project Properties.
|
||||||
|
# To change this template file, choose Tools | Templates
|
||||||
|
# and open the template in the editor.
|
||||||
|
|
||||||
|
main=WEB-INF/views/main.jsp
|
||||||
|
edit=WEB-INF/views/edit.jsp
|
||||||
|
list=WEB-INF/views/list.jsp
|
||||||
|
email=WEB-INF/views/email.jsp
|
||||||
43
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/views/edit.jsp
Normal file
43
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/views/edit.jsp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<%--
|
||||||
|
Document : edit
|
||||||
|
Created on : 25-mag-2016, 21.15.50
|
||||||
|
Author : morgoth
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>JakiWiki: Modifica di ${titolo}</title>
|
||||||
|
</head>
|
||||||
|
<body style="font-family: Verdana; font-size: 16px;">
|
||||||
|
<div id="title" style="font-family: Verdana; font-size: 32px; font-variant: small-caps;" >
|
||||||
|
JakiWiki: modifica '${titolo}'
|
||||||
|
</div>
|
||||||
|
<table style="width: 80%; height: 600px;">
|
||||||
|
<form action="salva-pagina.action" method="post">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<textarea name="contenuto" cols="110" rows="15">
|
||||||
|
<c:out value="${contenuto}" />
|
||||||
|
</textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="height: 60px">
|
||||||
|
<input type="hidden" name="titolo" value="${titolo}" />
|
||||||
|
<input type="submit" style="font-family: Verdana; font-size: 16px" value="Salva" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<hr>
|
||||||
|
<c:import url="fragments/pulsantiera.jsp" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</form>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<%--
|
||||||
|
Document : pulsantiera
|
||||||
|
Created on : 22-mag-2016, 15.54.39
|
||||||
|
Author : morgoth
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>JSP Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form method="post" action="pulsantiera.action" name="pulsantieraForm">
|
||||||
|
<input type="hidden" name="titolo" value="${titolo}" />
|
||||||
|
<input type="submit" name="principale" style="font-family: Verdana; font-size: 16px;" value="PRINCIPALE" />
|
||||||
|
<input type="submit" name="tutte" style="font-family: Verdana; font-size: 16px;" value="TUTTE" />
|
||||||
|
<input type="submit" name="recenti" style="font-family: Verdana; font-size: 16px;" value="RECENTI" />
|
||||||
|
<input type="submit" id="email" name="email" style="font-family: Verdana; font-size: 16px;" value="EMAIL" disabled="true" />
|
||||||
|
</form>
|
||||||
|
<br />
|
||||||
|
<div id="title" style="font-family: Verdana; font-size: 16px;" >
|
||||||
|
JakiWiki - a cool Java Wiki
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
35
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/views/list.jsp
Normal file
35
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/views/list.jsp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<%--
|
||||||
|
Document : list
|
||||||
|
Created on : 25-mag-2016, 21.57.11
|
||||||
|
Author : morgoth
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||||
|
<%@taglib uri="/WEB-INF/jakiwiki.tld" prefix="jakiwiki" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>JakiWiki: ${intestazione}</title>
|
||||||
|
</head>
|
||||||
|
<body style="font-family: Verdana; font-size: 16px;">
|
||||||
|
<div id="title" style="font-family: Verdana; font-size: 16px; font-variant: small-caps;">
|
||||||
|
JakiWiki: ${intestazione}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table style="width: 80%; height: 600px;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<jakiwiki:lista_pagine pagine="${lista}"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<hr>
|
||||||
|
<c:import url="fragments/pulsantiera.jsp" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
45
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/views/main.jsp
Normal file
45
target/JakiWiki-1.0-SNAPSHOT/WEB-INF/views/main.jsp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<%--
|
||||||
|
Document : main
|
||||||
|
Created on : 22-mag-2016, 15.37.31
|
||||||
|
Author : morgoth
|
||||||
|
--%>
|
||||||
|
|
||||||
|
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||||
|
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>JakiWiki: ${titolo}</title>
|
||||||
|
</head>
|
||||||
|
<body onload="document.getElementById('email').disabled = false;"
|
||||||
|
style="font-family: Verdana; font-size: 16px;">
|
||||||
|
|
||||||
|
<div id="title" style="font-family: Verdana; font-size: 32px; font-variant: small-caps;" >
|
||||||
|
JakiWiki: ${titolo}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table style="width: 80%; height: 600px;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<form name="modificaForm" action="edit.action" method="post">
|
||||||
|
<input type="hidden" name="titolo" value="${titolo}" />
|
||||||
|
<input type="submit" style="font-family: Verdana; font-size: 11px" value="Modifica" />
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<c:out value="${contenuto}" default="" escapeXml="false" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<hr>
|
||||||
|
<c:import url="fragments/pulsantiera.jsp" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user