📜 ⬆️ ⬇️

Spring in action - trying open source CMS in Java

This article will focus on Riot content management system written in Java . The system is based on the Spring Framework , uses Ajax .

web developer at work

I will give the main features of the system and tell you step by step how to install it. The article is addressed to all those interested in Java content management systems.

')

Content


What is Riot

Creating a new Riot project


What is Riot


Riot is a opensource framework for building web applications.

End users can view the system as a CMS , but from the standpoint of the developer, Riot is rather a Content Management Framework ( CMF ) , since the system does not offer an out-of-the-box solution. Riot is a web application framework based on opensource technologies, the most significant of which are Spring and Hibernate .

Main characteristics:


System requirements:


Used libraries:


Documentation:

Documentation on the system a bit. The developers of riot insist that the system is based on well-known well-documented technologies and it will be easy to deal with the add-ons of riot. There is a group in Google , in which there is a discussion of the system, there is an online JavaDoc and fmdoc .

Creating a new Riot project


We will create a new project in Eclipse (with the installed Web Standard Tools plugin). If you do not want to use the IDE, simply create a new folder for the future project.
web developer at work
In the created folder, place the following Ant-file setup.xml and run the default target
  (wget http://riotfamily.org/setup.xml && ant -f setup.xml). 


Setup.xml downloads the file www.riotfamily.org/setup/skeleton-8.0.zip and unpacks it. Runs the skeleton.xml ant script. Removes skeleton.xml, setup.xml, skeleton-8.0.zip .

Execution of the skeleton.xml file.
The file checks whether the project was created in Eclipse, and if so, the script patches several config files in the IDE . (for example, the build / conf folder is added to the list of source folders ). After that, the setup procedure of the build.xml file is called, which performs dependency resolution using Ivy and builds the project. It took me about 15 minutes to build the project, for them ivy pulled out eleven megabytes of libraries.

After the project is completed, update the project structure from Eclipse to see the files loaded during project creation.
web developer at work
If you are not using an editor, use the ant war command to create a WAR file.

Place the created war file in the Tomkat webapps folder and restart the server.

The default site will be available at localhost: 8080 / <context> / .
The admin panel will be available at localhost: 8080 / <context> / riot .
Username: admin
Password: admin
web developer at work
Russification Riot

Riot uses utf8 encoding, but in order for the system to understand Cyrillic , you need to check several settings of the application.
  1. Check the coding of the DBMS. For MySQL, I had to write in the file my.cnf (my.ini) :
    character-set-server = utf8
    collation-server = utf8_general_ci
  2. To correctly convert text into a picture ( org.riotfamily.website.txt2img package ), add cyrillic fonts (for example, this one ) to the riot-config / website-servlet.xml file;
  3. To translate the admin menu into the browser's address bar, enter the javascript: void (frameset.toggleI18n ()) command, after which a yellow [l18n] button will appear next to each label. Click on it and translate the menu.

web developer at work
Configuring the connection to the database

By default, Riot uses HSQLDB and does not store changes to the system after a reboot. To configure work with MySQL (PostgreSQL), change the settings for the conf \ default \ application.properties file according to the recommendations given in conf \ mysql \ application.properties or conf \ postgres \ application.properties .

Errors during installation

1. After building the project, I had Eclipse validation errors spring-beans-2.5.xsd. The solution turned out to be simple .
2. Also, an error occurred while creating the riot_dbmsgsrc_entries table.
I had to change the code:
  1. CREATE TABLE `riot _ dbmsgsrc _ entries` (
  2. `id` bigint ( 20 ) NOT NULL auto_increment ,
  3. `bundle` varchar ( 255 ) collate utf8_general_ci default NULL ,
  4. `code` varchar ( 255 ) collate utf8_general_ci default NULL ,
  5. `comment` longtext collate utf8_general_ci ,
  6. PRIMARY KEY ( `id` ) ,
  7. UNIQUE KEY `bundle` ( ` bundle` , `code` )
  8. ) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci AUTO_INCREMENT = 1 ;

on
  1. CREATE TABLE `riot _ dbmsgsrc _ entries` (
  2. `id` bigint ( 20 ) NOT NULL auto_increment ,
  3. `bundle` varchar ( 255 ) collate utf8_general_ci default NULL ,
  4. `code` varchar ( 255 ) collate utf8_general_ci default NULL ,
  5. `comment` longtext collate utf8_general_ci ,
  6. PRIMARY KEY ( `id` ) ,
  7. UNIQUE KEY `bundle` ( ` bundle` ( 100 ) , `code` ( 100 ) )
  8. ) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci AUTO_INCREMENT = 1 ;

3. I could not start Tomket from the editor, so I added the purpose of starting / stopping the server and the purpose of placing the war-file in the webapps folder in build.xml. My changes:
  1. <! - The Tomcat folder ->
  2. <property name = "tomcat.dir" value = "C: / Program Files / Apache Software Foundation / Tomcat 6.0" />
  3. <! - The Tomcat webapp content ->
  4. <property name = "tomcat.webapp.dir" value = "$ {tomcat.dir} / webapps" />
  5. <! - Copies war file into Tomcat ->
  6. <target name = "deploy-tomcat" depends = "war" description = "Copies war file into Tomcat" >
  7. <antcall target = "tomcat-stop" />
  8. <copy file = "$ {war.location}" todir = "$ {tomcat.webapp.dir}" />
  9. <delete dir = "$ {tomcat.webapp.dir} / $ {ant.project.name}" />
  10. <antcall target = "tomcat-start" />
  11. </ target >
  12. <! - Runs Tomcat ->
  13. <target name = "tomcat-start" >
  14. <java jar = "$ {tomcat.dir} /bin/bootstrap.jar" fork = "true" >
  15. <jvmarg value = "-Dcatalina.home = $ {tomcat.dir}" />
  16. </ java >
  17. </ target >
  18. <! - Stops Tomcat ->
  19. <target name = "tomcat-stop" >
  20. <java jar = "$ {tomcat.dir} /bin/bootstrap.jar" fork = "true" >
  21. <jvmarg value = "-Dcatalina.home = $ {tomcat.dir}" />
  22. <arg line = "stop" />
  23. </ java >
  24. </ target >


findings


Riot is an interesting and flexible system built on java-technologies. Riot provides the developer with a web application framework with already implemented basic CMS functions.

Source: https://habr.com/ru/post/100984/


All Articles