Compare commits

...

3 Commits

  1. 16
      README.md
  2. 16
      application.properties
  3. 34
      pom.xml
  4. 4
      src/main/java/com/mousetech/gourmetj/SpringPrimeFacesApplication.java
  5. 12
      src/main/java/com/mousetech/gourmetj/persistence/model/Recipe.java
  6. 4
      src/main/resources/META-INF/resources/WEB-INF/faces-config.xml
  7. 2
      src/main/resources/META-INF/resources/detailEdit.xhtml
  8. 2
      src/main/resources/META-INF/resources/error/viewExpired.xhtml
  9. 3
      src/main/resources/META-INF/resources/recipeDetails.xhtml
  10. 23
      src/main/resources/application.yml

@ -70,3 +70,19 @@ so you must use an existing copy of a ``recipes.db`` file.
## Note on JavaServer Faces ## Note on JavaServer Faces
The Spring Boot version supersedes a previous port based on the Apache Tobago JSF tag library. It uses the PrimeFaces JSF tag library, as presently that platform has better Spring Boot support. Plus Tobago is quite different from most of the The Spring Boot version supersedes a previous port based on the Apache Tobago JSF tag library. It uses the PrimeFaces JSF tag library, as presently that platform has better Spring Boot support. Plus Tobago is quite different from most of the
extension tag libraries to the point where it almost isn't JSF. extension tag libraries to the point where it almost isn't JSF.
## New in Version 2.0
### Database change
The backing database as defined in the project is now MySQL
instead of SQLite. The SQLite JDBC driver may have been a bit
casual about a few things compared to MySQL. The JPA should work
for either database now, although it should be noted that SQLite
isn't really intended for multi-user webapps and should only be
employed when you run this app on your local desktop.
### Improved graphics support
A lot of recipe websites publish images in webp form. Support
for webp has now been added.

@ -1,4 +1,6 @@
# THIS is the application properties used when testing in the IDE
# The application.yml (production) is ignored.
#joinfaces.jsf.project-stage=development #joinfaces.jsf.project-stage=development
# They lied. This doesn't work: # They lied. This doesn't work:
joinfaces.primefaces.theme=cupertino joinfaces.primefaces.theme=cupertino
@ -6,16 +8,20 @@ joinfaces.jsf.webapp-resources-directory=/resources
# This works. Note that ONLY THE FIRST theme set will work unless # This works. Note that ONLY THE FIRST theme set will work unless
# you delete the old primefaces.THEME from ServletContext # you delete the old primefaces.THEME from ServletContext
server.servlet.context-parameters.primefaces.THEME=omega server.servlet.context-parameters.primefaces.THEME=omega
server.servlet.session.timeout=30m
spring.thymeleaf.enabled=false spring.thymeleaf.enabled=false
server.error.whitelabel.enabled=false server.error.whitelabel.enabled=false
spring.datasource.url=jdbc:sqlite:${home}/recipes.db spring.datasource.url=jdbc:mysql://dbase/recipes
#spring.datasource.username=dbuser #jdbc:sqlite:${home}/recipes.db
#pring.datasource.password=dbpass spring.datasource.username=recipes
spring.datasource.driverClassName=org.sqlite.JDBC pring.datasource.password=yumyumyum
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
#org.sqlite.JDBC
#spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect #spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
spring.jpa.database-platform=org.sqlite.hibernate.dialect.SQLiteDialect spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
#org.sqlite.hibernate.dialect.SQLiteDialect
#spring.jpa.show-sql: true #spring.jpa.show-sql: true
# My special properties # My special properties

@ -108,6 +108,40 @@
<artifactId>javax.el</artifactId> <artifactId>javax.el</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-core -->
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-core</artifactId>
<version>3.8.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-webp -->
<!-- In Core??? -->
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-webp</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
<!-- Needed only if you deploy ImageIO plugins as part of a web app.
Make sure you add the IIOProviderContextListener to your web.xml.
-->
<dependency>
<groupId>com.twelvemonkeys.servlet</groupId>
<artifactId>servlet</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>
<!-- MySQL DB -->
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.30</version>
</dependency>
<!-- SQLite DB -->
<dependency> <dependency>
<groupId>org.xerial</groupId> <groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId> <artifactId>sqlite-jdbc</artifactId>

@ -21,6 +21,8 @@ import org.springframework.http.HttpStatus;
"com.mousetech.gourmetj.persistence.model" }) "com.mousetech.gourmetj.persistence.model" })
public class SpringPrimeFacesApplication { public class SpringPrimeFacesApplication {
private static final String IMAGE_IIO_PROVIDER_CONTEXT_LISTENER =
"com.twelvemonkeys.servlet.image.IIOProviderContextListener";
final String errorPage = "/error/error.html"; final String errorPage = "/error/error.html";
final String error404Page = "/error/error404.html"; final String error404Page = "/error/error404.html";
final String expiredPage = "/error/viewExpired.xhtml"; final String expiredPage = "/error/viewExpired.xhtml";
@ -49,6 +51,8 @@ public class SpringPrimeFacesApplication {
"com.sun.el.ExpressionFactoryImpl"); "com.sun.el.ExpressionFactoryImpl");
servletContext.setInitParameter( servletContext.setInitParameter(
"primefaces.UPLOADER", "native"); "primefaces.UPLOADER", "native");
servletContext.addListener(IMAGE_IIO_PROVIDER_CONTEXT_LISTENER);
} }
}; };
} }

@ -73,7 +73,7 @@ public class Recipe implements Serializable {
private Integer rating; private Integer rating;
@Column(name = "recipe_hash") @Column(name = "recipe_hash")
private Long recipeHash; private String recipeHash;
@Column(name = "servings") @Column(name = "servings")
private Double servings; private Double servings;
@ -88,7 +88,7 @@ public class Recipe implements Serializable {
private String title; private String title;
@Column(name = "yield_unit") @Column(name = "yield_unit")
private Integer yieldUnit; private String yieldUnit;
@Column(name = "yields") @Column(name = "yields")
private Double yields; private Double yields;
@ -211,11 +211,11 @@ public class Recipe implements Serializable {
this.rating = rating; this.rating = rating;
} }
public Long getRecipeHash() { public String getRecipeHash() {
return this.recipeHash; return this.recipeHash;
} }
public void setRecipeHash(Long recipeHash) { public void setRecipeHash(String recipeHash) {
this.recipeHash = recipeHash; this.recipeHash = recipeHash;
} }
@ -251,11 +251,11 @@ public class Recipe implements Serializable {
this.title = title; this.title = title;
} }
public Integer getYieldUnit() { public String getYieldUnit() {
return this.yieldUnit; return this.yieldUnit;
} }
public void setYieldUnit(Integer yieldUnit) { public void String(String yieldUnit) {
this.yieldUnit = yieldUnit; this.yieldUnit = yieldUnit;
} }

@ -21,11 +21,11 @@
<navigation-rule> <navigation-rule>
<description>Global Navigation</description> <description>Global Navigation</description>
<display-name>Navigation</display-name> <display-name>Navigation</display-name>
<from-view-id>/*</from-view-id> <from-view-id>*</from-view-id>
<navigation-case> <navigation-case>
<description>Go Home</description> <description>Go Home</description>
<from-outcome>home</from-outcome> <from-outcome>home</from-outcome>
<to-view-id>/main.xhtml</to-view-id> <to-view-id>/main</to-view-id>
<redirect /> <redirect />
</navigation-case> </navigation-case>
</navigation-rule> </navigation-rule>

@ -154,7 +154,7 @@
update=":messages picPanel" update=":messages picPanel"
auto="true" auto="true"
sizeLimit="1000000" sizeLimit="1000000"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" allowTypes="/(\.|\/)(gif|jpe?g|png|webp)$/"
/> />
<p:commandButton id="ctlDelImg" <p:commandButton id="ctlDelImg"
value="Delete Image" value="Delete Image"

@ -11,7 +11,7 @@
<h2>View Expired.</h2> <h2>View Expired.</h2>
<h:form> <h:form>
The user session has timed out. Return to main page. The user session has timed out. Return to main page.
<h:commandButton value="OK" action="/main.jsf"></h:commandButton> <h:commandButton value="OK" action="home"></h:commandButton>
</h:form> </h:form>
</h:body> </h:body>
</html> </html>

@ -44,10 +44,11 @@
<p:panelGrid id="pnlDetails" <p:panelGrid id="pnlDetails"
columns="2" columns="2"
> >
<!-- TODO: ask if we should save -->
<p:commandButton value="Back" <p:commandButton value="Back"
ajax="false" ajax="false"
icon="ui-icon-arrowthick-1-w" icon="ui-icon-arrowthick-1-w"
action="main.jsf" action="home"
immediate="true" immediate="true"
/> />
<p:commandButton ajax="false" <p:commandButton ajax="false"

@ -1,14 +1,31 @@
# #
# Application YML is used in production. /application.properties # Application YML is used in production, filed under /BOOT-INF/classes.
# application.properties in the project root (working dir)
# is used in test. # is used in test.
# #
# application config in execution current directory or ./config
# have higher precedence, and the command line is ultimate:
#
# https://docs.spring.io/spring-boot/docs/2.1.9.RELEASE/reference/html/boot-features-external-config.html
#
spring: spring:
datasource: datasource:
url: jdbc:sqlite:${home}/recipes.db #url: jdbc:sqlite:${home}/recipes.db
url: jdbc:mysql:dbase/recipes
# options: ${env} values
driverClassName: org.mysql.jdbc.Driver
username: recipes
password: yumyumyum
jpa: jpa:
hibernate: hibernate:
ddl-auto: none ddl-auto: none
database-platform: org.sqlite.hibernate.dialect.SQLiteDialect #database-platform: org.sqlite.hibernate.dialect.SQLiteDialect
database-platform: org.hibernate.dialect.MySQLDialect
server:
servlet:
session:
timeout: '30m'
gourmet: gourmet:
password: password:

Loading…
Cancel
Save