JavaDoc for the integration of Krazos Facelets ViewEngine with LibreCCM and a small bugfix
Former-commit-id: 48ee764e5f
pull/6/head
parent
271b17fcc9
commit
d72d054efa
|
|
@ -69,12 +69,12 @@ class CcmThemeUrlConnection extends URLConnection {
|
||||||
super(url);
|
super(url);
|
||||||
this.themes = themes;
|
this.themes = themes;
|
||||||
|
|
||||||
final String urlStr = url.toString();
|
final String urlPath = url.getPath();
|
||||||
|
|
||||||
if (urlStr.startsWith("/")) {
|
if (urlPath.startsWith("/")) {
|
||||||
path = urlStr.substring(1);
|
path = urlPath.substring(1);
|
||||||
} else {
|
} else {
|
||||||
path = urlStr;
|
path = urlPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,9 @@ import java.net.URLConnection;
|
||||||
import java.net.URLStreamHandler;
|
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>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
class CcmThemeUrlStreamHandler extends URLStreamHandler {
|
class CcmThemeUrlStreamHandler extends URLStreamHandler {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ import java.net.URL;
|
||||||
import javax.faces.application.ViewResource;
|
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>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
class CcmThemeViewResource extends ViewResource {
|
class CcmThemeViewResource extends ViewResource {
|
||||||
|
|
@ -36,13 +37,28 @@ class CcmThemeViewResource extends ViewResource {
|
||||||
|
|
||||||
private final Themes themes;
|
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) {
|
public CcmThemeViewResource(final Themes themes, final String path) {
|
||||||
this.themes = themes;
|
this.themes = themes;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the URL of the URL of the template as {@code ViewResource}.
|
||||||
|
*
|
||||||
|
* @return The URL of the {@code ViewResource}.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public URL getURL() {
|
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 {
|
try {
|
||||||
return new URL(
|
return new URL(
|
||||||
"libreccm",
|
"libreccm",
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
Loading…
Reference in New Issue