V 4.1, fixes to resource issues
This commit is contained in:
parent
56aa5e0e60
commit
40c7e392f0
|
@ -112,3 +112,8 @@ force
|
||||||
### Developer/deployer note. Because of caching, updated installations
|
### Developer/deployer note. Because of caching, updated installations
|
||||||
may not render properly. Manually request the "/main.xtml" resource
|
may not render properly. Manually request the "/main.xtml" resource
|
||||||
and that should flush out stale info being used by "/main.jsf".
|
and that should flush out stale info being used by "/main.jsf".
|
||||||
|
|
||||||
|
Followup: Excess payloads were being added to the welcome page
|
||||||
|
that caused HTTP "400" errors fetching resources. A fix has
|
||||||
|
been made, although the ultimate solution will probably be more
|
||||||
|
JSF-friendly.
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<groupId>com.mousetech.gourmet</groupId>
|
<groupId>com.mousetech.gourmet</groupId>
|
||||||
<artifactId>gourmetj</artifactId>
|
<artifactId>gourmetj</artifactId>
|
||||||
<version>0.2.0</version>
|
<version>0.2.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>GourmetJ</name>
|
<name>GourmetJ</name>
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class SpringPrimeFacesApplication {
|
||||||
|
|
||||||
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 error400Page = "/error/error400.jsp";
|
||||||
final String expiredPage = "/main.xhtml";
|
final String expiredPage = "/main.xhtml";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -62,8 +63,10 @@ public class SpringPrimeFacesApplication {
|
||||||
registry.addErrorPages(new ErrorPage(
|
registry.addErrorPages(new ErrorPage(
|
||||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
errorPage));
|
errorPage));
|
||||||
}
|
registry.addErrorPages(new ErrorPage(
|
||||||
|
HttpStatus.BAD_REQUEST,
|
||||||
|
error400Page));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,10 @@ public class SpringSecurityConfig {
|
||||||
http
|
http
|
||||||
.csrf(AbstractHttpConfigurer::disable)
|
.csrf(AbstractHttpConfigurer::disable)
|
||||||
.cors(AbstractHttpConfigurer::disable)
|
.cors(AbstractHttpConfigurer::disable)
|
||||||
.formLogin(Customizer.withDefaults())
|
.formLogin(formLogin ->
|
||||||
|
formLogin
|
||||||
|
.loginPage("/login.xhtml")
|
||||||
|
.permitAll())
|
||||||
.authorizeHttpRequests((authorize)-> authorize
|
.authorizeHttpRequests((authorize)-> authorize
|
||||||
.dispatcherTypeMatchers(DispatcherType.FORWARD, DispatcherType.ERROR).permitAll()
|
.dispatcherTypeMatchers(DispatcherType.FORWARD, DispatcherType.ERROR).permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
|
@ -121,10 +124,11 @@ public class SpringSecurityConfig {
|
||||||
@Bean
|
@Bean
|
||||||
public WebSecurityCustomizer webSecurityCustomizer() {
|
public WebSecurityCustomizer webSecurityCustomizer() {
|
||||||
return (web) -> web.ignoring().requestMatchers(
|
return (web) -> web.ignoring().requestMatchers(
|
||||||
"/javax.faces.resource/**",
|
"/jakarta.faces.resource/**",
|
||||||
|
"/index.xhtml",
|
||||||
"/",
|
"/",
|
||||||
"/index.jsf",
|
"/index.jsf",
|
||||||
"/index.xhtml",
|
"/login",
|
||||||
"/main.jsf",
|
"/main.jsf",
|
||||||
"/img/**",
|
"/img/**",
|
||||||
"/recipeDetails.jsf",
|
"/recipeDetails.jsf",
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class WelcomePageRedirect implements WebMvcConfigurer {
|
||||||
@Override
|
@Override
|
||||||
public void addViewControllers(ViewControllerRegistry registry) {
|
public void addViewControllers(ViewControllerRegistry registry) {
|
||||||
registry.addViewController("/")
|
registry.addViewController("/")
|
||||||
.setViewName("forward:/index.xhtml");
|
.setViewName("forward:/index.html");
|
||||||
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
src/main/resources/META-INF/resources/error/error400.jsp
Normal file
12
src/main/resources/META-INF/resources/error/error400.jsp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<%@ page language="java" contentType="text/html; charset=US-ASCII"
|
||||||
|
pageEncoding="US-ASCII" isErrorPage="true"%>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||||
|
<title>Error 400 Page - Bad request</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<font color="red">Error: exception.getMessage() </font><br>
|
||||||
|
</body>
|
||||||
|
</html>
|
24
src/main/resources/META-INF/resources/index.html
Normal file
24
src/main/resources/META-INF/resources/index.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||||
|
xmlns:p="http://primefaces.org/ui"
|
||||||
|
>
|
||||||
|
<h:head>Gourmet Recipe Manager</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h1>Gourmet Recipe Manager</h1>
|
||||||
|
<p>This is an implementation of Thomas Hinkle's
|
||||||
|
Gourmet Recipe Manager, originally a desktop
|
||||||
|
application but now available as a Java Web
|
||||||
|
application.</p>
|
||||||
|
<p><a href="main.jsf">
|
||||||
|
Go to Main Page</a></p>
|
||||||
|
<hr/>
|
||||||
|
<p>Copyright © 2021, 2024 Tim Holloway. All Rights Reserved.
|
||||||
|
<p>This is an open-source application under the
|
||||||
|
Common Development and Distribution License (CDDL).
|
||||||
|
</p>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<ui:composition template="/WEB-INF/layout/layout.xhtml"
|
|
||||||
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
|
||||||
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
|
||||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
|
||||||
xmlns:p="http://primefaces.org/ui"
|
|
||||||
xmlns:c="http://xmlns.jcp.org/jstl"
|
|
||||||
>
|
|
||||||
<!-- Print Recipe -->
|
|
||||||
<ui:define name="title">Gourmet Recipe Manager</ui:define>
|
|
||||||
<ui:define name="content">
|
|
||||||
<h:form id="printForm">
|
|
||||||
<h:messages />
|
|
||||||
<p>This is an implementation of Thomas Hinkle's
|
|
||||||
Gourmet Recipe Manager, originally a desktop
|
|
||||||
application but now available as a Java Web
|
|
||||||
application.</p>
|
|
||||||
<h:outputLink
|
|
||||||
value="/main.jsf"
|
|
||||||
>Go to Main Page</h:outputLink>
|
|
||||||
</h:form>
|
|
||||||
<div style="height: 20px">
|
|
||||||
<h:outputText value="" />
|
|
||||||
</div>
|
|
||||||
</ui:define>
|
|
||||||
</ui:composition>
|
|
31
src/main/resources/META-INF/resources/login.xhtml
Normal file
31
src/main/resources/META-INF/resources/login.xhtml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:p="http://primefaces.org/ui"
|
||||||
|
xmlns:pe="http://primefaces.org/ui/extensions">
|
||||||
|
|
||||||
|
<h:head>
|
||||||
|
<title>Login</title>
|
||||||
|
<h:outputStylesheet name="/css/login.css" />
|
||||||
|
</h:head>
|
||||||
|
|
||||||
|
<h:body>
|
||||||
|
<h:form prependId="false">
|
||||||
|
|
||||||
|
<p:panelGrid columns="1" styleClass="ui-fluid center ui-noborder">
|
||||||
|
<h2>Please login</h2>
|
||||||
|
|
||||||
|
<p:outputLabel value="Login failed!" styleClass="red"
|
||||||
|
rendered="${!empty param['error']}" />
|
||||||
|
|
||||||
|
<p:inputText id="username" placeholder="User name" />
|
||||||
|
<p:password id="password" placeholder="Password" />
|
||||||
|
|
||||||
|
<p:commandButton value="Login" ajax="false" />
|
||||||
|
</p:panelGrid>
|
||||||
|
|
||||||
|
</h:form>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user