Some useful tools for web in Java. https://www.kiss4web.org/
Find a file
2024-08-12 17:31:15 +02:00
.settings Set explicitly UTF-8 as the project encoding. 2024-08-12 03:32:59 +02:00
lib Upgraded log4j libs. 2024-07-26 19:33:39 +02:00
src/fr/devinsy/kiss4web Added a first version of HtmlCache class. 2024-08-12 17:31:15 +02:00
test Fixed Java upgrade. 2024-08-12 03:34:22 +02:00
.classpath Upgraded log4j libs. 2024-07-26 19:33:39 +02:00
.gitignore Improve build, add test management, update lib. 2013-06-25 03:11:22 +02:00
.project Improve package design. 2013-08-24 12:25:08 +02:00
build-libjar.xml Refactored build. 2016-09-21 14:27:25 +02:00
build.num Build 0.17.1 2023-12-01 05:27:08 +01:00
build.properties Configured new version 0.17, Java 17 and Tomcat 10.1. 2023-11-27 19:13:42 +01:00
build.xml Refactored build. 2016-09-21 14:27:25 +02:00
buildandgit.xml Refactored build. 2016-09-21 14:27:25 +02:00
LICENSE First commit from split with devinsy-utils. 2013-06-20 02:57:31 +02:00
README.md Migrated to Tomcat 10.1. Improved code, Javadoc, doc, process… 2023-11-29 16:25:42 +01:00
TODO Improve code organization. 2013-08-19 16:18:54 +02:00

Kiss4web

Welcome! Welcome in a world of K.I.S.S.

K.I.S.S. = Keep It Simple, Stupid (https://en.wikipedia.org/wiki/KISS_principle).

Nowadays, make a Web site involves to use complex and heavy frameworks. Nevertheless, to build a web page and to return it, does not maybe ask so much complexity.

Kiss4web is a K.I.S.S. solution for building web applications.

Kiss4web builds on:

  • KissDispatcher: call the good Java Servlet for each HTTP request,
  • Xidyn: a template solution to dynamize HTML sources.

Author

Lead developer: Christian Pierre MOMON christian.momon@devinsy.fr

License

Kiss4web is released under the GNU LGPL license.

Developing environment

Kiss4web project uses strictly Eclipse 4.29, Java 17, tomcat 10.1 and Git.

Build

Kiss4web uses Ant and generates a kiss4web-x.y.z folder which contains:

  • x.jar : full software.
  • x-core.jar : only compiled class without any library.
  • x-core-source.jar : sources.

Dependencies

The kiss4web jar requires:

  • commons-io
  • commons-lang3
  • devinsy-strings

Usages

B --> FooAppLauncher   -------------------------> FooApp
  [ServletContextListener]                      [Singleton]
                                                    |
                                                    | setMode(Mode.OPEN)
                                                   \ /
A --> Kiss4webLauncher ----setMode(Mode.OPEN)---> Kiss4web <Mode.APP_INIT>
  [ServletContextListener]                      [Singleton]

KissDispatcher is initialized with Mode.APP_INIT.

Usage A: default

The easier way, in case you have no application initialization step. The Kiss4webLauncher set a default log4j2 configuration and set the KissDispatcher to Mode.OPEN state with a default set of hooks.

Edit …/WebContent/WEB-INF/web.xml :

  <listener>
     <listener-class>fr.devinsy.kiss4web.Kiss4webLauncher</listener-class>
  </listener>
  <servlet>
    <servlet-name>Application dispatcher</servlet-name>
    <servlet-class>fr.devinsy.kiss4web.dispatcher.KissDispatcher</servlet-class>
    <init-param>
      <param-name>webClassesRootPackage</param-name>
      <param-value>website</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Application dispatcher</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

You can create …/WebContent/WEB-INF/log4j2.properties:

# Log configuration 
# #################

# priority setting: DEBUG < INFO < WARN < ERROR
name = Log4j2 Properties Config
status = ERROR
dest = err

# Logger settings. 
rootLogger.level = INFO
rootLogger.appenderRefs = a, b
rootLogger.appenderRef.a.ref = CONSOLE
rootLogger.appenderRef.b.ref = LOGFILE

logger.statoolinfos.name = fr.devinsy.statoolinfos
logger.statoolinfos.level = INFO

logger.xidyn.name = fr.devinsy.xidyn
logger.xidyn.level = WARN

# Appenders settings.
appenders = CONSOLE, LOGFILE

appender.CONSOLE.type = Console
appender.CONSOLE.name = CONSOLE
appender.CONSOLE.layout.type = PatternLayout
appender.CONSOLE.layout.pattern = %d{ISO8601} - FooApp [%-5p] %34.34c.%25M - %m%n

appender.LOGFILE.type           = File
appender.LOGFILE.name           = LOGFILE
appender.LOGFILE.filename       = /srv/fooapp/rslisi.log
appender.LOGFILE.layout.type    = PatternLayout
appender.LOGFILE.layout.pattern = %d{ISO8601} - FooApp [%-5p] %34.34c.%25M - %m%n

Usage B: custom init

If you want manage an application initialization step, do not use the Kiss4webLauncher as class listener. Create your own FooAppLauncher and make it calls Kiss4web.instance().setMode(Mode.OPEN) when the init step is over.

Edit …/WebContent/WEB-INF/web.xml :

  <listener>
     <listener-class>org.foo.app.FooAppLauncher</listener-class>
  </listener>
  <servlet>
    <servlet-name>Application dispatcher</servlet-name>
    <servlet-class>fr.devinsy.kiss4web.dispatcher.KissDispatcher</servlet-class>
    <init-param>
      <param-name>webClassesRootPackage</param-name>
      <param-value>website</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Application dispatcher</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>