Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
梁杰芳
slm-fileview
Commits
5a559aa8
Commit
5a559aa8
authored
Dec 25, 2020
by
chenkailing
Committed by
kl
Dec 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复图片预览bug,移除guava
parent
9b0f381c
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
81 additions
and
100 deletions
+81
-100
pom.xml
jodconverter-web/pom.xml
+0
-5
FileAttribute.java
...rter-web/src/main/java/cn/keking/model/FileAttribute.java
+9
-4
FileType.java
jodconverter-web/src/main/java/cn/keking/model/FileType.java
+1
-1
CacheServiceJDKImpl.java
...ava/cn/keking/service/cache/impl/CacheServiceJDKImpl.java
+31
-46
OfficeFilePreviewImpl.java
...in/java/cn/keking/service/impl/OfficeFilePreviewImpl.java
+0
-1
PdfFilePreviewImpl.java
.../main/java/cn/keking/service/impl/PdfFilePreviewImpl.java
+0
-1
PictureFilePreviewImpl.java
...n/java/cn/keking/service/impl/PictureFilePreviewImpl.java
+11
-13
FileUtils.java
...onverter-web/src/main/java/cn/keking/utils/FileUtils.java
+8
-8
ZipReader.java
...onverter-web/src/main/java/cn/keking/utils/ZipReader.java
+11
-13
FileController.java
...rc/main/java/cn/keking/web/controller/FileController.java
+8
-8
AttributeSetFilter.java
...rc/main/java/cn/keking/web/filter/AttributeSetFilter.java
+2
-0
No files found.
jodconverter-web/pom.xml
View file @
5a559aa8
...
...
@@ -160,11 +160,6 @@
<artifactId>
xstream
</artifactId>
<version>
1.4.15
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
19.0
</version>
</dependency>
<dependency>
<groupId>
com.googlecode.concurrentlinkedhashmap
</groupId>
<artifactId>
concurrentlinkedhashmap-lru
</artifactId>
...
...
jodconverter-web/src/main/java/cn/keking/model/FileAttribute.java
View file @
5a559aa8
...
...
@@ -9,13 +9,10 @@ import cn.keking.config.ConfigConstants;
public
class
FileAttribute
{
private
FileType
type
;
private
String
suffix
;
private
String
name
;
private
String
url
;
private
String
fileKey
;
private
String
officePreviewType
=
ConfigConstants
.
getOfficePreviewType
();
public
FileAttribute
()
{
...
...
@@ -36,6 +33,14 @@ public class FileAttribute {
this
.
officePreviewType
=
officePreviewType
;
}
public
String
getFileKey
()
{
return
fileKey
;
}
public
void
setFileKey
(
String
fileKey
)
{
this
.
fileKey
=
fileKey
;
}
public
String
getOfficePreviewType
()
{
return
officePreviewType
;
}
...
...
jodconverter-web/src/main/java/cn/keking/model/FileType.java
View file @
5a559aa8
...
...
@@ -5,7 +5,7 @@ package cn.keking.model;
* Content :文件类型,文本,office,压缩包等等
*/
public
enum
FileType
{
picture
(
"picture
filepreviewi
mpl"
),
picture
(
"picture
FilePreviewI
mpl"
),
compress
(
"compressFilePreviewImpl"
),
office
(
"officeFilePreviewImpl"
),
simText
(
"simTextFilePreviewImpl"
),
...
...
jodconverter-web/src/main/java/cn/keking/service/cache/impl/CacheServiceJDKImpl.java
View file @
5a559aa8
...
...
@@ -5,7 +5,10 @@ import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
import
com.googlecode.concurrentlinkedhashmap.Weighers
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ArrayBlockingQueue
;
...
...
@@ -21,97 +24,58 @@ import java.util.concurrent.BlockingQueue;
public
class
CacheServiceJDKImpl
implements
CacheService
{
private
Map
<
String
,
String
>
pdfCache
;
private
Map
<
String
,
List
<
String
>>
imgCache
;
private
Map
<
String
,
Integer
>
pdfImagesCache
;
private
static
final
int
QUEUE_SIZE
=
500000
;
private
final
BlockingQueue
<
String
>
blockingQueue
=
new
ArrayBlockingQueue
<>(
QUEUE_SIZE
);
@Override
public
void
initPDFCachePool
(
Integer
capacity
)
{
pdfCache
=
new
ConcurrentLinkedHashMap
.
Builder
<
String
,
String
>()
.
maximumWeightedCapacity
(
capacity
).
weigher
(
Weighers
.
singleton
())
.
build
();
}
@Override
public
void
initIMGCachePool
(
Integer
capacity
)
{
imgCache
=
new
ConcurrentLinkedHashMap
.
Builder
<
String
,
List
<
String
>>()
.
maximumWeightedCapacity
(
capacity
).
weigher
(
Weighers
.
singleton
())
.
build
();
}
@Override
public
void
initPdfImagesCachePool
(
Integer
capacity
)
{
pdfImagesCache
=
new
ConcurrentLinkedHashMap
.
Builder
<
String
,
Integer
>()
.
maximumWeightedCapacity
(
capacity
).
weigher
(
Weighers
.
singleton
())
.
build
();
@PostConstruct
public
void
initCache
(){
initPDFCachePool
(
CacheService
.
DEFAULT_PDF_CAPACITY
);
initIMGCachePool
(
CacheService
.
DEFAULT_IMG_CAPACITY
);
initPdfImagesCachePool
(
CacheService
.
DEFAULT_PDFIMG_CAPACITY
);
}
@Override
public
void
putPDFCache
(
String
key
,
String
value
)
{
if
(
pdfCache
==
null
)
{
initPDFCachePool
(
CacheService
.
DEFAULT_PDF_CAPACITY
);
}
pdfCache
.
put
(
key
,
value
);
}
@Override
public
void
putImgCache
(
String
key
,
List
<
String
>
value
)
{
if
(
imgCache
==
null
)
{
initIMGCachePool
(
CacheService
.
DEFAULT_IMG_CAPACITY
);
}
imgCache
.
put
(
key
,
value
);
}
@Override
public
Map
<
String
,
String
>
getPDFCache
()
{
if
(
pdfCache
==
null
)
{
initPDFCachePool
(
CacheService
.
DEFAULT_PDF_CAPACITY
);
}
return
pdfCache
;
}
@Override
public
String
getPDFCache
(
String
key
)
{
if
(
pdfCache
==
null
)
{
initPDFCachePool
(
CacheService
.
DEFAULT_PDF_CAPACITY
);
}
return
pdfCache
.
get
(
key
);
}
@Override
public
Map
<
String
,
List
<
String
>>
getImgCache
()
{
if
(
imgCache
==
null
)
{
initPDFCachePool
(
CacheService
.
DEFAULT_IMG_CAPACITY
);
}
return
imgCache
;
}
@Override
public
List
<
String
>
getImgCache
(
String
key
)
{
if
(
imgCache
==
null
)
{
initPDFCachePool
(
CacheService
.
DEFAULT_IMG_CAPACITY
);
if
(
StringUtils
.
isEmpty
(
key
))
{
return
new
ArrayList
<>(
);
}
return
imgCache
.
get
(
key
);
}
@Override
public
Integer
getPdfImageCache
(
String
key
)
{
if
(
pdfImagesCache
==
null
)
{
initPdfImagesCachePool
(
CacheService
.
DEFAULT_PDFIMG_CAPACITY
);
}
return
pdfImagesCache
.
get
(
key
);
}
@Override
public
void
putPdfImageCache
(
String
pdfFilePath
,
int
num
)
{
if
(
pdfImagesCache
==
null
)
{
initPdfImagesCachePool
(
CacheService
.
DEFAULT_PDFIMG_CAPACITY
);
}
pdfImagesCache
.
put
(
pdfFilePath
,
num
);
}
...
...
@@ -131,4 +95,25 @@ public class CacheServiceJDKImpl implements CacheService {
public
String
takeQueueTask
()
throws
InterruptedException
{
return
blockingQueue
.
take
();
}
@Override
public
void
initPDFCachePool
(
Integer
capacity
)
{
pdfCache
=
new
ConcurrentLinkedHashMap
.
Builder
<
String
,
String
>()
.
maximumWeightedCapacity
(
capacity
).
weigher
(
Weighers
.
singleton
())
.
build
();
}
@Override
public
void
initIMGCachePool
(
Integer
capacity
)
{
imgCache
=
new
ConcurrentLinkedHashMap
.
Builder
<
String
,
List
<
String
>>()
.
maximumWeightedCapacity
(
capacity
).
weigher
(
Weighers
.
singleton
())
.
build
();
}
@Override
public
void
initPdfImagesCachePool
(
Integer
capacity
)
{
pdfImagesCache
=
new
ConcurrentLinkedHashMap
.
Builder
<
String
,
Integer
>()
.
maximumWeightedCapacity
(
capacity
).
weigher
(
Weighers
.
singleton
())
.
build
();
}
}
jodconverter-web/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java
View file @
5a559aa8
...
...
@@ -48,7 +48,6 @@ public class OfficeFilePreviewImpl implements FilePreview {
boolean
isHtml
=
suffix
.
equalsIgnoreCase
(
"xls"
)
||
suffix
.
equalsIgnoreCase
(
"xlsx"
);
String
pdfName
=
fileName
.
substring
(
0
,
fileName
.
lastIndexOf
(
"."
)
+
1
)
+
(
isHtml
?
"html"
:
"pdf"
);
String
outFilePath
=
FILE_DIR
+
pdfName
;
model
.
addAttribute
(
"switchDisabled"
,
ConfigConstants
.
getOfficePreviewSwitchDisabled
());
// 判断之前是否已转换过,如果转换过,直接返回,否则执行转换
if
(!
fileUtils
.
listConvertedFiles
().
containsKey
(
pdfName
)
||
!
ConfigConstants
.
isCacheEnabled
())
{
String
filePath
;
...
...
jodconverter-web/src/main/java/cn/keking/service/impl/PdfFilePreviewImpl.java
View file @
5a559aa8
...
...
@@ -44,7 +44,6 @@ public class PdfFilePreviewImpl implements FilePreview {
String
baseUrl
=
BaseUrlFilter
.
getBaseUrl
();
String
pdfName
=
fileName
.
substring
(
0
,
fileName
.
lastIndexOf
(
"."
)
+
1
)
+
"pdf"
;
String
outFilePath
=
FILE_DIR
+
pdfName
;
model
.
addAttribute
(
"switchDisabled"
,
ConfigConstants
.
getOfficePreviewSwitchDisabled
());
if
(
OfficeFilePreviewImpl
.
OFFICE_PREVIEW_TYPE_IMAGE
.
equals
(
officePreviewType
)
||
OfficeFilePreviewImpl
.
OFFICE_PREVIEW_TYPE_ALL_IMAGES
.
equals
(
officePreviewType
))
{
//当文件不存在时,就去下载
if
(!
fileUtils
.
listConvertedFiles
().
containsKey
(
pdfName
)
||
!
ConfigConstants
.
isCacheEnabled
())
{
...
...
jodconverter-web/src/main/java/cn/keking/service/impl/PictureFilePreviewImpl.java
View file @
5a559aa8
package
cn
.
keking
.
service
.
impl
;
import
cn.keking.config.ConfigConstants
;
import
cn.keking.model.FileAttribute
;
import
cn.keking.model.ReturnResponse
;
import
cn.keking.service.FilePreview
;
import
cn.keking.utils.DownloadUtils
;
import
cn.keking.utils.FileUtils
;
import
com.google.common.collect.Lists
;
import
org.springframework.stereotype.Service
;
import
org.springframework.ui.Model
;
import
org.springframework.
web.context.request.RequestContextHolder
;
import
org.springframework.
util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -32,14 +30,12 @@ public class PictureFilePreviewImpl implements FilePreview {
@Override
public
String
filePreviewHandle
(
String
url
,
Model
model
,
FileAttribute
fileAttribute
)
{
String
fileKey
=
(
String
)
RequestContextHolder
.
currentRequestAttributes
().
getAttribute
(
"fileKey"
,
0
);
List
<
String
>
imgUrls
=
Lists
.
newArrayList
(
url
);
model
.
addAttribute
(
"switchDisabled"
,
ConfigConstants
.
getOfficePreviewSwitchDisabled
());
try
{
imgUrls
.
clear
();
imgUrls
.
addAll
(
fileUtils
.
getImgCache
(
fileKey
));
}
catch
(
Exception
e
){
imgUrls
=
Lists
.
newArrayList
(
url
);
List
<
String
>
imgUrls
=
new
ArrayList
<>();
imgUrls
.
add
(
url
);
String
fileKey
=
fileAttribute
.
getFileKey
();
List
<
String
>
zipImgUrls
=
fileUtils
.
getImgCache
(
fileKey
);
if
(!
CollectionUtils
.
isEmpty
(
zipImgUrls
))
{
imgUrls
.
addAll
(
zipImgUrls
);
}
// 不是http开头,浏览器不能直接访问,需下载到本地
if
(
url
!=
null
&&
!
url
.
toLowerCase
().
startsWith
(
"http"
))
{
...
...
@@ -50,7 +46,9 @@ public class PictureFilePreviewImpl implements FilePreview {
return
"fileNotSupported"
;
}
else
{
String
file
=
fileUtils
.
getRelativePath
(
response
.
getContent
());
model
.
addAttribute
(
"imgurls"
,
Lists
.
newArrayList
(
file
));
imgUrls
.
clear
();
imgUrls
.
add
(
file
);
model
.
addAttribute
(
"imgurls"
,
imgUrls
);
model
.
addAttribute
(
"currentUrl"
,
file
);
}
}
else
{
...
...
jodconverter-web/src/main/java/cn/keking/utils/FileUtils.java
View file @
5a559aa8
...
...
@@ -4,7 +4,6 @@ import cn.keking.config.ConfigConstants;
import
cn.keking.model.FileAttribute
;
import
cn.keking.model.FileType
;
import
cn.keking.service.cache.CacheService
;
import
com.google.common.collect.Lists
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
...
...
@@ -12,10 +11,7 @@ import javax.servlet.http.HttpServletRequest;
import
java.io.*
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* @author yudian-it
...
...
@@ -125,7 +121,7 @@ public class FileUtils {
}
public
List
<
String
>
listPictureTypes
()
{
List
<
String
>
list
=
Lists
.
newArrayList
();
List
<
String
>
list
=
new
LinkedList
<>
();
list
.
add
(
"jpg"
);
list
.
add
(
"jpeg"
);
list
.
add
(
"png"
);
...
...
@@ -137,7 +133,7 @@ public class FileUtils {
}
public
List
<
String
>
listArchiveTypes
()
{
List
<
String
>
list
=
Lists
.
newArrayList
();
List
<
String
>
list
=
new
LinkedList
<>
();
list
.
add
(
"rar"
);
list
.
add
(
"zip"
);
list
.
add
(
"jar"
);
...
...
@@ -149,7 +145,7 @@ public class FileUtils {
}
public
List
<
String
>
listOfficeTypes
()
{
List
<
String
>
list
=
Lists
.
newArrayList
();
List
<
String
>
list
=
new
LinkedList
<>
();
list
.
add
(
"docx"
);
list
.
add
(
"doc"
);
list
.
add
(
"xls"
);
...
...
@@ -358,9 +354,13 @@ public class FileUtils {
attribute
.
setUrl
(
url
);
if
(
req
!=
null
)
{
String
officePreviewType
=
req
.
getParameter
(
"officePreviewType"
);
String
fileKey
=
req
.
getParameter
(
"fileKey"
);
if
(
StringUtils
.
hasText
(
officePreviewType
)){
attribute
.
setOfficePreviewType
(
officePreviewType
);
}
if
(
StringUtils
.
hasText
(
fileKey
)){
attribute
.
setFileKey
(
fileKey
);
}
}
return
attribute
;
}
...
...
jodconverter-web/src/main/java/cn/keking/utils/ZipReader.java
View file @
5a559aa8
...
...
@@ -8,8 +8,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.github.junrar.Archive
;
import
com.github.junrar.exception.RarException
;
import
com.github.junrar.rarfile.FileHeader
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry
;
import
org.apache.commons.compress.archivers.sevenz.SevenZFile
;
import
org.apache.commons.compress.archivers.zip.ZipArchiveEntry
;
...
...
@@ -47,8 +45,8 @@ public class ZipReader {
public
String
readZipFile
(
String
filePath
,
String
fileKey
)
{
String
archiveSeparator
=
"/"
;
Map
<
String
,
FileNode
>
appender
=
Maps
.
newHashMap
();
List
<
String
>
imgUrls
=
Lists
.
newArrayList
();
Map
<
String
,
FileNode
>
appender
=
new
HashMap
<>
();
List
<
String
>
imgUrls
=
new
LinkedList
<>
();
String
baseUrl
=
BaseUrlFilter
.
getBaseUrl
();
String
archiveFileName
=
fileUtils
.
getFileNameFromPath
(
filePath
);
try
{
...
...
@@ -56,7 +54,7 @@ public class ZipReader {
Enumeration
<
ZipArchiveEntry
>
entries
=
zipFile
.
getEntries
();
// 排序
entries
=
sortZipEntries
(
entries
);
List
<
Map
<
String
,
ZipArchiveEntry
>>
entriesToBeExtracted
=
Lists
.
newArrayList
();
List
<
Map
<
String
,
ZipArchiveEntry
>>
entriesToBeExtracted
=
new
LinkedList
<>
();
while
(
entries
.
hasMoreElements
()){
ZipArchiveEntry
entry
=
entries
.
nextElement
();
String
fullName
=
entry
.
getName
();
...
...
@@ -90,7 +88,7 @@ public class ZipReader {
}
private
Enumeration
<
ZipArchiveEntry
>
sortZipEntries
(
Enumeration
<
ZipArchiveEntry
>
entries
)
{
List
<
ZipArchiveEntry
>
sortedEntries
=
Lists
.
newArrayList
();
List
<
ZipArchiveEntry
>
sortedEntries
=
new
LinkedList
<>
();
while
(
entries
.
hasMoreElements
()){
sortedEntries
.
add
(
entries
.
nextElement
());
}
...
...
@@ -99,15 +97,15 @@ public class ZipReader {
}
public
String
unRar
(
String
filePath
,
String
fileKey
){
Map
<
String
,
FileNode
>
appender
=
Maps
.
newHashMap
();
List
<
String
>
imgUrls
=
Lists
.
newArrayList
();
Map
<
String
,
FileNode
>
appender
=
new
HashMap
<>
();
List
<
String
>
imgUrls
=
new
ArrayList
<>
();
String
baseUrl
=
BaseUrlFilter
.
getBaseUrl
();
try
{
Archive
archive
=
new
Archive
(
new
FileInputStream
(
new
File
(
filePath
)));
List
<
FileHeader
>
headers
=
archive
.
getFileHeaders
();
headers
=
sortedHeaders
(
headers
);
String
archiveFileName
=
fileUtils
.
getFileNameFromPath
(
filePath
);
List
<
Map
<
String
,
FileHeader
>>
headersToBeExtracted
=
Lists
.
newArrayList
();
List
<
Map
<
String
,
FileHeader
>>
headersToBeExtracted
=
new
ArrayList
<>
();
for
(
FileHeader
header
:
headers
)
{
String
fullName
;
if
(
header
.
isUnicode
())
{
...
...
@@ -143,8 +141,8 @@ public class ZipReader {
public
String
read7zFile
(
String
filePath
,
String
fileKey
)
{
String
archiveSeparator
=
"/"
;
Map
<
String
,
FileNode
>
appender
=
Maps
.
newHashMap
();
List
<
String
>
imgUrls
=
Lists
.
newArrayList
();
Map
<
String
,
FileNode
>
appender
=
new
HashMap
<>
();
List
<
String
>
imgUrls
=
new
ArrayList
<>
();
String
baseUrl
=
BaseUrlFilter
.
getBaseUrl
();
String
archiveFileName
=
fileUtils
.
getFileNameFromPath
(
filePath
);
try
{
...
...
@@ -152,7 +150,7 @@ public class ZipReader {
Iterable
<
SevenZArchiveEntry
>
entries
=
zipFile
.
getEntries
();
// 排序
Enumeration
<
SevenZArchiveEntry
>
newEntries
=
sortSevenZEntries
(
entries
);
List
<
Map
<
String
,
SevenZArchiveEntry
>>
entriesToBeExtracted
=
Lists
.
newArrayList
();
List
<
Map
<
String
,
SevenZArchiveEntry
>>
entriesToBeExtracted
=
new
ArrayList
<>
();
while
(
newEntries
.
hasMoreElements
()){
SevenZArchiveEntry
entry
=
newEntries
.
nextElement
();
String
fullName
=
entry
.
getName
();
...
...
@@ -187,7 +185,7 @@ public class ZipReader {
private
Enumeration
<
SevenZArchiveEntry
>
sortSevenZEntries
(
Iterable
<
SevenZArchiveEntry
>
entries
)
{
List
<
SevenZArchiveEntry
>
sortedEntries
=
Lists
.
newArrayList
();
List
<
SevenZArchiveEntry
>
sortedEntries
=
new
ArrayList
<>
();
for
(
SevenZArchiveEntry
entry
:
entries
)
{
sortedEntries
.
add
(
entry
);
}
...
...
jodconverter-web/src/main/java/cn/keking/web/controller/FileController.java
View file @
5a559aa8
...
...
@@ -3,8 +3,7 @@ package cn.keking.web.controller;
import
cn.keking.config.ConfigConstants
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.Lists
;
import
cn.keking.model.ReturnResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -16,10 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.*
;
/**
*
...
...
@@ -84,10 +80,14 @@ public class FileController {
@RequestMapping
(
value
=
"listFiles"
,
method
=
RequestMethod
.
GET
)
public
String
getFiles
()
throws
JsonProcessingException
{
List
<
Map
<
String
,
String
>>
list
=
Lists
.
newArrayList
();
List
<
Map
<
String
,
String
>>
list
=
new
ArrayList
<>
();
File
file
=
new
File
(
fileDir
+
demoPath
);
if
(
file
.
exists
())
{
Arrays
.
stream
(
Objects
.
requireNonNull
(
file
.
listFiles
())).
forEach
(
file1
->
list
.
add
(
ImmutableMap
.
of
(
"fileName"
,
demoDir
+
"/"
+
file1
.
getName
())));
Arrays
.
stream
(
Objects
.
requireNonNull
(
file
.
listFiles
())).
forEach
(
file1
->
{
Map
<
String
,
String
>
fileName
=
new
HashMap
();
fileName
.
put
(
"fileName"
,
demoDir
+
"/"
+
file1
.
getName
());
list
.
add
(
fileName
);
});
}
return
new
ObjectMapper
().
writeValueAsString
(
list
);
}
...
...
jodconverter-web/src/main/java/cn/keking/web/filter/AttributeSetFilter.java
View file @
5a559aa8
...
...
@@ -33,6 +33,8 @@ public class AttributeSetFilter implements Filter {
HttpServletRequest
httpRequest
=
(
HttpServletRequest
)
request
;
request
.
setAttribute
(
"pdfDownloadDisable"
,
ConfigConstants
.
getPdfDownloadDisable
());
request
.
setAttribute
(
"fileKey"
,
httpRequest
.
getParameter
(
"fileKey"
));
request
.
setAttribute
(
"switchDisabled"
,
ConfigConstants
.
getOfficePreviewSwitchDisabled
());
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment