Giter VIP home page Giter VIP logo

admin-showcase's Introduction

Admin Showcase

1. Demo

Showcase is available on Openshift here.

The demo runs on the Openshift starter which is a platform used just for testing and not for production. So it’s likely the showcase may be slow or even down.

2. Running locally

There are several ways to run Admin Showcase on your machine. Just clone this repository and use one of the alternatives described below.

2.1. Using an application server

Admin Showcase is compatible with most JavaEE 6 and Java EE 8 application servers.

Just build the application with maven using mvn clean package -DskipTests and deploy the resulting showcase.war into a JavaEE 6 or greater server.

ℹ️
No configuration is needed.

Following is the list of tested servers:

Supported Application Servers

This application is compatible with Java EE 6/7/8 application servers, tested with:

To run on JavaEE 8 application servers such as Wildfly 16 you’ĺl need to upgrade OmniFaces to version 3.x.

2.2. WildFly Swarm

This showcase is Wildfly Swarm compatible, just run the following command:

mvn wildfly-swarm:run  -Pswarm

2.3. Docker

You can run this showcase via docker through the following command:

docker run -it -p 8080:8080 rmpestano/admin-showcase
💡
use build.and-run.sh to easily run the application via docker.

3. Testing

To execute functional tests you need to activate the tests profile and choose the application server also using a maven profile, ex:

mvn clean package -P tests -P wildfly8-managed

By default tests run on chrome, to change the webdriver you need to use the property browser:

mvn test -Ptomee-remote -Dbrowser=phantomjs
⚠️
See the chrome driver version the tests are using here and update your chrome browser according to this page. (pay attention to the supports chrome label).

4. Documentation

Documentation can be found here: https://adminfaces.github.io/site/#Documentation

admin-showcase's People

Contributors

rmpestano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

admin-showcase's Issues

showcase.war

Hi,
Please, is there a possibility to share the war file of showcase, I generate it with maven command, but when I tried to deployed in tomcat 7, it gives me this error:
Caused by: java.lang.ClassNotFoundException: javax.faces.application.ViewHandler

Thanks

Support WebSphere liberty profile

liberty profile (16.0.0.4) is not finding the composite component inside Admin Template, the following warning is shown:

Warning: The page /pages/layout/sidebar-collapsed.xhtml declares namespace http://java.sun.com/jsf/composite/components/admin and uses the tag adm:breadCrumb , but no TagLibrary associated to namespace.Warning: The page /pages/layout/sidebar-collapsed.xhtml declares namespace http://java.sun.com/jsf/composite/components/admin and uses the tag adm:breadCrumb , but no TagLibrary associated to namespace. Please check the namespace name and if it is correct, it is probably that your library .taglib.xml cannot be found on the current classpath, or if you are referencing a composite component library check your library folder match with the namespace and can be located by the installed ResourceHandler.

Stacktrace:

Error Message: javax.servlet.ServletException: /pages/layout/skin.xhtml at line 15 and column 66 <adm:breadCrumb> Tag Library supports namespace: http://github.com/admin-faces, but no tag was defined for name: breadCrumb
Error Code: 500
Target Servlet: Faces Servlet
Error Stack:
javax.faces.view.facelets.TagException: /pages/layout/skin.xhtml at line 15 and column 66 <adm:breadCrumb> Tag Library supports namespace: http://github.com/admin-faces, but no tag was defined for name: breadCrumb
     at org.apache.myfaces.view.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:300)
     at org.apache.myfaces.view.facelets.compiler.SAXCompiler$CompilationHandler.startElement(SAXCompiler.java:251)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
     at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
     at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
     at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
     at org.apache.myfaces.view.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:748)
     at org.apache.myfaces.view.facelets.compiler.Compiler.compile(Compiler.java:91)
     at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory._createFacelet(DefaultFaceletFactory.java:381)
     at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.access$000(DefaultFaceletFactory.java:57)
     at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:124)
     at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:121)
     at org.apache.myfaces.view.facelets.impl.FaceletCacheImpl.getFacelet(FaceletCacheImpl.java:84)
     at org.apache.myfaces.view.facelets.impl.FaceletCacheImpl.getFacelet(FaceletCacheImpl.java:51)
     at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:264)
     at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:246)
     at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage._getFacelet(FaceletViewDeclarationLanguage.java:2576)
     at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:477)
     at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:78)
     at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:267)
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:778)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:148)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:94)
     at com.github.adminfaces.template.filter.AdminFilter.doFilter(AdminFilter.java:92)
     at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:1021)
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1143)
     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4956)
     at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest(WebApp31.java:525)
     at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:315)
     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1014)
     at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:280)
     at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:967)
     at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:359)
     at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:318)
     at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
     at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
     at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
     at com.ibm.ws.http.channel.internal.inbound.HttpICLReadCallback.complete(HttpICLReadCallback.java:66)
     at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
     at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
     at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
     at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at java.lang.Thread.run(Thread.java:745)
     

Tomee 1.7.x support

As in #2, Tomee is not recognizing the breadCrumb composite component (looks like a MyFaces thing):

Warning: The page /admin.xhtml declares namespace http://xmlns.jcp.org/jsf/core and uses the tag f:view , but no TagLibrary associated to namespace.Warning: The page /admin.xhtml declares namespace http://xmlns.jcp.org/jsf/core and uses the tag f:view , but no TagLibrary associated to namespace. Please check the namespace name and if it is correct, it is probably that your library .taglib.xml cannot be found on the current classpath, or if you are referencing a composite component library check your library folder match with the namespace and can be located by the installed ResourceHandler.

Add page statistics

Add page view statistics like number views of each page also as unique views (by ip) as well as date it was viewed.

Disable AdminFilter

Hi, i'm actually try to overwrite the AdminFilter, 'cause i need access some pages without user do the login, example, info pages. So, I trying to create a LoginFilter and config in the web.xml:


<filter>
          <filter-name>Loginfilter</filter-name>
          <filter-class>br.com.portaltbm.infra.security.LoginFilter</filter-class>
  </filter>
  <filter-mapping>
          <filter-name>Loginfilter</filter-name>
          <url-pattern>/*</url-pattern>
          <dispatcher>REQUEST</dispatcher>
          <dispatcher>FORWARD</dispatcher>
          <dispatcher>INCLUDE</dispatcher>
          <dispatcher>ERROR</dispatcher>
  </filter-mapping>

the LoginFilter run, but the AdminFilter too. The problem is, i add in LoginFilter to ignore the resources to redirect for the page testePage.xhtml, but doens't work ;(

LoginFilter:


package br.com.portaltbm.infra.security;

import com.github.adminfaces.template.config.AdminConfig;
import com.github.adminfaces.template.session.AdminSession;

import com.github.adminfaces.template.util.Constants;

import javax.inject.Inject;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import static com.github.adminfaces.template.util.Assert.has;

/**
 * Based on https://github.com/conventions/core/blob/master/src/main/java/org/conventionsframework/filter/ConventionsFilter.java
 * Created by rafael-pestano on 07/01/17.
 *
 * This filter controls when user must be redirected to logon or index page
 * and saves current url to redirect back when session expires
 */
@WebFilter(urlPatterns = {"/*"})
public class LoginFilter implements Filter {

    private static final String FACES_RESOURCES = "/javax.faces.resource";
    private static final Logger log = Logger.getLogger(LoginFilter.class.getName());

    private boolean disableFilter;
    private String loginPage;
    private String indexPage;
    private String testePage;
    private String redirectPrefix;
    private String lastPage = "";

    @Inject
    AdminSession adminSession;

    @Inject
    AdminConfig adminConfig;

    private final List<String> ignoredResources = new ArrayList<>();

    @Override
    public void init(FilterConfig filterConfig) {
        String disableAdminFilter = filterConfig.getServletContext().getInitParameter(Constants.InitialParams.DISABLE_FILTER);
        if (adminConfig.isDisableFilter() || has(disableAdminFilter) && Boolean.valueOf(disableAdminFilter)) {
            disableFilter = true;
        }
        if (!disableFilter) {
            try {
                loginPage = filterConfig.getServletContext().getInitParameter(Constants.InitialParams.LOGIN_PAGE);
                testePage = "testePage.xhtml";
                if (!has(loginPage)) {
                    loginPage = has(adminConfig) ? adminConfig.getLoginPage() : Constants.DEFAULT_LOGIN_PAGE;
                }
                String errorPage = filterConfig.getServletContext().getInitParameter(Constants.InitialParams.ERROR_PAGE);
                if (!has(errorPage)) {
                    errorPage = Constants.DEFAULT_ERROR_PAGE;
                }
                indexPage = filterConfig.getServletContext().getInitParameter(Constants.InitialParams.INDEX_PAGE);
                if (!has(indexPage)) {
                    indexPage = has(adminConfig) ? adminConfig.getIndexPage() : Constants.DEFAULT_INDEX_PAGE;
                }

                //removes leading '/'
                errorPage = errorPage.startsWith("/") ? errorPage.substring(1) : errorPage;
                loginPage = loginPage.startsWith("/") ? loginPage.substring(1) : loginPage;
                indexPage = indexPage.startsWith("/") ? indexPage.substring(1) : indexPage;

                ignoredResources.add("/" + loginPage.substring(0, loginPage.lastIndexOf(".")));//we need leading slash for ignoredResources
                ignoredResources.add("/" + errorPage.substring(0, errorPage.lastIndexOf(".")));
                ignoredResources.add("/" + testePage.substring(0, testePage.lastIndexOf(".")));


                String configuredResouces = adminConfig.getIgnoredResources();
                if (has(configuredResouces)) {
                    this.ignoredResources.addAll(Arrays.asList(configuredResouces.split(",")));
                    for (String ignoredResource : ignoredResources) {
                        if (!ignoredResource.startsWith("/")) { //we need leading slash for ignoredResources beucase getServletPath (in this#skipResource) returns a string with leading slash
                            ignoredResources.set(ignoredResources.indexOf(ignoredResource), "/" + ignoredResource);
                        }
                    }
                }

            } catch (Exception e) {
                log.log(Level.SEVERE, "problem initializing admin filter", e);
            }
        }

    }

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        if (disableFilter) {
            chain.doFilter(req, resp);
            return;
        }
        req.setCharacterEncoding("UTF-8");
        resp.setCharacterEncoding("UTF-8");
        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) resp;
        
        String requestedPage = request.getRequestURI();
        
        if (requestedPage.endsWith(testePage)) {
            // Permite o acesso direto à página testePage sem verificar o login
            chain.doFilter(req, resp);
            return;
        }
        
        if (request.getRequestURI().equals(request.getContextPath() + "/")
                || (adminSession.isLoggedIn() && request.getRequestURI().endsWith(loginPage))) {
            response.sendRedirect(getRedirectPrefix(request) + request.getContextPath() + "/" + indexPage);
            return;
        }

        if (request.getRequestURI().contains(request.getContextPath() + "/public/") || shouldIgnoreResource(request.getServletPath())) {
            chain.doFilter(req, resp);
            return;
        }

        if (skipResource(request, response) || adminSession.isLoggedIn()) {
            if (!adminSession.isUserRedirected() && adminSession.isLoggedIn() && has(request.getHeader("Referer")) && request.getHeader("Referer").contains("?page=")) {
                adminSession.setUserRedirected(true);
                String pageFromURL = request.getContextPath() + extractPageFromURL(request.getHeader("Referer"));
                log.info("Redirecting user back to " + pageFromURL);
                response.sendRedirect(getRedirectPrefix(request) + pageFromURL);
                return;
            }
            try {
                chain.doFilter(req, resp);
            } catch (FileNotFoundException e) {
                log.log(Level.WARNING, "File not found", e);
                response.sendError(404);
            }
        } else { //resource not skipped (e.g a page that is not logon page) AND user not logged in
            redirectToLogon(request, (HttpServletResponse) resp);
            return;
        }

    }

    private String extractPageFromURL(String referer) {
        String page = referer.substring(referer.indexOf("page=") + 5);
        try {
            return URLDecoder.decode(page, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            log.log(Level.WARNING, "Could not extract page from url", e);
            return indexPage;
        }
    }

    @Override
    public void destroy() {

    }

    /**
     * skips faces-resources, index, error or logon pages
     *
     * @param request
     * @return true if resource must be skipped by the filter false otherwise
     */
    private boolean skipResource(HttpServletRequest request, HttpServletResponse response) {
        String path = request.getServletPath();
        if (path.contains(".")) {
            path = path.substring(0, path.lastIndexOf("."));
        }
        boolean skip = path.startsWith(FACES_RESOURCES) || shouldIgnoreResource(path) || response.getStatus() == HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
        return skip;
    }

    private void redirectToLogon(HttpServletRequest request, HttpServletResponse response) {
        try {
            String referer = request.getHeader("Referer");
            String recoveryUrlParams;
            //get request parameters
            if (has(referer) && referer.contains("?")) {
                recoveryUrlParams = referer.substring(referer.lastIndexOf("?") + 1);
            } else {
                recoveryUrlParams = request.getQueryString();
            }
            //saves page where user were
            String requestedPage = request.getRequestURI();
            StringBuilder recoveryUrl = null;
            if ((!testePage.equals(requestedPage) || !loginPage.equals(requestedPage)) && requestedPage.contains(".")) {
                if (requestedPage.startsWith(request.getContextPath())) {
                    requestedPage = requestedPage.replaceFirst(request.getContextPath(), "");
                }
                recoveryUrl = new StringBuilder(requestedPage);
                if (has(recoveryUrlParams)) {
                    recoveryUrl.append("?").append(recoveryUrlParams);
                }
            }
            /*
             if saved page is not null and is not index page then send user to logon page and save
            / previous page in url param named 'page'
            */
            String redirectUrl = "";
//            if (requestedPage.equals("/testePage.xhtml")) {
//            	redirectUrl = request.getContextPath() + "/" + testePage + (has(recoveryUrl) &&
//            			isValidRecoveryUrl(recoveryUrl) ? "?page=" + URLEncoder.encode(recoveryUrl.toString(), "UTF-8") : "");            	
//            } else {
        	redirectUrl = request.getContextPath() + "/" + loginPage + (has(recoveryUrl) &&
        			isValidRecoveryUrl(recoveryUrl) ? "?page=" + URLEncoder.encode(recoveryUrl.toString(), "UTF-8") : "");            	
//            }
            if ("partial/ajax".equals(request.getHeader("Faces-Request"))) {
                //redirect on ajax request: //http://stackoverflow.com/questions/13366936/jsf-filter-not-redirecting-after-initial-redirect
                response.setContentType("text/xml");
                response.getWriter()
                        .append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
                        .printf("<partial-response><redirect url=\"%s\"></redirect></partial-response>", redirectUrl);
            } else {//normal redirect
                response.sendRedirect(getRedirectPrefix(request) + redirectUrl);
            }

        } catch (Exception e) {
            log.log(Level.SEVERE, "Could not redirect to " + loginPage, e);
        }

    }

    /**
     * Skip error pages, login and index page as recovery url because it doesn't make sense redirecting user to such pages
     *
     * @param recoveryUrl
     * @return
     */
    private boolean isValidRecoveryUrl(StringBuilder recoveryUrl) {
        String pageSuffix = adminConfig.getPageSufix();
        return !recoveryUrl.toString().contains(Constants.DEFAULT_INDEX_PAGE.replace("xhtml", pageSuffix)) && !recoveryUrl.toString().contains(Constants.DEFAULT_ACCESS_DENIED_PAGE.replace("xhtml", adminConfig.getPageSufix()))
                && !recoveryUrl.toString().contains(Constants.DEFAULT_EXPIRED_PAGE.replace("xhtml", pageSuffix)) && !recoveryUrl.toString().contains(Constants.DEFAULT_OPTIMISTIC_PAGE.replace("xhtml", adminConfig.getPageSufix()))
                && !recoveryUrl.toString().contains(Constants.DEFAULT_LOGIN_PAGE.replace("xhtml", adminConfig.getPageSufix()));
    }

    /**
     * @param path
     * @return true if requested path starts with a ignored resource (configured in admin-config.properties)
     */
    private boolean shouldIgnoreResource(String path) {
        for (String ignoredResource : ignoredResources) {
            if (path.startsWith(ignoredResource)) {
                return true;
            }
        }
        return false;
    }

    private String getRedirectPrefix(HttpServletRequest request) {
        if(redirectPrefix == null) {
            String url = request.getRequestURL().toString();
            String uri = request.getRequestURI();
            int offset = url.indexOf(uri);
            redirectPrefix = url.substring(0, offset);
            if(useHttps(request)) {
                log.log(Level.WARNING,"Changing request scheme to https.");
                redirectPrefix = redirectPrefix.replace("http:","https:");
            }
        }
        return redirectPrefix;
    }

    private static boolean useHttps(HttpServletRequest request) {
        String protocolProperty = System.getProperty("admin.protocol", System.getenv("admin.protocol"));
        
        String protoHeader = request.getHeader("X-Forwarded-Proto");
        return request.isSecure() || (protoHeader != null && protoHeader.toLowerCase().equals("https")) 
            || (protocolProperty != null && protocolProperty.toLowerCase().equals("https"));
    }
}

Showcase unavailable

Good day,

Great template!

The showcase is unavailable, i tried the openshift and github urls.

Thanks

Java EE 6 Support

Java EE 6 servers are throwing the following error:

javax.faces.FacesException: RemoteCommand 'clearBreadCrumbs'must be inside a form.
	org.primefaces.component.remotecommand.RemoteCommandRenderer.encodeEnd(RemoteCommandRenderer.java:61)
	javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:877)
	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1826)
	javax.faces.component.UIComponent.encodeAll(UIComponent.java:1822)
	com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:447)
	com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
	javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
	javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
	com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
	com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
	com.github.adminfaces.template.filter.AdminFilter.doFilter(AdminFilter.java:92)

The component is declared inside a form.

Disable AdminFilter

Hello, I has a problem with Admin Filter (com.github.adminfaces.template.session.Admin Filter ) because the atributes adminConfig and adminSession does not injected right. Please can you validate if these atributes are nulls and automatically set disableFilter in true. I use Spring Boot and JSF.

I show you the exception that I have gotten:

java.lang.NullPointerException: null
at com.github.adminfaces.template.session.AdminFilter.init(AdminFilter.java:48) ~[admin-template-1.0.0-RC9.jar:na]
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285) ~[catalina.jar:8.5.16]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266) ~[catalina.jar:8.5.16]
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108) ~[catalina.jar:8.5.16]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4590) [catalina.jar:8.5.16]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5233) [catalina.jar:8.5.16]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.5.16]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) [catalina.jar:8.5.16]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) [catalina.jar:8.5.16]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

Don't work in Tomcat 8

In Tomcat 8 have this error:

17-Jan-2018 18:16:58.065 SEVERE [http-nio-8084-exec-200] null.null Critical error during deployment:
java.lang.NoClassDefFoundError: Could not initialize class org.omnifaces.config.BeanManager
at org.omnifaces.application.OmniApplication.(OmniApplication.java:69)
at org.omnifaces.application.OmniApplicationFactory.createOmniApplication(OmniApplicationFactory.java:89)
at org.omnifaces.application.OmniApplicationFactory.getApplication(OmniApplicationFactory.java:54)
at com.sun.faces.application.InjectionApplicationFactory.getApplication(InjectionApplicationFactory.java:93)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:144)

and versions of showcase and starter in Tomcat no work too (in my environment).
additional config is need?

Te pregunto en español que es mas cercano al portugués.
No me anda en Tomcat, existen instrucciones de uso especiales para Tomcat?
Solo pude hacer andar el showcase en Glassfish, uso Netbeans para desarrollar.

Try start with swarm but dont working

I am using apache-maven-3.5.4

mvn wildfly-swarm:run -Pswarm
....
[INFO]
[INFO] ----------------< com.github.adminfaces:admin-showcase >----------------
[INFO] Building admin-showcase 1.0.0-RC18
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
.
[INFO] Starting .war
Thu Aug 16 00:54:30 BRT 2018 INFO [org.wildfly.swarm.bootstrap] (main) Dependencies not bundled; resolving from M2REPO.
2018-08-16 00:54:30,982 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Logging - STABLE org.wildfly.swarm:logging:2017.5.0
2018-08-16 00:54:30,991 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: JCA - STABLE org.wildfly.swarm:jca:2017.5.0
2018-08-16 00:54:30,991 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Bean Validation - STABLE org.wildfly.swarm:bean-validation:2017.5.0
2018-08-16 00:54:30,992 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: CDI Configuration - STABLE org.wildfly.swarm:cdi-config:2017.5.0
2018-08-16 00:54:30,994 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Transactions - STABLE org.wildfly.swarm:transactions:2017.5.0
2018-08-16 00:54:30,995 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: EJB - STABLE org.wildfly.swarm:ejb:2017.5.0
2018-08-16 00:54:30,995 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: CDI - STABLE org.wildfly.swarm:cdi:2017.5.0
2018-08-16 00:54:30,996 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: Undertow - STABLE org.wildfly.swarm:undertow:2017.5.0
2018-08-16 00:54:30,996 INFO [org.wildfly.swarm] (main) WFSWARM0013: Installed fraction: JSF - STABLE org.wildfly.swarm:jsf:2017.5.0
2018-08-16 00:54:33,914 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
2018-08-16 00:54:34,033 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0049: WildFly Swarm 2017.5.0 (WildFly Core 2.2.1.Final) starting
2018-08-16 00:54:34,123 INFO [org.wildfly.swarm] (MSC service thread 1-8) WFSWARM0019: Install MSC service for command line args: []
2018-08-16 00:54:35,124 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("parallel-extension-add") failed - address: ([]): java.lang.RuntimeException: WFLYCTL0079: Failed initializing module org.jboss.as.ejb3
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:115)
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:890)
at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:659)
at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:370)
at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1322)
at org.jboss.as.controller.ModelControllerImpl.boot(ModelControllerImpl.java:468)
at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:387)
at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:349)
at org.jboss.as.server.ServerService.boot(ServerService.java:397)
at org.jboss.as.server.ServerService.boot(ServerService.java:366)
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:299)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: org.jboss.modules.ModuleLoadException: Error loading module from modules/org/jboss/metadata/ejb/main/module.xml
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$1.execute(ParallelExtensionAddHandler.java:107)
... 11 more
Caused by: java.lang.RuntimeException: org.jboss.modules.ModuleLoadException: Error loading module from modules/org/jboss/metadata/ejb/main/module.xml
at org.wildfly.swarm.bootstrap.modules.BootstrapClasspathModuleFinder.findModule(BootstrapClasspathModuleFinder.java:85)
at org.jboss.modules.ModuleLoader.findModule(ModuleLoader.java:439)
at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:342)
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:289)
at org.jboss.modules.Module.addPaths(Module.java:1079)
at org.jboss.modules.Module.link(Module.java:1449)
at org.jboss.modules.Module.relinkIfNecessary(Module.java:1477)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:225)
at org.jboss.modules.Module.loadServiceFromCallerModuleLoader(Module.java:406)
at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:120)
at org.jboss.as.controller.extension.ExtensionAddHandler.initializeExtension(ExtensionAddHandler.java:104)
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:144)
at org.jboss.as.controller.extension.ParallelExtensionAddHandler$ExtensionInitializeTask.call(ParallelExtensionAddHandler.java:127)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: org.jboss.modules.ModuleLoadException: Error loading module from modules/org/jboss/metadata/ejb/main/module.xml
at org.jboss.modules.xml.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:228)
at org.wildfly.swarm.bootstrap.modules.BootstrapClasspathModuleFinder.findModule(BootstrapClasspathModuleFinder.java:61)
... 17 more
Caused by: org.jboss.modules.xml.XmlPullParserException: Failed to add artifact 'org.jboss.metadata:jboss-metadata-ejb:10.0.0.Final' (position: END_TAG seen ...tifact name="org.jboss.metadata:jboss-metadata-ejb:10.0.0.Final"/>... @7:74) caused by: java.util.zip.ZipException: error in opening zip file
at org.jboss.modules.xml.ModuleXmlParser.parseArtifact(ModuleXmlParser.java:836)
at org.jboss.modules.xml.ModuleXmlParser.parseResources(ModuleXmlParser.java:739)
at org.jboss.modules.xml.ModuleXmlParser.parseModuleContents(ModuleXmlParser.java:535)
at org.jboss.modules.xml.ModuleXmlParser.parseDocument(ModuleXmlParser.java:340)
at org.jboss.modules.xml.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:226)
... 18 more

2018-08-16 00:54:35,167 FATAL [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
2018-08-16 00:54:35,205 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
2018-08-16 00:54:35,205 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2018-08-16 00:54:35,205 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2018-08-16 00:54:35,206 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2018-08-16 00:54:35,206 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2018-08-16 00:54:35,206 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:39)
2018-08-16 00:54:35,206 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.main(MainInvoker.java:70)
2018-08-16 00:54:35,206 ERROR [stderr] (main) Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: Operation failed
2018-08-16 00:54:35,207 ERROR [stderr] (main) at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:45)
2018-08-16 00:54:35,207 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:109)
2018-08-16 00:54:35,207 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.start(Swarm.java:369)
2018-08-16 00:54:35,207 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:623)
2018-08-16 00:54:35,207 ERROR [stderr] (main) ... 6 more
2018-08-16 00:54:35,208 ERROR [stderr] (main) Caused by: java.util.concurrent.ExecutionException: Operation failed
2018-08-16 00:54:35,208 ERROR [stderr] (main) at org.jboss.threads.AsyncFutureTask.operationFailed(AsyncFutureTask.java:74)
2018-08-16 00:54:35,208 ERROR [stderr] (main) at org.jboss.threads.AsyncFutureTask.get(AsyncFutureTask.java:268)
2018-08-16 00:54:35,208 ERROR [stderr] (main) at org.jboss.as.server.SelfContainedContainer.start(SelfContainedContainer.java:148)
2018-08-16 00:54:35,209 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeServer.start(RuntimeServer.java:202)
2018-08-16 00:54:35,209 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeServer$Proxy$_$$_WeldClientProxy.start(Unknown Source)
2018-08-16 00:54:35,209 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.lambda$bootstrap$1(ServerBootstrapImpl.java:152)
2018-08-16 00:54:35,209 ERROR [stderr] (main) at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:43)
2018-08-16 00:54:35,214 ERROR [stderr] (main) ... 9 more
2018-08-16 00:54:35,269 ERROR [stderr] (main) Caused by: java.lang.Exception: WFLYSRV0056: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
2018-08-16 00:54:35,269 ERROR [stderr] (main) at org.jboss.as.server.BootstrapListener.bootFailure(BootstrapListener.java:87)
2018-08-16 00:54:35,269 ERROR [stderr] (main) at org.jboss.as.server.ServerService.boot(ServerService.java:384)
2018-08-16 00:54:35,269 ERROR [stderr] (main) at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:299)
2018-08-16 00:54:35,269 ERROR [stderr] (main) at java.lang.Thread.run(Thread.java:748)
2018-08-16 00:54:35,333 INFO [org.jboss.as] (MSC service thread 1-4) WFLYSRV0050: WildFly Swarm 2017.5.0 (WildFly Core 2.2.1.Final) stopped in 47ms

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.172 s
[INFO] Finished at: 2018-08-16T00:54:35-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.wildfly.swarm:wildfly-swarm-plugin:2017.5.0:run (default-cli) on project admin-showcase: Process failed to start -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Migrate to OpenShift V3

Openshift v2, where the showcase is deployed now, will be shutdown by the end of the month, deploy the showcase into OpenShift v3.

Work with differet url-pattern

I have added this line on my web.xml

Faces Servlet
.htm

Faces Servlet
.htm

That means that my pages are loaded with the extension .htm and not .xhtml. I was trying to show 404 error but it wont show it with .xhtml properly. check this two images.
screenshot from 2018-02-22 22-47-33
screenshot from 2018-02-22 22-46-59

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.