Skip to content

Commit ab0e496

Browse files
committed
add empty UrlBasedViewResolver to resolve "redirect:" URLs
1 parent b178679 commit ab0e496

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

src/main/java/alfio/config/MvcConfiguration.java

+10
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@
3838
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
3939
import org.springframework.web.servlet.HandlerInterceptor;
4040
import org.springframework.web.servlet.ModelAndView;
41+
import org.springframework.web.servlet.ViewResolver;
4142
import org.springframework.web.servlet.config.annotation.*;
4243
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
44+
import org.springframework.web.servlet.view.AbstractUrlBasedView;
45+
import org.springframework.web.servlet.view.UrlBasedViewResolver;
4346

4447
import javax.servlet.http.HttpServletRequest;
4548
import javax.servlet.http.HttpServletResponse;
@@ -149,4 +152,11 @@ public ObjectMapper objectMapper() {
149152
public CommonsMultipartResolver multipartResolver() {
150153
return new CommonsMultipartResolver();
151154
}
155+
156+
@Bean
157+
public ViewResolver viewResolver() {
158+
var resolver = new UrlBasedViewResolver();
159+
resolver.setViewClass(AbstractUrlBasedView.class);
160+
return resolver;
161+
}
152162
}

src/main/java/alfio/manager/payment/StripeConnectManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public StripeConnectURL getConnectURL(int organizationId) {
6666
var options = configurationManager.getFor(Set.of(STRIPE_SECRET_KEY, STRIPE_CONNECT_CLIENT_ID, STRIPE_CONNECT_CALLBACK, BASE_URL), ConfigurationLevel.organization(organizationId));
6767
String secret = options.get(STRIPE_SECRET_KEY).getRequiredValue();
6868
String clientId = options.get(STRIPE_CONNECT_CLIENT_ID).getRequiredValue();
69-
String callbackURL = options.get(STRIPE_CONNECT_CALLBACK).getValueOrDefault(options.get(BASE_URL).getRequiredValue()) + CONNECT_REDIRECT_PATH;
69+
String callbackURL = options.get(STRIPE_CONNECT_CALLBACK).getValueOrDefault(options.get(BASE_URL).getRequiredValue() + CONNECT_REDIRECT_PATH);
7070
String state = extensionManager.generateStripeConnectStateParam(organizationId).orElse(UUID.randomUUID().toString());
7171
String code = UUID.randomUUID().toString();
7272
OAuthConfig config = new OAuthConfig(clientId, secret, callbackURL, "read_write", null, state, "code", null, null, null);
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="initial-scale=1, minimum-scale=1, width=device-width">
6+
<title>Error 400</title>
7+
<style>
8+
body {background-color: #e5e5e5;font-family:sans-serif}
9+
@media (min-width: 1200px) {.container {width: 960px;}}
10+
@media (min-width: 576px) {.container {max-width: 100%;}}
11+
@media (min-width: 1200px) {.container {max-width: 1140px;}}
12+
@media (min-width: 992px) {.container {max-width: 960px;}}
13+
@media (min-width: 768px) {.container {max-width: 720px;}}
14+
@media (min-width: 576px) {.container {max-width: 540px;}}
15+
.container {
16+
width: 100%;
17+
padding: 15px;
18+
margin-right: auto;
19+
margin-left: auto;
20+
background-color: white;
21+
}
22+
*, ::after, ::before {
23+
box-sizing: border-box;
24+
}
25+
.img-responsive {
26+
display: block;
27+
max-width: 100%;
28+
height: auto;
29+
}
30+
</style>
31+
</head>
32+
<body>
33+
<div class="container">
34+
<img class="img-responsive" src="/resources/images/error-picard-riker.jpg">
35+
<div>
36+
<h1>D'oh!</h1>
37+
<h2>Error 400</h2>
38+
<p>An unexpected error has occurred. Please report the issue to the organizers.</p>
39+
</div>
40+
</div>
41+
</body>
42+
</html>

0 commit comments

Comments
 (0)