Skip to content

Commit

Permalink
Updated to new design template.
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthree committed Sep 29, 2014
1 parent 3421e0d commit 650adce
Show file tree
Hide file tree
Showing 51 changed files with 8,099 additions and 4,769 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

import javax.servlet.ServletContext;

import org.ocpsoft.logging.Logger.Level;
import org.ocpsoft.rewrite.annotation.RewriteConfiguration;
import org.ocpsoft.rewrite.config.Configuration;
import org.ocpsoft.rewrite.config.ConfigurationBuilder;
import org.ocpsoft.rewrite.config.Direction;
import org.ocpsoft.rewrite.config.Log;
import org.ocpsoft.rewrite.servlet.config.DispatchType;
import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;
import org.ocpsoft.rewrite.servlet.config.Path;
Expand Down Expand Up @@ -57,25 +59,36 @@ public Configuration getConfiguration(ServletContext context)
.and(Path.matches("/{p}.xhtml"))
.and(Resource.exists("/{p}.xhtml"))
.andNot(ServletMapping.includes("/{p}")))
.perform(SendStatus.error(404))
.perform(Log.message(Level.INFO, "Blocked direct file access to {p}").and(SendStatus.error(404)))
.where("p").matches(".*")

/*
* Application Routes
*/
.addRule(Join.path("/{p}/").to("/faces/{p}/index.xhtml").withChaining())
.when(Resource.exists("/{p}/index.xhtml"))
.perform(Log.message(Level.INFO, "Joined path /{p}/ to /faces/{p}/index.xhtml"))
.where("p").matches(".*")

.addRule(Join.path("/{p}").to("/faces/{p}.xhtml").withChaining())
.when(Resource.exists("/{p}.xhtml"))
.perform(Log.message(Level.INFO, "Joined path /{p} to /faces/{p}.xhtml"))
.where("p").matches(".*")

.addRule()
.when(DispatchType.isRequest().and(Direction.isInbound())
.and(RequestParameter.exists("ticket")).and(Path.matches("/auth")))
.perform(Redirect.temporary(context.getContextPath()))

/*
* Resources routes
*/
.addRule(Join.path("/faces/images/{p}").to("/faces/javax.faces.resource/{p}?ln=images"))
.when(Resource.exists("/resources/images/{p}"))
.perform(Log.message(Level.INFO,
"Joined path /faces/images/{p} to /faces/javax.faces.resource/{p}?ln=images"))
.where("p").matches(".*")

;
}

Expand Down
20 changes: 20 additions & 0 deletions src/main/java/org/jboss/forge/website/view/DocumentBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -46,6 +47,8 @@ public class DocumentBean implements Serializable

private List<Document> documents;
private String searchQuery;

private Category category;
private Set<Category> categoryFilter;
private List<Category> categories = Arrays.asList(Category.QUICKSTART, Category.TUTORIAL, Category.ADVANCED);

Expand All @@ -54,6 +57,13 @@ public void load()
List<Document> result = new ArrayList<>();
List<Document> documents = service.getAllDocuments();

if (category != null)
{
if (categoryFilter == null)
categoryFilter = new HashSet<>();
categoryFilter.add(category);
}

for (Document document : documents)
{
if (Strings.isNullOrEmpty(searchQuery)
Expand Down Expand Up @@ -222,4 +232,14 @@ public void setRelatedDocuments(List<Document> relatedDocuments)
{
this.relatedDocuments = relatedDocuments;
}

public Category getCategory()
{
return category;
}

public void setCategory(Category category)
{
this.category = category;
}
}
98 changes: 49 additions & 49 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>website</display-name>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<mime-mapping>
<extension>ico</extension>
<mime-type>image/icon</mime-type>
</mime-mapping>
<context-param>
<param-name>org.ocpsoft.rewrite.config.CONFIG_RELOADING</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>Needed to avoid ViewExpiredExceptions</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/faces/404.xhtml</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/faces/error.xhtml</location>
</error-page>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/faces/error.xhtml</location>
</error-page>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<env-entry>
<description>Needed for JSF 2.2</description>
<env-entry-name>jsf/ClientSideSecretKey</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>am9kZXRlcHV0b2hhY2tlcg==</env-entry-value>
</env-entry>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>website</display-name>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<description>Needed to avoid ViewExpiredExceptions</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>org.ocpsoft.rewrite.config.CONFIG_RELOADING</param-name>
<param-value>false</param-value>
</context-param>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<mime-mapping>
<extension>ico</extension>
<mime-type>image/icon</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/faces/404.xhtml</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/faces/error.xhtml</location>
</error-page>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/faces/error.xhtml</location>
</error-page>
<env-entry>
<description>Needed for JSF 2.2</description>
<env-entry-name>jsf/ClientSideSecretKey</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>am9kZXRlcHV0b2hhY2tlcg==</env-entry-value>
</env-entry>
</web-app>
2 changes: 2 additions & 0 deletions src/main/webapp/documentation.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://xmlns.jcp.org/jsf/passthrough" template="/resources/scaffold/mainTemplate.xhtml">
<f:metadata>
<f:viewParam name="search" value='#{documentBean.searchQuery}'/>
<f:viewParam name="category" value='#{documentBean.category}'/>
<f:event type="preRenderView" listener='#{documentBean.load}' />
</f:metadata>
<ui:param name="pageTitle" value="Documentation | JBoss Forge" />
Expand Down
Loading

0 comments on commit 650adce

Please sign in to comment.