@xiangyang9999/folib-server-sync-a8be7ecd6f05 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -2
- package/bin/folib-commit-sync.js +70 -0
- package/package.json +22 -4
- package/payload/INSTRUCTIONS.docx +0 -0
- package/payload/changes.patch +1538 -0
- package/payload/manifest.json +367 -0
- package/payload/manifest.sha256 +41 -0
- package/payload/source-files.zip +0 -0
- package/source/SECURITY_DEPENDENCY_UPGRADE.md +97 -0
- package/source/folib-client/pom.xml +160 -0
- package/source/folib-commons/folib-commons-core/pom.xml +297 -0
- package/source/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/ArchiveExtractionPaths.java +86 -0
- package/source/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/CompressUtils.java +148 -0
- package/source/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/ArchiveExtractionPathsTest.java +77 -0
- package/source/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/CompressUtilsTest.java +286 -0
- package/source/folib-commons/folib-commons-io/pom.xml +184 -0
- package/source/folib-data-service/pom.xml +259 -0
- package/source/folib-data-service/src/test/java/com/veadan/folib/config/hazelcast/HazelcastClusterCompatibilityTest.java +124 -0
- package/source/folib-rest-client/pom.xml +166 -0
- package/source/folib-security/folib-authentication-registry/pom.xml +117 -0
- package/source/folib-security/folib-security-api/pom.xml +416 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianGroupInterceptor.java +251 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianPackagesMetadataIndexer.java +72 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-docker-layout-provider/pom.xml +236 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-gitlfs-layout-provider/pom.xml +187 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-go-layout-provider/pom.xml +180 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-helm-layout-provider/pom.xml +125 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-huggingface-layout-provider/pom.xml +193 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-maven-metadata-api/pom.xml +101 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-storage-maven-layout-provider/pom.xml +179 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-npm-layout-provider/pom.xml +162 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-nuget-layout-provider/pom.xml +155 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-p2-layout-provider/pom.xml +116 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-php-layout-provider/pom.xml +170 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-pypi-layout-provider/pom.xml +278 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-raw-layout-provider/pom.xml +183 -0
- package/source/folib-web-core/pom.xml +1089 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/app/FolibSpringBootApplication.java +67 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/config/LegacySpringDataWebConfig.java +41 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/config/WebConfig.java +377 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/model/response/OhpmPublishRes.java +16 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/promotion/DockerParsePacketsUtil.java +202 -0
- package/source/folib-web-core/src/test/java/com/veadan/folib/config/LegacySpringDataWebConfigTest.java +75 -0
- package/source/folib-web-core/src/test/java/com/veadan/folib/config/WebConfigResourceHandlersTest.java +31 -0
- package/source/folib-web-core/src/test/java/com/veadan/folib/promotion/DockerArchiveExtractionTest.java +112 -0
- package/source/folib-web-core/src/test/java/com/veadan/folib/utils/DependencyCompatibilityTest.java +62 -0
package/source/folib-web-core/src/main/java/com/veadan/folib/app/FolibSpringBootApplication.java
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
package com.veadan.folib.app;
|
|
2
|
+
|
|
3
|
+
import com.veadan.folib.config.WebConfig;
|
|
4
|
+
import com.veadan.folib.config.LegacySpringDataWebConfig;
|
|
5
|
+
import com.veadan.folib.config.janusgraph.FolibCassandraEmbeddedProperties;
|
|
6
|
+
import com.veadan.folib.config.janusgraph.JanusGraphDbProfile;
|
|
7
|
+
import org.mybatis.spring.annotation.MapperScan;
|
|
8
|
+
import org.slf4j.Logger;
|
|
9
|
+
import org.slf4j.LoggerFactory;
|
|
10
|
+
import org.springframework.boot.ApplicationArguments;
|
|
11
|
+
import org.springframework.boot.SpringApplication;
|
|
12
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
13
|
+
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
|
14
|
+
import org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration;
|
|
15
|
+
import org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration;
|
|
16
|
+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
17
|
+
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
|
18
|
+
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
|
19
|
+
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
|
20
|
+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
21
|
+
import org.springframework.context.ConfigurableApplicationContext;
|
|
22
|
+
import org.springframework.context.annotation.Import;
|
|
23
|
+
import org.springframework.scheduling.annotation.EnableAsync;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @author Veadan
|
|
27
|
+
*/
|
|
28
|
+
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
|
|
29
|
+
HibernateJpaAutoConfiguration.class,
|
|
30
|
+
Neo4jDataAutoConfiguration.class,
|
|
31
|
+
CassandraAutoConfiguration.class,
|
|
32
|
+
SpringDataWebAutoConfiguration.class})
|
|
33
|
+
@Import({WebConfig.class, LegacySpringDataWebConfig.class})
|
|
34
|
+
@MapperScan(basePackages = {"com.veadan.folib.scanner.mapper", "com.veadan.folib.mapper"})
|
|
35
|
+
@EnableAsync
|
|
36
|
+
public class FolibSpringBootApplication {
|
|
37
|
+
|
|
38
|
+
private static final Logger logger = LoggerFactory.getLogger(FolibSpringBootApplication.class);
|
|
39
|
+
|
|
40
|
+
private static ConfigurableApplicationContext applicationContext;
|
|
41
|
+
|
|
42
|
+
public static void main(String[] args) {
|
|
43
|
+
if (System.getProperty(JanusGraphDbProfile.PROPERTY_PROFILE) == null) {
|
|
44
|
+
logger.info("JanusGraphDb profile not set, will use [{}] profile as default",
|
|
45
|
+
JanusGraphDbProfile.PROFILE_EMBEDDED);
|
|
46
|
+
|
|
47
|
+
System.setProperty(JanusGraphDbProfile.PROPERTY_PROFILE, JanusGraphDbProfile.PROFILE_EMBEDDED);
|
|
48
|
+
}
|
|
49
|
+
System.setProperty("sendCredentialsOverHttp", "true");
|
|
50
|
+
SpringApplication application = new SpringApplication(FolibSpringBootApplication.class);
|
|
51
|
+
application.setApplicationStartup(new BufferingApplicationStartup(1500));
|
|
52
|
+
applicationContext = application.run(args);
|
|
53
|
+
applicationContext.start();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public static void restart() {
|
|
57
|
+
ApplicationArguments args = applicationContext.getBean(ApplicationArguments.class);
|
|
58
|
+
|
|
59
|
+
Thread thread = new Thread(() -> {
|
|
60
|
+
applicationContext.close();
|
|
61
|
+
applicationContext = SpringApplication.run(FolibSpringBootApplication.class, args.getSourceArgs());
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
thread.setDaemon(false);
|
|
65
|
+
thread.start();
|
|
66
|
+
}
|
|
67
|
+
}
|
package/source/folib-web-core/src/main/java/com/veadan/folib/config/LegacySpringDataWebConfig.java
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
package com.veadan.folib.config;
|
|
2
|
+
|
|
3
|
+
import org.springframework.context.annotation.Bean;
|
|
4
|
+
import org.springframework.context.annotation.Configuration;
|
|
5
|
+
import org.springframework.core.env.Environment;
|
|
6
|
+
import org.springframework.data.domain.PageRequest;
|
|
7
|
+
import org.springframework.data.web.config.EnableSpringDataWebSupport;
|
|
8
|
+
import org.springframework.data.web.config.PageableHandlerMethodArgumentResolverCustomizer;
|
|
9
|
+
import org.springframework.data.web.config.SortHandlerMethodArgumentResolverCustomizer;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Neo4j OGM still uses Spring Data Commons 2.4. Boot 3.5's web auto-configuration
|
|
13
|
+
* requires Spring Data 3.x types that do not exist in that version. Retain the
|
|
14
|
+
* legacy web integration and the existing Boot pagination property contract.
|
|
15
|
+
*/
|
|
16
|
+
@Configuration(proxyBeanMethods = false)
|
|
17
|
+
@EnableSpringDataWebSupport
|
|
18
|
+
public class LegacySpringDataWebConfig {
|
|
19
|
+
|
|
20
|
+
private static final String PAGEABLE = "spring.data.web.pageable.";
|
|
21
|
+
|
|
22
|
+
@Bean
|
|
23
|
+
PageableHandlerMethodArgumentResolverCustomizer pageableCustomizer(Environment environment) {
|
|
24
|
+
return resolver -> {
|
|
25
|
+
resolver.setPageParameterName(environment.getProperty(PAGEABLE + "page-parameter", "page"));
|
|
26
|
+
resolver.setSizeParameterName(environment.getProperty(PAGEABLE + "size-parameter", "size"));
|
|
27
|
+
resolver.setOneIndexedParameters(environment.getProperty(PAGEABLE + "one-indexed-parameters", Boolean.class, false));
|
|
28
|
+
resolver.setPrefix(environment.getProperty(PAGEABLE + "prefix", ""));
|
|
29
|
+
resolver.setQualifierDelimiter(environment.getProperty(PAGEABLE + "qualifier-delimiter", "_"));
|
|
30
|
+
resolver.setFallbackPageable(PageRequest.of(0,
|
|
31
|
+
environment.getProperty(PAGEABLE + "default-page-size", Integer.class, 20)));
|
|
32
|
+
resolver.setMaxPageSize(environment.getProperty(PAGEABLE + "max-page-size", Integer.class, 2000));
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Bean
|
|
37
|
+
SortHandlerMethodArgumentResolverCustomizer sortCustomizer(Environment environment) {
|
|
38
|
+
return resolver -> resolver.setSortParameter(
|
|
39
|
+
environment.getProperty("spring.data.web.sort.sort-parameter", "sort"));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
package com.veadan.folib.config;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
4
|
+
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
5
|
+
import com.veadan.folib.configuration.ConfigurationManager;
|
|
6
|
+
import com.veadan.folib.configuration.FolibSecurityConfig;
|
|
7
|
+
import com.veadan.folib.constant.GlobalConstants;
|
|
8
|
+
import com.veadan.folib.converters.RoleFormToRoleConverter;
|
|
9
|
+
import com.veadan.folib.converters.RoleListFormToRoleListConverter;
|
|
10
|
+
import com.veadan.folib.converters.configuration.*;
|
|
11
|
+
import com.veadan.folib.converters.cron.CronTaskConfigurationFormToCronTaskConfigurationDtoConverter;
|
|
12
|
+
import com.veadan.folib.converters.storage.routing.RoutingRuleFormToMutableConverter;
|
|
13
|
+
import com.veadan.folib.converters.users.AccessModelFormToUserAccessModelDtoConverter;
|
|
14
|
+
import com.veadan.folib.converters.users.UserFormToUserDtoConverter;
|
|
15
|
+
import com.veadan.folib.cron.config.CronTasksConfig;
|
|
16
|
+
import com.veadan.folib.interceptors.PermissionCheckInterceptor;
|
|
17
|
+
import com.veadan.folib.jtwig.extensions.ByteSizeConversionExtension;
|
|
18
|
+
|
|
19
|
+
import com.veadan.folib.services.DirectoryListingService;
|
|
20
|
+
import com.veadan.folib.services.DirectoryListingServiceImpl;
|
|
21
|
+
import com.veadan.folib.utils.CustomAntPathMatcher;
|
|
22
|
+
import com.veadan.folib.web.CustomRequestMappingHandlerMapping;
|
|
23
|
+
import com.veadan.folib.web.DirectoryTraversalFilter;
|
|
24
|
+
import com.veadan.folib.web.RepositoryMethodArgumentResolver;
|
|
25
|
+
import com.veadan.folib.yaml.YAMLMapperFactory;
|
|
26
|
+
|
|
27
|
+
import jakarta.inject.Inject;
|
|
28
|
+
import jakarta.inject.Named;
|
|
29
|
+
import jakarta.servlet.http.HttpServletRequest;
|
|
30
|
+
import org.apache.commons.lang.StringUtils;
|
|
31
|
+
|
|
32
|
+
import org.jtwig.environment.EnvironmentConfigurationBuilder;
|
|
33
|
+
import org.jtwig.spring.boot.config.JtwigViewResolverConfigurer;
|
|
34
|
+
import org.jtwig.web.servlet.JtwigRenderer;
|
|
35
|
+
import org.slf4j.Logger;
|
|
36
|
+
import org.slf4j.LoggerFactory;
|
|
37
|
+
import org.springframework.beans.factory.annotation.Qualifier;
|
|
38
|
+
import org.springframework.beans.factory.annotation.Value;
|
|
39
|
+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
40
|
+
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
|
|
41
|
+
|
|
42
|
+
import org.springframework.boot.web.servlet.ServletComponentScan;
|
|
43
|
+
import org.springframework.cache.annotation.EnableCaching;
|
|
44
|
+
|
|
45
|
+
import org.springframework.context.annotation.Bean;
|
|
46
|
+
import org.springframework.context.annotation.ComponentScan;
|
|
47
|
+
import org.springframework.context.annotation.Configuration;
|
|
48
|
+
import org.springframework.context.annotation.Import;
|
|
49
|
+
import org.springframework.core.io.Resource;
|
|
50
|
+
import org.springframework.format.FormatterRegistry;
|
|
51
|
+
|
|
52
|
+
import org.springframework.http.converter.*;
|
|
53
|
+
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
54
|
+
|
|
55
|
+
import org.springframework.validation.Validator;
|
|
56
|
+
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
|
|
57
|
+
import org.springframework.web.context.request.RequestContextListener;
|
|
58
|
+
import org.springframework.web.filter.CommonsRequestLoggingFilter;
|
|
59
|
+
import org.springframework.web.filter.RequestContextFilter;
|
|
60
|
+
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
|
61
|
+
|
|
62
|
+
import org.springframework.web.servlet.config.annotation.*;
|
|
63
|
+
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
|
64
|
+
import org.springframework.web.servlet.resource.PathResourceResolver;
|
|
65
|
+
import org.springframework.web.servlet.resource.ResourceResolverChain;
|
|
66
|
+
import org.springframework.web.servlet.view.InternalResourceView;
|
|
67
|
+
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
|
68
|
+
import org.springframework.web.util.UrlPathHelper;
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
import java.nio.charset.StandardCharsets;
|
|
72
|
+
|
|
73
|
+
import java.util.List;
|
|
74
|
+
|
|
75
|
+
@Configuration
|
|
76
|
+
@ComponentScan({
|
|
77
|
+
"com.veadan.folib.controllers",
|
|
78
|
+
"com.veadan.folib.validation",
|
|
79
|
+
"com.veadan.folib.web",
|
|
80
|
+
"com.veadan.folib.mapper",
|
|
81
|
+
"com.veadan.folib.utils",
|
|
82
|
+
"com.veadan.folib.scanner",
|
|
83
|
+
"com.veadan.folib.gremlin",
|
|
84
|
+
"com.veadan.folib.actuator",
|
|
85
|
+
"com.veadan.folib.components",
|
|
86
|
+
"com.veadan.folib.listener",
|
|
87
|
+
"com.veadan.folib.eventlistener",
|
|
88
|
+
"com.veadan.folib.promotion",
|
|
89
|
+
"com.veadan.folib.task",
|
|
90
|
+
"com.veadan.folib.aop",
|
|
91
|
+
"com.veadan.folib.ws",
|
|
92
|
+
"com.veadan.folib.filter"})
|
|
93
|
+
@Import({CommonConfig.class,
|
|
94
|
+
FolibSecurityConfig.class,
|
|
95
|
+
StorageApiConfig.class,
|
|
96
|
+
EventsConfig.class,
|
|
97
|
+
StorageCoreConfig.class,
|
|
98
|
+
UsersConfig.class,
|
|
99
|
+
WebSecurityConfig.class,
|
|
100
|
+
ClientConfig.class,
|
|
101
|
+
CronTasksConfig.class,
|
|
102
|
+
DataSourceAutoConfiguration.class,
|
|
103
|
+
SwaggerConfig.class})
|
|
104
|
+
@EnableCaching(order = 105)
|
|
105
|
+
@ServletComponentScan(basePackages = {"com.veadan.folib.filter"})
|
|
106
|
+
public class WebConfig
|
|
107
|
+
implements WebMvcConfigurer ,WebMvcRegistrations
|
|
108
|
+
{
|
|
109
|
+
|
|
110
|
+
private static final Logger logger = LoggerFactory.getLogger(WebConfig.class);
|
|
111
|
+
|
|
112
|
+
@Inject
|
|
113
|
+
@Named("customAntPathMatcher")
|
|
114
|
+
private CustomAntPathMatcher antPathMatcher;
|
|
115
|
+
|
|
116
|
+
@Inject
|
|
117
|
+
private ObjectMapper objectMapper;
|
|
118
|
+
|
|
119
|
+
@Inject
|
|
120
|
+
private YAMLMapperFactory yamlMapperFactory;
|
|
121
|
+
|
|
122
|
+
@Inject
|
|
123
|
+
private ConfigurationManager configurationManager;
|
|
124
|
+
|
|
125
|
+
@Value("${folib.custom.maxInMemorySize:10240}")
|
|
126
|
+
private int maxInMemorySize;
|
|
127
|
+
|
|
128
|
+
WebConfig() {
|
|
129
|
+
logger.info("Initialized web configuration.");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@Bean
|
|
133
|
+
RequestContextListener requestContextListener() {
|
|
134
|
+
return new RequestContextListener();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@Bean
|
|
138
|
+
RequestContextFilter requestContextFilter() {
|
|
139
|
+
return new RequestContextFilter();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@Bean
|
|
143
|
+
CommonsRequestLoggingFilter commonsRequestLoggingFilter() {
|
|
144
|
+
CommonsRequestLoggingFilter result = new CommonsRequestLoggingFilter() {
|
|
145
|
+
|
|
146
|
+
@Override
|
|
147
|
+
protected String createMessage(HttpServletRequest request,
|
|
148
|
+
String prefix,
|
|
149
|
+
String suffix) {
|
|
150
|
+
return super.createMessage(request, String.format("%smethod=%s;", prefix, request.getMethod()), suffix);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
};
|
|
154
|
+
result.setIncludeQueryString(true);
|
|
155
|
+
result.setIncludeHeaders(true);
|
|
156
|
+
result.setIncludeClientInfo(true);
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@Override
|
|
161
|
+
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
|
|
162
|
+
return new CustomRequestMappingHandlerMapping();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
//@Override
|
|
166
|
+
//protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() {
|
|
167
|
+
// return new CustomRequestMappingHandlerMapping();
|
|
168
|
+
//}
|
|
169
|
+
|
|
170
|
+
@Bean
|
|
171
|
+
DirectoryTraversalFilter directoryTraversalFilter() {
|
|
172
|
+
return new DirectoryTraversalFilter();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@Override
|
|
176
|
+
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
|
177
|
+
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
|
|
178
|
+
stringConverter.setWriteAcceptCharset(false);
|
|
179
|
+
stringConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
|
180
|
+
// if your argument is a byte[]
|
|
181
|
+
converters.add(new ByteArrayHttpMessageConverter());
|
|
182
|
+
converters.add(stringConverter);
|
|
183
|
+
converters.add(new FormHttpMessageConverter());
|
|
184
|
+
|
|
185
|
+
//converters.add(yamlConverter());
|
|
186
|
+
converters.add(jackson2Converter());
|
|
187
|
+
converters.add(new ResourceHttpMessageConverter());
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@Override
|
|
192
|
+
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
|
193
|
+
configurer.favorPathExtension(false);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// TODO consider using the same MappingJackson2HttpMessageConverter for yaml and json !
|
|
197
|
+
//@Bean
|
|
198
|
+
//public MappingJackson2HttpMessageConverter yamlConverter() {
|
|
199
|
+
// MappingJackson2HttpMessageConverter yamlConverter = new MappingJackson2HttpMessageConverter(
|
|
200
|
+
// yamlMapperFactory.create(WebObjectMapperSubtypes.INSTANCE.subtypes()));
|
|
201
|
+
// yamlConverter.setSupportedMediaTypes(
|
|
202
|
+
// Arrays.asList(MediaType.valueOf(com.veadan.folib.net.MediaType.APPLICATION_YML_VALUE), MediaType.valueOf(com.veadan.folib.net.MediaType.APPLICATION_YAML_VALUE)));
|
|
203
|
+
// return yamlConverter;
|
|
204
|
+
//}
|
|
205
|
+
|
|
206
|
+
@Bean
|
|
207
|
+
public MappingJackson2HttpMessageConverter jackson2Converter() {
|
|
208
|
+
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
209
|
+
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(objectMapper);
|
|
210
|
+
mappingJackson2HttpMessageConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
|
211
|
+
return mappingJackson2HttpMessageConverter;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@Bean
|
|
215
|
+
public Validator localValidatorFactoryBean() {
|
|
216
|
+
return new LocalValidatorFactoryBean();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@Bean
|
|
220
|
+
@Qualifier("loggingManagementDirectoryListingService")
|
|
221
|
+
public DirectoryListingService getLoggingManagementDirectoryListingService() {
|
|
222
|
+
return createDirectoryListingServiceForTemplate("%s/api/logging");
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
private DirectoryListingService createDirectoryListingServiceForTemplate(String template) {
|
|
226
|
+
String baseUrl = StringUtils.chomp(configurationManager.getConfiguration().getBaseUrl(), "/");
|
|
227
|
+
String finalUrl = String.format(template, baseUrl);
|
|
228
|
+
return new DirectoryListingServiceImpl(finalUrl);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@Bean
|
|
233
|
+
@Qualifier("browseRepositoryDirectoryListingService")
|
|
234
|
+
public DirectoryListingService getBrowseRepositoryDirectoryListingService() {
|
|
235
|
+
return createDirectoryListingServiceForTemplate("%s/api/browse");
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@Override
|
|
239
|
+
public void configurePathMatch(PathMatchConfigurer configurer) {
|
|
240
|
+
// Spring Boot 3 默认开启的 strict path validation 拦截了 %2F
|
|
241
|
+
UrlPathHelper urlPathHelper= new UrlPathHelper();
|
|
242
|
+
urlPathHelper.setUrlDecode(true); // 开启解码
|
|
243
|
+
urlPathHelper.setRemoveSemicolonContent(false);
|
|
244
|
+
urlPathHelper.setAlwaysUseFullPath(false);
|
|
245
|
+
/* {{
|
|
246
|
+
urlPathHelper.setUrlDecode(true); // 开启解码
|
|
247
|
+
urlPathHelper.setRemoveSemicolonContent(false);
|
|
248
|
+
urlPathHelper.setAlwaysUseFullPath(false);
|
|
249
|
+
}}*/
|
|
250
|
+
configurer.setUrlPathHelper(urlPathHelper);
|
|
251
|
+
configurer.setUseRegisteredSuffixPatternMatch(false)
|
|
252
|
+
.setUseSuffixPatternMatch(false)
|
|
253
|
+
.setUseTrailingSlashMatch(true)
|
|
254
|
+
.setPathMatcher(antPathMatcher);
|
|
255
|
+
}
|
|
256
|
+
@Override
|
|
257
|
+
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
258
|
+
//registry.setOrder(-1);
|
|
259
|
+
|
|
260
|
+
registry.addResourceHandler("/rest/**")
|
|
261
|
+
.addResourceLocations("classpath:/META-INF/resources/docs/rest/")
|
|
262
|
+
.setCachePeriod(3600);
|
|
263
|
+
|
|
264
|
+
// Keep static resources scoped to their dedicated directories. Spring MVC
|
|
265
|
+
// rejects a classpath-root location; Folib's HTML assets live under /ui and /docs.
|
|
266
|
+
|
|
267
|
+
String webUrlPrefix = System.getProperty(GlobalConstants.WEB_URL_PREFIX);
|
|
268
|
+
if (StringUtils.isBlank(webUrlPrefix)) {
|
|
269
|
+
webUrlPrefix = "/ui/";
|
|
270
|
+
}
|
|
271
|
+
registry.addResourceHandler(webUrlPrefix + "**")
|
|
272
|
+
.addResourceLocations("classpath:/ui/")
|
|
273
|
+
.setCachePeriod(3600)
|
|
274
|
+
.resourceChain(true)
|
|
275
|
+
//.addResolver(new GzipResourceResolver())
|
|
276
|
+
.addResolver(new PathResourceResolver());
|
|
277
|
+
registry.addResourceHandler("/help","/help/","/help/**")
|
|
278
|
+
.addResourceLocations("classpath:/docs/")
|
|
279
|
+
.setCachePeriod(3600)
|
|
280
|
+
.resourceChain(true)
|
|
281
|
+
//.addResolver(new GzipResourceResolver())
|
|
282
|
+
.addResolver(new HtmlFallbackResourceResolver()); // 替换为自定义解析器
|
|
283
|
+
|
|
284
|
+
registry.addResourceHandler("/webjars/**")
|
|
285
|
+
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
286
|
+
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
@Override
|
|
290
|
+
public void addFormatters(FormatterRegistry registry) {
|
|
291
|
+
registry.addConverter(new RoleFormToRoleConverter());
|
|
292
|
+
registry.addConverter(new RoleListFormToRoleListConverter());
|
|
293
|
+
registry.addConverter(UserFormToUserDtoConverter.INSTANCE);
|
|
294
|
+
registry.addConverter(AccessModelFormToUserAccessModelDtoConverter.INSTANCE);
|
|
295
|
+
registry.addConverter(ProxyConfigurationFormConverter.INSTANCE);
|
|
296
|
+
registry.addConverter(new RoutingRuleFormToMutableConverter());
|
|
297
|
+
registry.addConverter(StorageFormConverter.INSTANCE);
|
|
298
|
+
registry.addConverter(RepositoryFormConverter.INSTANCE);
|
|
299
|
+
registry.addConverter(RemoteRepositoryFormConverter.INSTANCE);
|
|
300
|
+
registry.addConverter(CronTaskConfigurationFormToCronTaskConfigurationDtoConverter.INSTANCE);
|
|
301
|
+
registry.addConverter(RepositoryPermissionFormConverter.INSTANCE);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@Bean
|
|
305
|
+
JtwigViewResolverConfigurer jtwigViewResolverConfigurer() {
|
|
306
|
+
return jtwigViewResolver -> {
|
|
307
|
+
JtwigRenderer renderer = new JtwigRenderer(
|
|
308
|
+
EnvironmentConfigurationBuilder.configuration()
|
|
309
|
+
.extensions()
|
|
310
|
+
.add(new ByteSizeConversionExtension())
|
|
311
|
+
.and()
|
|
312
|
+
.build());
|
|
313
|
+
jtwigViewResolver.setRenderer(renderer);
|
|
314
|
+
jtwigViewResolver.setPrefix("classpath:/views/");
|
|
315
|
+
jtwigViewResolver.setSuffix(".twig.html");
|
|
316
|
+
jtwigViewResolver.setViewNames("directoryListing");
|
|
317
|
+
jtwigViewResolver.setOrder(0);
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
@Bean
|
|
322
|
+
InternalResourceViewResolver internalResourceViewResolver() {
|
|
323
|
+
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
|
|
324
|
+
viewResolver.setViewClass(InternalResourceView.class);
|
|
325
|
+
viewResolver.setViewNames("*.html");
|
|
326
|
+
viewResolver.setOrder(1);
|
|
327
|
+
viewResolver.setRedirectHttp10Compatible(false);
|
|
328
|
+
return viewResolver;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// @Bean
|
|
332
|
+
// MavenArtifactRequestInterceptor mavenArtifactRequestInterceptor(RepositoryPathResolver repositoryPathResolver) {
|
|
333
|
+
// return new MavenArtifactRequestInterceptor(repositoryPathResolver);
|
|
334
|
+
// }
|
|
335
|
+
|
|
336
|
+
@Bean
|
|
337
|
+
PermissionCheckInterceptor permissionCheckInterceptor() {
|
|
338
|
+
return new PermissionCheckInterceptor();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
@Override
|
|
342
|
+
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
|
343
|
+
argumentResolvers.add(repositoryMethodArgumentResolver());
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
@Bean
|
|
347
|
+
public RepositoryMethodArgumentResolver repositoryMethodArgumentResolver() {
|
|
348
|
+
return new RepositoryMethodArgumentResolver();
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
//@Bean(name = "multipartResolver")
|
|
352
|
+
//public MultipartResolver multipartResolver() {
|
|
353
|
+
// CustomMultipartResolver resolver = new CustomMultipartResolver();
|
|
354
|
+
// resolver.setMaxInMemorySize(maxInMemorySize);
|
|
355
|
+
// return resolver;
|
|
356
|
+
////}
|
|
357
|
+
|
|
358
|
+
@Override
|
|
359
|
+
public void addViewControllers(ViewControllerRegistry registry) {
|
|
360
|
+
registry.addRedirectViewController("/", "/ui/index.html");
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
public class HtmlFallbackResourceResolver extends PathResourceResolver {
|
|
364
|
+
@Override
|
|
365
|
+
protected Resource resolveResourceInternal(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) {
|
|
366
|
+
Resource resource = super.resolveResourceInternal(request, requestPath, locations, chain);
|
|
367
|
+
if (resource == null) {
|
|
368
|
+
// 尝试添加 .html 后缀
|
|
369
|
+
return super.resolveResourceInternal(request, "index.html", locations, chain);
|
|
370
|
+
}
|
|
371
|
+
return resource;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
}
|
package/source/folib-web-core/src/main/java/com/veadan/folib/model/response/OhpmPublishRes.java
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package com.veadan.folib.model.response;
|
|
2
|
+
|
|
3
|
+
import io.swagger.annotations.ApiModel;
|
|
4
|
+
import lombok.Builder;
|
|
5
|
+
import lombok.Data;
|
|
6
|
+
import lombok.experimental.Accessors;
|
|
7
|
+
|
|
8
|
+
@Data
|
|
9
|
+
@Builder
|
|
10
|
+
@Accessors(chain = true)
|
|
11
|
+
@ApiModel(value = "OhpmPublishRes",description = "ohpm发布结果")
|
|
12
|
+
public class OhpmPublishRes {
|
|
13
|
+
|
|
14
|
+
private String additionalMsg;
|
|
15
|
+
private boolean success;
|
|
16
|
+
}
|