fix url for https
This commit is contained in:
@@ -2,9 +2,6 @@ package marketing.heyday.hartmann.fotodocumentation.rest.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import marketing.heyday.hartmann.fotodocumentation.core.model.Picture;
|
||||
|
||||
@@ -20,19 +17,16 @@ import marketing.heyday.hartmann.fotodocumentation.core.model.Picture;
|
||||
|
||||
@Schema(name = "Picture")
|
||||
public record PictureValue(Long id, String comment, String category, Date pictureDate, String username, Integer evaluation, String imageUrl, String normalSizeUrl, String thumbnailSizeUrl) {
|
||||
private static final Log LOG = LogFactory.getLog(PictureValue.class);
|
||||
|
||||
public static PictureValue builder(Picture picture, String baseUrl) {
|
||||
if (picture == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LOG.error("baseUrl " + baseUrl);
|
||||
String sizeUrl = baseUrl;
|
||||
// we need to rewrite the url for dev/integ/prod since the Wildfly doesn't know we are running the nginx on https. Without the https the images are not shown
|
||||
if(baseUrl.startsWith("http://") && !baseUrl.startsWith("http://localhost")){
|
||||
LOG.error("starts with http:// ");
|
||||
sizeUrl = "https://" + baseUrl.substring(7);
|
||||
LOG.error("new baseUrl " + sizeUrl);
|
||||
}
|
||||
|
||||
sizeUrl = sizeUrl + "picture/image/" + picture.getPictureId() + "?size=";
|
||||
|
||||
@@ -108,8 +108,8 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
||||
//LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH;
|
||||
Request request = Request.Options(path).addHeader("Accept", "application/json; charset=utf-8");
|
||||
//.addHeader("Authorization", authorization)
|
||||
//.bodyFile(new File(BASE_UPLOAD + "add.json"), ContentType.APPLICATION_JSON);
|
||||
//.addHeader("Authorization", authorization)
|
||||
//.bodyFile(new File(BASE_UPLOAD + "add.json"), ContentType.APPLICATION_JSON);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
|
||||
@@ -124,18 +124,7 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
String baseUrl = "http://hartmann-cue.heydevelop.de/api/";
|
||||
//String baseUrl = "http://localhost:8080/api/";
|
||||
|
||||
String sizeUrl = baseUrl;
|
||||
System.out.println();
|
||||
if(baseUrl.startsWith("http://") && !baseUrl.startsWith("http://localhost")){
|
||||
System.out.println("starts with http:// ");
|
||||
sizeUrl = "https://" + baseUrl.substring(7);
|
||||
System.out.println("new baseUrl " + sizeUrl);
|
||||
}
|
||||
|
||||
/*
|
||||
var test = new CustomerPictureResourceTest();
|
||||
|
||||
test.deploymentURL = "http://localhost:8080/";
|
||||
@@ -143,6 +132,6 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
|
||||
test.username = "adm";
|
||||
test.password = "x1t0e7Pb49";
|
||||
|
||||
test.doTest();*/
|
||||
test.doTest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,6 +224,16 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
headers: {cred.name: cred.value},
|
||||
pictureDto.thumbnailSizeUrl,
|
||||
fit: BoxFit.contain,
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
value: loadingProgress.expectedTotalBytes != null
|
||||
? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes!
|
||||
: 0,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -232,8 +242,7 @@ class _CustomerWidgetState extends State<CustomerWidget> {
|
||||
flex: 3,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(pictureDto.thumbnailSizeUrl),
|
||||
//FIXME: child: Text(pictureDto.comment ?? "", style: dataStyle),
|
||||
child: Text(pictureDto.comment ?? "", style: dataStyle),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
|
||||
@@ -54,6 +54,16 @@ class PictureFullscreenDialog extends StatelessWidget {
|
||||
child: Image.network(
|
||||
headers: {cred.name: cred.value},
|
||||
dto.imageUrl,
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
value: loadingProgress.expectedTotalBytes != null
|
||||
? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes!
|
||||
: 0,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -158,6 +158,16 @@ class _PictureWidgetState extends State<PictureWidget> {
|
||||
headers: {cred.name: cred.value},
|
||||
dto.normalSizeUrl,
|
||||
fit: BoxFit.contain,
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
value: loadingProgress.expectedTotalBytes != null
|
||||
? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes!
|
||||
: 0,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user