小编Opt*_*tio的帖子

如何调试从 HTTP 到 HTTPS 的 Kubernetes nginx Ingress 重定向

快速问题:我如何调试入口和 Nginx 以了解 HTTP->HTTPS 重定向发生的确切位置?

更多细节:

我们有什么:我们有 war 文件 + Tomcat,用 Docker 构建它。在 AWS 中使用 Kubernetes 运行它。

我们需要的是:应用程序应该可以通过 HTTP 和 HTTPS 访问。HTTP不应重定向到 HTTPS。

问题:HTTP 总是重定向到 HTTPS。

我们的尝试:我们有 Ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ${some name
  namespace: ${some namespace}
  labels:
    app: ${some app}
    env: ${some env}
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false" #we added this for turn off https redirection
    nginx.ingress.kubernetes.io/force-ssl-redirect: "false" #we added this for turn off https redirection
    nginx.ingress.kubernetes.io/affinity: "cookie" # We use it for sticky …
Run Code Online (Sandbox Code Playgroud)

https nginx kubernetes kubernetes-ingress nginx-ingress

6
推荐指数
1
解决办法
2338
查看次数

如何使用 Hibernate Criteria 在 Postgresql JSON 中进行搜索并与横向一起使用

在客户端,我们有使用过滤器搜索的端点。

在后端,我有在 Postgresql DB 中搜索的方法。选项之一 - 搜索 jsonb 字段。

在这一天之前,我搜索了valueskeys。我的代码是:

if (appFilter.getSearchValue() != null) {
    criteria.add(Restrictions.sqlRestriction("UPPER(values::text) LIKE '%" + appFilter.getSearchValue().toUpperCase() + "%'"));
}
Run Code Online (Sandbox Code Playgroud)

SQL 模拟(UPPER- 不是强制性的):

SELECT *
FROM application
WHERE UPPER(values :: TEXT) LIKE '%some text%'
Run Code Online (Sandbox Code Playgroud)

现在我需要搜索values。用于此目的的 SQL 查询:

SELECT *
FROM application, LATERAL json_each_text(application.values :: JSON)
WHERE value :: TEXT LIKE '%some text%';
Run Code Online (Sandbox Code Playgroud)

我如何将其添加到限制中?也许还有其他用于搜索值的变体?休眠 5.0.12

java postgresql json hibernate hibernate-criteria

5
推荐指数
1
解决办法
762
查看次数

更改图像布局或使用Apache POI包装在DOCX中

我以编程方式将图像粘贴到docx中。但是结果是布局不适合我。面临缺乏文档的情况。我需要更改图像换行(布局)。例如现在我有这个:

在此处输入图片说明

但是要这样:

在此处输入图片说明

UPD1:我的工作:依次遍历各段,然后遍历各个运行,并找到带有特殊书签的特定运行。在此运行中,我添加图片:

XWPFPicture pic =  run.addPicture(
        new ByteArrayInputStream(picSource),
        Document.PICTURE_TYPE_PNG,
        "pic",
        Units.toEMU(100),
        Units.toEMU(30));
Run Code Online (Sandbox Code Playgroud)

UPD2:研究了此类内的一些有趣的东西:

org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor
Run Code Online (Sandbox Code Playgroud)

方法setWrapTight(CTWrapTight var1)。可能是这样。仍然不知道如何将其应用于我的代码。

UPD3:最终我来到了这里(currentRun-运行我们的图片):

    CTWrapTight ctWrapTight = currentRun.getCTR().getDrawingList().get(0).addNewAnchor().addNewWrapTight();
 CTWrapPath ctWrapPath = ctWrapTight.addNewWrapPolygon();

 CTPoint2D ctStart = ctWrapPath.addNewStart();
 ctStart.setX(0L);
 ctStart.setY(0L);

 CTPoint2D ctLineTo1 = ctWrapPath.addNewLineTo();
 CTPoint2D ctLineTo2 = ctWrapPath.addNewLineTo();
 CTPoint2D ctLineTo3 = ctWrapPath.addNewLineTo();

 ctLineTo1.setX(21384L);
 ctLineTo1.setY(20520L);

 ctLineTo2.setX(21384L);
 ctLineTo2.setY(0L);

 ctLineTo3.setX(0L);
 ctLineTo3.setY(0L);

ctWrapTight.setWrapText(STWrapText.BOTH_SIDES);
Run Code Online (Sandbox Code Playgroud)

但是当我尝试打开它时,它会分解文档:

我们很抱歉。我们无法打开文档,因为我们发现其内容存在问题。

依赖关系是:

<dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.17</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.17</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>ooxml-schemas</artifactId>
        <version>1.3</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

java docx apache-poi

2
推荐指数
1
解决办法
1403
查看次数