add maxInMemorySizeInBytes
This commit is contained in:
parent
169f0a71ff
commit
af0a6655c6
|
@ -29,7 +29,10 @@ public class PdfServiceImpl implements PdfService {
|
||||||
WebClient webClient = WebClient.builder().filters(exchangeFilterFunctions -> {
|
WebClient webClient = WebClient.builder().filters(exchangeFilterFunctions -> {
|
||||||
exchangeFilterFunctions.add(logRequest());
|
exchangeFilterFunctions.add(logRequest());
|
||||||
exchangeFilterFunctions.add(logResponse());
|
exchangeFilterFunctions.add(logResponse());
|
||||||
}).baseUrl(pdfServiceProperties.getUrl()).build();
|
}).baseUrl(pdfServiceProperties.getUrl()) .codecs(codecs -> codecs
|
||||||
|
.defaultCodecs()
|
||||||
|
.maxInMemorySize(this.pdfServiceProperties.getMaxInMemorySizeInBytes())
|
||||||
|
).build();
|
||||||
MultipartBodyBuilder builder = new MultipartBodyBuilder();
|
MultipartBodyBuilder builder = new MultipartBodyBuilder();
|
||||||
builder.part("files", new ByteArrayResource(file)).filename(UUID.randomUUID() + ".docx");
|
builder.part("files", new ByteArrayResource(file)).filename(UUID.randomUUID() + ".docx");
|
||||||
|
|
||||||
|
@ -47,7 +50,7 @@ public class PdfServiceImpl implements PdfService {
|
||||||
|
|
||||||
private static ExchangeFilterFunction logRequest() {
|
private static ExchangeFilterFunction logRequest() {
|
||||||
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
|
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
|
||||||
logger.debug(new MapLogEntry("Request").And("method", clientRequest.method()).And("url", clientRequest.url()));
|
logger.debug(new MapLogEntry("Request").And("method", clientRequest.method().toString()).And("url", clientRequest.url()));
|
||||||
return Mono.just(clientRequest);
|
return Mono.just(clientRequest);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -57,7 +60,7 @@ public class PdfServiceImpl implements PdfService {
|
||||||
if (response.statusCode().isError()) {
|
if (response.statusCode().isError()) {
|
||||||
return response.mutate().build().bodyToMono(String.class)
|
return response.mutate().build().bodyToMono(String.class)
|
||||||
.flatMap(body -> {
|
.flatMap(body -> {
|
||||||
logger.error(new MapLogEntry("Response").And("method", response.request().getMethod()).And("url", response.request().getURI()).And("status", response.statusCode()).And("body", body));
|
logger.error(new MapLogEntry("Response").And("method", response.request().getMethod().toString()).And("url", response.request().getURI()).And("status", response.statusCode()).And("body", body));
|
||||||
return Mono.just(response);
|
return Mono.just(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,22 @@ import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||||
|
|
||||||
@ConfigurationProperties(prefix = "pdf.converter")
|
@ConfigurationProperties(prefix = "pdf.converter")
|
||||||
public class PdfServiceProperties {
|
public class PdfServiceProperties {
|
||||||
private final String url;
|
private String url;
|
||||||
|
private int maxInMemorySizeInBytes;
|
||||||
@ConstructorBinding
|
|
||||||
public PdfServiceProperties(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxInMemorySizeInBytes() {
|
||||||
|
return maxInMemorySizeInBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxInMemorySizeInBytes(int maxInMemorySizeInBytes) {
|
||||||
|
this.maxInMemorySizeInBytes = maxInMemorySizeInBytes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -971,8 +971,8 @@ public class WordBuilderImpl implements WordBuilder {
|
||||||
PositionInParagraph startPos = new PositionInParagraph(0, 0, 0);
|
PositionInParagraph startPos = new PositionInParagraph(0, 0, 0);
|
||||||
while((foundTextSegment = this.searchText(paragraph, textToFind, startPos)) != null) { // search all text segments having text to find
|
while((foundTextSegment = this.searchText(paragraph, textToFind, startPos)) != null) { // search all text segments having text to find
|
||||||
|
|
||||||
System.out.println(foundTextSegment.getBeginRun()+":"+foundTextSegment.getBeginText()+":"+foundTextSegment.getBeginChar());
|
logger.debug(foundTextSegment.getBeginRun()+":"+foundTextSegment.getBeginText()+":"+foundTextSegment.getBeginChar());
|
||||||
System.out.println(foundTextSegment.getEndRun()+":"+foundTextSegment.getEndText()+":"+foundTextSegment.getEndChar());
|
logger.debug(foundTextSegment.getEndRun()+":"+foundTextSegment.getEndText()+":"+foundTextSegment.getEndChar());
|
||||||
|
|
||||||
// maybe there is text before textToFind in begin run
|
// maybe there is text before textToFind in begin run
|
||||||
XWPFRun beginRun = paragraph.getRuns().get(foundTextSegment.getBeginRun());
|
XWPFRun beginRun = paragraph.getRuns().get(foundTextSegment.getBeginRun());
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
pdf:
|
pdf:
|
||||||
converter:
|
converter:
|
||||||
url: ${PDF_CONVERTER_URL}
|
url: ${PDF_CONVERTER_URL}
|
||||||
|
maxInMemorySizeInBytes: 6554000
|
Loading…
Reference in New Issue