Skip to content

rmannibucau/rblog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RBlog

A simple JavaEE blog.

Configuration Options

All configurations either have a default or are optional.

Name

Default

Description

rblog.category.defaultColor

#000000

default color for a new category

rblog.pagination.max

100

Max page size

rblog.categories.autoCreate

true

should categories be created on the fly if missing when creating a post

rblog.posts.top.size

3

how many posts are shown by category for top endpoint (home page)

rblog.sitemap.pingUrls

http://www.google.com/webmasters/tools/ping?sitemap=%s,http://www.bing.com/ping?sitemap=%s

ping url(s) when the sitemap is generated and updated

rblog.visitor.pageSize

20

page size used to generate the sitemap and RSS feed

rblog.visitor.base

-

site root url used to send to the ping urls (sitemap) and to create the rss feed.

rblog.security.password.hash_algorithm

SHA-256

algorithm (MessageDigest) used to hash the passwords

rblog.security.password.round_trip

3

how many time the hash_algorithm is used to compute the password representation used in the database

rblog.token.eviction

PT720H

how often token are evicted (old ones are deleted making them inactive). Default is 30 days, it uses java.time.Duration syntax.

rblog.analytics.code

Google Analytics code to use for the website.

rblog.provisioning.defaultUser.active

true

Is a default user provisionned at startup if the database has no user.

rblog.provisioning.defaultUser.name

admin

Default username/password if a default user is created.

rblog.twitter.token

-

Twitter token to use for notifications.

rblog.twitter.tokenSecret

-

Twitter token secret to use for notifications.

rblog.twitter.consumerKey

-

Twitter consumer key to use for notifications.

rblog.twitter.consumerSecret

-

Twitter consumer secret to use for notifications.

rblog.twitter.api.update.url

https://api.twitter.com/1.1/statuses/update.json

Twitter endpoint to use to send the notification.

rblog.bitly.url

https://api-ssl.bitly.com/v3/shorten

Bit.ly endpoint to shorten urls.

rblog.bitly.token

-

Bit.ly access_token. If not set Bit.ly feature is not active.

rblog.backup.work

${openejb.base}/work/rblog

Where to dump the blog when a backup is done.

rblog.backup.mail.sessionJndi

-

Session JNDI name to send mails on backup.

rblog.backup.mail.from

[email protected]

FROM address used to send mail on backup.

rblog.backup.mail.to

-

Recipients address for backups.

rblog.backup.mail.subject

Configuration location/format

Configuration uses properties format (java.util.Properties). Read locations are (sorted):

  • rblog.properties in the classloader of the application

  • ${rblog.base}/conf/rblog.properties or ${openejb.base}/conf/rblog.properties if exist

Attachments

By default RBlog tries to embed as much as possible but there is an attachment service you can use for custom files.

In that case you will need to activated on your server the multi part without an explicit configuration. For tomcat/tomee just add/create a context.xml:

<Context allowCasualMultipartParsing="true" />

Max text size

Fe things will limit the max size of the content of a post depending where you deploy. Here are few hints to check:

  • MySQL: by default OpenJPA would use TEXT which limits the size to 64k which would be quite small if you embed images in the posts. To fix it alter the column:

alter table rblog_post modify content mediumtext;
  • TomEE: by default tomee 7.0.0 johnzon setup will limit JSON string content to 4k so ensure t adjust it (7.0.1 will accept a bit more):

# whatever fits your need, number of chars
org.apache.johnzon.max-string-length = 655360

Social networks integration

Today RBlog supports Twitter integration. When you create a post you can define a tweet and schedule it to be posted when the post is published.

Bit.ly integration

If you configure Bit.ly (token property, see configuration) you will be able to hit a Bit.ly button on the post form to automatically retrieve a bit.ly url.

Mail backup

Often for small or personal blogs the best backup is a mail box (avoid to need a custom server).

When activated configuring sessionJndi and to properties, that’s what will do the backup feature.

Note
it needs a valid session configuration, here is a sample for gmail:
<Resource id="mail/gmail" type="javax.mail.Session">
mail.transport.protocol = smtp
mail.smtp.host = smtp.gmail.com
mail.smtp.port = 587
mail.smtp.auth = true
mail.smtp.starttls.enable = true
mail.smtp.user = xxxxx
password = xxxxxx
</Resource>

Then on tomee you can set rblog.backup.mail.sessionJndi to openejb:Resource/mail/gmail.

Possible Enhancements

(feel free to PR ;))

  • [enhancement] write endpoints should use a nested tx to ensure to commit before returning a value

  • [feature] theme/theming (hardcoded today)

  • [feature] Support of Markdown and potentially Asciidoctor (optional and async start cause JRuby by default would be a pain) syntax

  • [feature] Attachement GUI and linkage in the content

  • [feature] TomEE Embedded fat jar (java -jar rblog.jar or java -jar rblog.war or java -jar tomee-embedded.jar --path rblog.war)

  • [feature] TomEE distribution (pre-packaged rblog zip: unzip rblog.zip && cd rblog-version && ./bin/startup.sh) or openshift setup

  • …​

Build

Don’t forget to setup chrome and chromedriver and point chromedriver through the maven property chrome.driver (can be done in a activated by default profile in settings.xml):