小编ℛɑƒ*_*ƒæĿ的帖子

“无法执行 HTTP 请求:连接到 <bucket-name>.s3.amazonaws.com:443 失败:连接超时

我正在尝试用 java 编写一个连接到 S3 的 Lambda 函数,然后获取数据。

当我在本地运行它时,使用 main 函数它工作正常并返回结果。但是当我将其上传到 AWS lambda 并运行它时,我收到以下错误消息:

"errorMessage": "无法执行 HTTP 请求:连接到存储桶名称.s3.amazonaws.com:443 [存储桶名称.s3.amazonaws.com/52.217.1.172] 失败:连接超时", "errorType": “com.amazonaws.SdkClientException”,

我的 S3 存储桶是公开的。

我的 pom.xml:

<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk</artifactId>
    <version>1.11.493</version>
</dependency>
    <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcore</artifactId>
</dependency>
<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-lambda-java-core</artifactId>
    <version>1.1.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我的请求处理程序:

public class LambdaRequestHandler implements RequestHandler<String, String> {
@Autowired
public ClaimSuffixNumberService csService;
    @Override
    public String handleRequest(String input, Context context) {
        if(csService == null) {
            csService = Application.getBean(ClaimSuffixNumberService.class);
        }
        String result= csService.readAndMakeCall("claimSuffix");
        return result;
    }
}
Run Code Online (Sandbox Code Playgroud)

我的服务

public String getObject(String fileName) …
Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services aws-sdk aws-lambda aws-java-sdk

10
推荐指数
2
解决办法
5万
查看次数

如何防止元素脱离DOM错误?

我们有 cypress/jsf 和两个 PrimeFaces-Autocompletes 的计时问题。我们的设施输入取决于所选元素。选择一个元素时,发送AJAX请求,并更新工具字段。(请参阅下面的代码示例 - xhtml)

我们的 cypress 测试首先选择一个元素,然后想要选择一个设施。但是,设施输入字段无法清除,因为它与 DOM 分离。错误消息是:“CypressError:重试超时:cy.clear() 失败,因为此元素与 DOM 分离。” 我们已经在等待ajax请求(使用cy.route)但问题仍然存在。(见下面的代码示例 - javascript)

我们如何防止相关输入字段的分离错误?

<!-- element -->
<p:outputLabel id="elementLabel" for="element" value="#{i18n.element}" />
<p:autoComplete id="element" value="#{bean.selectedElement}"
                  dropdown="true"completeMethod="#{bean.completeElement}"
                  var="element" itemValue="#{element}" itemLabel="#{element}">
    <p:ajax event="itemSelect" listener="#{bean.updateFacility()}" 
    partialSubmit="true" process="@this" update="facility"/>
</p:autoComplete>

<!-- facility -->
<p:outputLabel id="facilityLabel" for="facility" value="#{i18n.facility}" />
<p:autoComplete id="facility" value="#{bean.selectedFacility}" required="false"
                dropdown="true" completeMethod="#{bean.completeFacility}"
                var="facility" itemValue="#{facility}" itemLabel="#{facility}" >
</p:autoComplete>
Run Code Online (Sandbox Code Playgroud)

Javascript:

cy.route({
    method: 'POST', url: '/app/dummy.xhtml'
}).as('request')
cy.selectOptionLoadingAlias('#element_input', '#element_1', '@request')
cy.selectOptionLoadingAlias('#facility_input', '#facility_1', '@request')

Cypress.Commands.add("selectOptionLoadingAlias", (inputField, selectOption, alias) => {
    cy.get(inputField).should('be.visible').clear().type('Dummy …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jsf primefaces cypress

10
推荐指数
1
解决办法
2910
查看次数

Swagger/OpenAPI 注释 V3 - 在 swagger 注释中使用枚举值

我正在使用从以下依赖项导入的 Swagger/OpenApi V3 注释创建我们应用程序的 API 描述:

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.1.45</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

其中一个注解是一个@Schema注解,它接受一个名为allowableValues允许字符串数组的属性:

@Schema(description = "example", 
        allowableValues = {"exampleV1", "exampleV2"}, 
        example = "exampleV1", required = true)
private String example;
Run Code Online (Sandbox Code Playgroud)

现在我想使用在我们的 Enum 类上构造的自定义方法,该方法返回允许的字符串数组,因此不需要在每次向 Enum 添加类型时添加它。这样我们就可以像这样使用它:

public enum ExampleEnum {
    EXAMPLEV1, EXAMPLEV2;
    public static String[] getValues() {...}
}

@Schema(description = "example", 
        allowableValues = ExampleEnum.getValues(), 
        example = "exampleV1", required = true)
private String example;
Run Code Online (Sandbox Code Playgroud)

现在这不会编译,因为在执行注释时该方法是未知的。是否有这样的解决方案允许在 swagger V3 注释属性值中使用枚举?

查看以下资源:

您可以在全局组件部分定义可重用的枚举,并通过 $ref 其他地方引用它们。

最坏的情况是,我确实可以在一个常量位置定义它,并且在将类型添加到 Enum 之后,只需要在另一个位置添加类型。但如果可能的话,我首先想探索上述解决方案。

没有说明使用任何类或动态生成的值。

是关于在 …

java enums annotations swagger openapi

8
推荐指数
2
解决办法
7274
查看次数

Swagger Codegen basePath 被忽略

我正在尝试使用Swagger Codegen » 2.2.1生成一些 Web 服务定义

所有配置都在工作,并且我的.yaml定义正确生成了类。

为什么该属性basePath被忽略?


@RestController只使用paths定义生成:

https://springboot-base-save-return.appdes.xnet/saveBackendReturn
Run Code Online (Sandbox Code Playgroud)

预期(使用basePathpaths定义):

https://springboot-base-save-return.appdes.xnet/v1/saveBackendReturn
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?我忘记了什么吗?


我的.yaml合同:

swagger: '2.0'
info:
  description: My Project
  version: 1.0.0
  title: Save Backend Return
host: springboot-base-save-return.appdes.xnet
basePath: /v1
tags:
  - name: saveBackendReturn
    description: Save Backend Return
schemes:
  - https
paths:
  /saveBackendReturn:
    post:
      tags:
        - saveBackendReturn
      summary: Save Backend Return
      description: My Project
      operationId: saveBackendReturn
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - …
Run Code Online (Sandbox Code Playgroud)

spring yaml contract-first swagger swagger-codegen

7
推荐指数
1
解决办法
2831
查看次数

我可以在 VS Code 中为多种语言配置一个 task.json 文件吗?

我想tasks.json在 VS Code 中配置一个文件来运行 python 和 java 代码,只需按:

  • Ctrl + Shift + B

Python 和 Java 已配置,但需要两个不同的tasks.json文件。

但我只能在文件夹tasks.json中保留一个文件.vscode

如何将两个配置文件合并到一个tasks.json 文件中?

对于Python:

{
  "version": "2.0.0",
  "tasks": [{
    "label": "Compile and run",
    "type": "shell",
    "command": "",
    "args": [
      "/usr/bin/time",
      "-v",
      "--output",
      "sys.txt",
      "timeout",
      "5",
      "python3",
      "${relativeFile}",
      "<",
      "input.txt",
      ">",
      "output.txt",
    ],
    "group": {
      "kind": "build",
      "isDefault": true
    },
    "problemMatcher": {
      "owner": "py",
      "fileLocation": [
        "relative",
        "${workspaceRoot}"
      ],
      "pattern": {
        "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
        "file": 1,
        "line": …
Run Code Online (Sandbox Code Playgroud)

json visual-studio-code vscode-tasks

6
推荐指数
3
解决办法
2890
查看次数

字体大小根据单词的数量而变化

function test(data) {
  wordCount = {};
  theWords = [];
  allWords = data.match(/\b\w+\b/g); //get all words in the document

  for (var i = 0; i < allWords.length; i = i + 1) {
    allWords[i] = allWords[i].toLowerCase();
    var word = allWords[i];
    if (word.length > 5) {
      if (wordCount[word]) {
        wordCount[word] = wordCount[word] + 1;
      } else {
        wordCount[word] = 1;
      }
    }
  }
  var theWords = Object.keys(wordCount); // all words over 5 characters
  var result = "";
  for (var i = 0; …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

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

如何使用Springdata将Enum存储到Cassandra中?

我正在尝试使用Springdata框架将枚举存储到Cassandra中.这可能吗?我已经定义了我的枚举:

public enum Currency {
     GBP, 
     USD, 
     EUR
}
Run Code Online (Sandbox Code Playgroud)

然后我在字段上使用"@Enumerated"注释定义我的类:

@Table
public class BondStatic {

    @PrimaryKey
    private String id;

    private String isin;
    private String ticker;
    private Date maturity;
    private Double coupon;
    @Enumerated(EnumType.STRING)
    private Currency currency;
    ...
}
Run Code Online (Sandbox Code Playgroud)

这些是我的进口:

import com.datastax.driver.mapping.EnumType;
import com.datastax.driver.mapping.annotations.Enumerated;
Run Code Online (Sandbox Code Playgroud)

然后我有Spring的Component类:

@Component
class CassandraDataCLR implements CommandLineRunner {

    @Autowired
    public BondStaticCassandraRepository bondStaticRepository;
    ...
}
Run Code Online (Sandbox Code Playgroud)

哪个是自动装配的:

@RepositoryRestResource(path = "/bond-static")
interface BondStaticCassandraRepository extends CassandraRepository<BondStatic> { }
Run Code Online (Sandbox Code Playgroud)

这些是我的进口:

import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
Run Code Online (Sandbox Code Playgroud)

但是当我尝试运行以下内容时:

bondStaticRepository.save(bondStatics);
Run Code Online (Sandbox Code Playgroud)

我明白了:

public enum Currency {
     GBP, 
     USD, 
     EUR …
Run Code Online (Sandbox Code Playgroud)

java enums cassandra spring-data

5
推荐指数
0
解决办法
2063
查看次数

在 Red Hat JBoss Developer Studio (Devstudio) 中使用 Eclipse Marketplace Client

我想问您是否(以及如何)可以在 Red Hat JBoss Developer Studio 10.3.0.GA 中使用 Eclipse Marketplace。我试图从 [1] 安装 EMPC,但该版本看起来有点旧,之后无法运行。基本上我想将 [2] 安装到 Devstudio。我怎样才能做到这一点?我正在尝试这种拖放,但它对我不起作用。

谢谢

[1] http://download.eclipse.org/mpc/neon

[2] https://marketplace.eclipse.org/content/angular-ide

eclipse eclipse-marketplace jboss-developer-studio

5
推荐指数
2
解决办法
2166
查看次数

如何在开发过程中在 VUE-CLI 中启用控制台登录

我一直试图弄清楚如何console.log('whatever')在我的方法中学习一些 VueJs 开发,以了解我在这里所做的任何事情的一些行为。

我知道这里已经提出了一些问题,并且已经将范围纳入ESLINT文档以尝试解决这个问题......我实际上无法理解我应该做什么。

我的代码:

methods: {
    submitData() {
        this.$http.post('https://vue-testing-8a2de.firebaseio.com/data.json', this.user)
                  .then(response => {
                            console.log(response);
                        }, error => {
                            console.log(error)
                        })
    }
}
Run Code Online (Sandbox Code Playgroud)

这是 ESLINT 上的错误:

Failed to compile.

./src/App.vue
Module Error (from ./node_modules/eslint-loader/index.js):
error: Unexpected console statement (no-console) at src/App.vue:35:22:
  33 | this.$http.post('https://vue-testing-8a2de.firebaseio.com/data.json',this.user)
  34 |           .then(response => {
> 35 |                      console.log(response);
     |                      ^
  36 |                  }, error => {
  37 |                      console.log(error)
  38 |                  })


error: Unexpected console statement (no-console) at src/App.vue:37:22:
  35 | …
Run Code Online (Sandbox Code Playgroud)

javascript post eslint vuejs2 vue-cli-3

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

以MultipartFile为RequestPart的POST方法在swagger3 open-api Springboot项目中被视为String

在使用 Swagger 3 OpenAPI 的 Spring Boot 项目中。

有一个文件POST为 的方法。MultipartRequestPart

理想情况下,swagger-ui它应该要求文件上传,但仅将文件显示为String.

请帮助我上传文件而String不是swagger-ui.

我的RestController

@RestController
public class HelloController {
    @RequestMapping(method = RequestMethod.GET, value = "/api")
    public String sayHello() {
        return "Swagger Hello World";
    }
    @RequestMapping(method = RequestMethod.POST, value = "/fileUpload")
    public String fileUpload(
            @RequestPart(value = "file", required = false ) MultipartFile file,
            @RequestPart(value = "userName", required = false ) String userName
    ) {
        return "added successfully";
    } …
Run Code Online (Sandbox Code Playgroud)

java swagger spring-boot openapi swagger-3.0

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