JavaDoc for the integration of Krazos Facelets ViewEngine with LibreCCM and a small bugfix

Former-commit-id: 48ee764e5f
pull/6/head
Jens Pelzetter 2020-09-13 18:51:29 +02:00
parent 271b17fcc9
commit d72d054efa
4 changed files with 47 additions and 6 deletions

View File

@ -69,12 +69,12 @@ class CcmThemeUrlConnection extends URLConnection {
super(url);
this.themes = themes;
final String urlStr = url.toString();
final String urlPath = url.getPath();
if (urlStr.startsWith("/")) {
path = urlStr.substring(1);
if (urlPath.startsWith("/")) {
path = urlPath.substring(1);
} else {
path = urlStr;
path = urlPath;
}
}

View File

@ -26,7 +26,9 @@ import java.net.URLConnection;
import java.net.URLStreamHandler;
/**
*
* Implementation of {@link URLStreamHandler} for handling URLs to LibreCCM
* theme templates.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
class CcmThemeUrlStreamHandler extends URLStreamHandler {

View File

@ -27,7 +27,8 @@ import java.net.URL;
import javax.faces.application.ViewResource;
/**
*
* A {@link ViewResource} implementation for templates from LibreCCM themes.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
class CcmThemeViewResource extends ViewResource {
@ -36,13 +37,28 @@ class CcmThemeViewResource extends ViewResource {
private final Themes themes;
/**
* Constructor for the {@code ViewResource} instance.
*
* @param themes Interface to the theme system
* @param path The path of the template.
*/
public CcmThemeViewResource(final Themes themes, final String path) {
this.themes = themes;
this.path = path;
}
/**
* Gets the URL of the URL of the template as {@code ViewResource}.
*
* @return The URL of the {@code ViewResource}.
*/
@Override
public URL getURL() {
// The URL build here is a "pseudo" URL. Most of the parts of the URL
// are no relevant. An special URLStreamHandler implementation is
// also passed to the URL. This URLStreamHandler implementation takes
// care of retrieving the template from the theme.
try {
return new URL(
"libreccm",

View File

@ -0,0 +1,23 @@
/*
* Copyright (C) 2020 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
/**
* Integration of the LibreCCM theme system with the Facelet ViewEngine of
* Eclipse Krazo.
*/
package org.libreccm.mvc.facelets;