Skip to content

Commit

Permalink
Merge branch 'master' into spring-6
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcom committed Sep 27, 2024
2 parents 32417ed + 74b38a4 commit 337818f
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 1,203 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
- name: Build
run: mvn --batch-mode -DskipTests=true -Dmaven.javadoc.skip=true package
- name: Test
run: mvn --batch-mode verify
run: mvn --batch-mode -P CI verify
13 changes: 4 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@
<version>${activemq.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.6.11</version>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.1.8</version>
</dependency>

<!-- костыль для ehcache 2.x -->
Expand Down Expand Up @@ -989,12 +989,7 @@
</profile>

<profile>
<id>travis</id>
<activation>
<property>
<name>env.TRAVIS</name>
</property>
</activation>
<id>CI</id>
<build>
<plugins>
<plugin>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ru/org/linux/user/UserpicController.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public ModelAndView addPhoto(@RequestParam("file") MultipartFile file, HttpServl
Path uploadedFile = Files.createTempFile("userpic-", "");

try {
file.transferTo(uploadedFile.toFile());
file.transferTo(uploadedFile);

ImageParam param = userService.checkUserPic(uploadedFile.toFile());
String extension = param.getExtension();
Expand All @@ -114,7 +114,7 @@ public ModelAndView addPhoto(@RequestParam("file") MultipartFile file, HttpServl

userDao.setPhoto(currentUser, photoname);

logger.info("Установлена фотография пользователем " + currentUser.getNick());
logger.info("Установлена фотография пользователем {}", currentUser.getNick());

UriComponents profileUri = UriComponentsBuilder
.fromUri(PROFILE_URI_TEMPLATE.expand(currentUser.getNick()))
Expand Down
939 changes: 0 additions & 939 deletions src/main/resources/ehcache.xml

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/scala/ru/org/linux/gallery/ImageService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ class ImageService(imageDao: ImageDao, editHistoryDao: EditHistoryDao,

if (multipartFile != null && !multipartFile.isEmpty) {
val uploadedFile = File.createTempFile("lor-image-", "")
logger.debug("Transfering upload to: " + uploadedFile)
multipartFile.transferTo(uploadedFile)
logger.debug(s"Transferring upload to: $uploadedFile")
multipartFile.transferTo(uploadedFile.toPath)

Some(uploadedFile)
} else {
Expand Down
18 changes: 3 additions & 15 deletions src/main/webapp/WEB-INF/applicationContext.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 1998-2022 Linux.org.ru
~ Copyright 1998-2024 Linux.org.ru
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
Expand Down Expand Up @@ -144,22 +144,10 @@

<task:annotation-driven/>

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cache-manager-ref="ehcache"/>

<!-- Ehcache library setup -->
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>
<bean id="cacheManager" class="org.springframework.cache.caffeine.CaffeineCacheManager"
p:cache-specification="maximumSize=5000,expireAfterWrite=5m"/>

<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
<property name="locateExistingServerIfPossible" value="true"/>
</bean>

<bean class="net.sf.ehcache.management.ManagementService" init-method="init">
<constructor-arg ref="ehcache"/>
<constructor-arg ref="mbeanServer"/>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
<constructor-arg value="true"/>
<constructor-arg value="false"/>
</bean>
</beans>
222 changes: 0 additions & 222 deletions src/main/webapp/WEB-INF/fn.tld

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/errors/code403.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
String message = exception==null ? "":(exception.getMessage()==null?"":exception.getMessage());
logger.debug("Forbidden. {}: {} ({})", request.getAttribute("jakarta.servlet.error.request_uri"),
logger.debug("Forbidden. {}: {} ({})", request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI),
message, AuthUtil.getNick());
%>
<jsp:include page="/WEB-INF/jsp/head.jsp"/>
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/WEB-INF/springapp-servlet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
</property>
</bean>

<bean id="multipartResolver" class="org.springframework.web.multipart.support.StandardServletMultipartResolver"/>

<bean id="absractRomeView" class="ru.org.linux.spring.AbstractRomeView" abstract="true">
<property name="contentTypes">
<map>
Expand Down
11 changes: 1 addition & 10 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
metadata-complete="true"
>
metadata-complete="true">
<absolute-ordering/>

<display-name>linux.org.ru</display-name>
Expand Down Expand Up @@ -65,14 +64,6 @@
<location>/ExceptionResolver</location>
</error-page>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/functions</taglib-uri>
<taglib-location>/WEB-INF/fn.tld</taglib-location>
</taglib>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2022 Linux.org.ru
* Copyright 1998-2024 Linux.org.ru
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -155,7 +155,7 @@ class UserpicControllerWebTest {
val auth = WebHelper.doLogin("JB", "passwd")
val cr = addPhoto("src/main/webapp/tango/img/android.png", auth)

assertEquals(cr.code, StatusCode.Found)
assertEquals(StatusCode.Found, cr.code)

val redirect = cr.header(HeaderNames.Location).getOrElse("")

Expand Down

0 comments on commit 337818f

Please sign in to comment.