小编und*_*ned的帖子

在百里香弹簧框架中插入本地目录中的图像(使用maven)

我使用这个链接开发了一个项目:https://spring.io/guides/gs/serving-web-content/我用maven来开发上面的项目.

我有两个html文件.abc.html和xyz.html.要在html页面中插入图像,我使用了这样的URL:

<img src="https://example.com/pic_mountain.jpg" alt="Mountain View" style="width:304px;height:228px">
Run Code Online (Sandbox Code Playgroud)

但我想使用位于我的服务器中的图像文件.我尝试将文件放在html文件的同一目录中,但它无法正常工作.我甚至试图给出完整的路径但没有用.这是一个ubuntu操作系统.请帮帮我.有没有我可以配置基本路径的地方或基本上如何从我的本地文件夹中放置图像.

html spring maven thymeleaf

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

自动化Rest API测试并将其与持续集成(CI-Jenkins)集成

我发现了许多与此相关的类似问题......但不是我要找的具体答案.实际上我的要求没什么不同.所以张贴这个.

我想自动化Rest API,我有两个相同的选项.第一个是Rest Assured,第二个是Play框架.

对于exa.测试这个RestAPI,

http://servername:9000/dbs/all/list/m1/p1/sch1
Run Code Online (Sandbox Code Playgroud)

(这给出了xml响应)我用Java保证编写了一个代码,并且工作正常.我将它与Maven项目集成在一起,以便与Jenkins整合.示例代码:

   import com.jayway.restassured
    public class TestNGSimpleTest2 {

        @Test
        public void testApi() {
                expect().
                statusCode(200).
                body("Status", equalTo("Su22ccess")).
                when().
                get("http://localhost:9000/dbs/all/list/m1/p1/sch1");

        }
Run Code Online (Sandbox Code Playgroud)

所以我的第一个问题是:1.放心使用是最好的工具吗?2. Play框架更好吗?3.我发现了许多其他工具,如Jmeter,RightAPI等来测试RestAPI.但我不认为这是自动化的.我对吗?

api rest playframework jenkins rest-assured

11
推荐指数
2
解决办法
7067
查看次数

尽管在ag-grid中使用sizeColumnsToFit,也不必要的水平滚动条出现了

我已将农业网格版本从7.2.0升级到v14.2.0。当我将sizeColumnsToFit()api与onGridReadyonGridSizeChangedevent 一起使用时,它可以工作,但可以保持不必要的水平滚动,这可能是由于网格宽度计算错误所致。

这个问题(?)也可以在此处的ag-grid官方示例中看到,

https://www.ag-grid.com/javascript-grid- responseness /#example-example1

不必要的滚动

在以前的版本中,无需任何水平滚动即可完全正常工作。

当我手动调用时$scope.gridOptions.api.sizeColumnsToFit(),它将删除水平滚动。

这是我的gridOptions:

        $scope.ag_grid_options = {
            headerHeight: 50,
            rowHeight: 50,
            //rowModelType: 'virtual',
            rowModelType: 'infinite',
            rowBuffer: 0,
            cacheOverflowSize: 1,
            infiniteInitialRowCount: 1,
            cacheBlockSize: 50,
            paginationPageSize: 50,
            //virtualPaging: true,
            enableServerSideSorting: true,
            enableSorting: false,
            enableColResize: true,
            angularCompileRows: true,
            onGridSizeChanged: function (param) {
                $scope.ag_grid_options.api.doLayout();
                $scope.ag_grid_options.api.sizeColumnsToFit();
            },
            columnDefs: grid_column_definitions
        };
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用属性preventHorizo​​ntalScroll = true。但是我不想使用它,因为有了它,当用户手动调整列大小时,滚动将不会出现。

javascript angularjs ag-grid

8
推荐指数
3
解决办法
3116
查看次数

请在 docker npm test 中设置“CHROME_BIN”环境变量

'npm run test' 在服务器或我的本地工作完全正常,但在我的 docker 机器上失败。我对这个 docker 世界有点陌生,所以我只是对这里出了什么问题感到困惑。我收到错误:

Post stage
[32m15 07 2018 18:41:35.164:INFO [karma]: [39mKarma v1.2.0 server started at http://localhost:9876/
[32m15 07 2018 18:41:35.169:INFO [launcher]: [39mLaunching browser ChromeHeadless with unlimited concurrency
[32m15 07 2018 18:41:35.185:INFO [launcher]: [39mStarting browser ChromeHeadless
[31m15 07 2018 18:41:35.186:ERROR [launcher]: [39mNo binary for ChromeHeadless browser on your platform.
  Please, set "CHROME_BIN" env variable.

Finished in 0 secs / 0 secs @ 18:41:35 GMT+0000 (UTC)

npm ERR! code ELIFECYCLE
Run Code Online (Sandbox Code Playgroud)

我发现在某个地方,它可能缺少 chrome .. 所以我在我的 docker 中手动安装了 chrome: …

automated-tests node.js npm jenkins docker

8
推荐指数
1
解决办法
1万
查看次数

eslint 命令在 CI 服务器上失败,错误为“ESLint 找不到要扩展的配置“标准””

我有 eslint 配置,它在我的本地设置(使用 vscode 编辑器)上运行得非常好。

但是在 CI 服务器上,它失败并显示以下错误:

  eslint:config-array-factory Config file found: /home/worker/workspace/-CI-CD-Pipeline-Node-Ts_DC-705/.eslintrc.json +0ms
  eslint:config-array-factory Loading {extends:"standard"} relative to /home/worker/workspace/-CI-CD-Pipeline-Node-Ts_DC-705/.eslintrc.json +1ms

Oops! Something went wrong! :(

ESLint: 6.6.0.

ESLint couldn't find the config "standard" to extend from. Please check that the name of the config is correct.

The config "standard" was referenced from the config file in "/home/worker/workspace/-CI-CD-Pipeline-Node-Ts_DC-705/.eslintrc.json".

If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team.
Run Code Online (Sandbox Code Playgroud)

我正在运行以下命令来 lint:

./node_modules/.bin/eslint ./ --ext .ts

我看到 git …

node.js typescript eslint

8
推荐指数
1
解决办法
5006
查看次数

如何测试Rest API需要身份验证的Rest API

我想在获取Json响应之前测试需要身份验证的Rest API.对于exa.如果我想访问rest API: http://192.168.xx.xx:9000/dashboards/all/list/m1/p1/sch1

然后

如果我还没有登录,那么这会将我重定向到Login HTML页面,登录后,这将显示Json输出.

现在我想在java中编写一个放心的代码:我不知道,这是否可以使用此方法进行登录.

所以我写了一个简单的代码::

public class TestNGSimpleTest1 {

    @Test
    public void testAdd() {
            //expect().
            //statusCode(400).
            //body("Status", equalTo("Success")).
            //when().
            //get("http://localhost:9000/dashboards/all/list/m1/p1/sch1");
            //System.out.println("Response received is ::" +res);   
            Response res = get("http://localhost:9000/dashboards/all/list/m1/p1/sch1");
            assertEquals(200,res.getStatusCode());
            String json = res.asString();
            System.out.println("Response received is :: " +json);
    }
Run Code Online (Sandbox Code Playgroud)

所以这里得到的是HTML源页面响应,而不是获得Json响应.

所以,我的问题是如果可能的话,如何登录并获得Json响应.

提前致谢.

java rest testng json rest-assured

7
推荐指数
3
解决办法
4万
查看次数

ng-repeat忽略立即ng-if

我已经和Angular JS合作了很长时间,但刚刚面临一个奇怪的问题,ng-if只是被忽略了ng-repeat.

这是示例和简单代码,它不能按预期工作

<ul ng-repeat="detail in details">
  <span ng-if="2 == 3"> <!-- This should block the next tags to execute-->
    <li>{{detail.name}}
      <ul ng-repeat="detailed in details.name">
        <li>{{detailed.prof}}</li>
      </ul>
    </li>
  </span>
  <span ng-if="2 === 2"> <!-- Instead this should get print -->
    Print this (Updated)
  </span>
</ul>
Run Code Online (Sandbox Code Playgroud)

这是我的plunkr:https://plnkr.co/edit/xy4Qyd4tXm6kWROiaFVR p = preview

javascript angularjs ng-repeat

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

502在nginx代理上使用Node JS运行的服务器出现错误网关错误

我收到502错误的网关错误:当我检查nginx错误日志时,我发现:

2017/05/06 02:36:04 [错误] 48176#0:*135连接()失败(111:连接被拒绝)连接上游时,客户端:10.163.XX.X,服务器:abc-def-ghi,请求:"GET /favicon.ico HTTP/1.1",上游:" https://127.0.0.1:5300/favicon.ico ",主机:"hostnname",referrer:"hostname-1

我搜索足够的互联网但找不到任何东西.这里需要注意的一点是,这种间歇性错误仅在特定页面上出现.

这可能是代码问题吗?或nginx配置问题>任何人都可以在这里帮助我.

我的一些nginx conf:

  upstream node_api_server {
    server localhost:5300 fail_timeout=0;
  }

location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_read_timeout 5m;
    proxy_connect_timeout 5m;
    proxy_pass_header Set-Cookie;

    proxy_pass https://node_api_server;
    proxy_redirect off;
    proxy_buffer_size   128k;
    proxy_buffers   4 256k;
    proxy_busy_buffers_size   256k;
    break;
}
Run Code Online (Sandbox Code Playgroud)

nginx node.js express

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

等待所有不同的承诺完成nodejs(async await)

我目前正在等待所有承诺按顺序完成:

(async() => {
  let profile = await profileHelper.getUserData(username);
   let token = await tokenHelper.getUserToken(username);
   console.log(profile);
   console.log(token);
   return {profile: profile, token: token};
})();
Run Code Online (Sandbox Code Playgroud)

但是这样,配置文件和令牌按顺序执行.由于两者彼此独立,我希望它们两者一起独立执行.我认为这可以使用Promise.all完成,但我不确定语法,我也找不到任何帮助.

所以我的问题是如何将上面的api调用转换为一起运行然后返回最终输出.

javascript asynchronous node.js async-await

7
推荐指数
3
解决办法
8566
查看次数

ag-grid 列搜索不适用于对象作为单元格值

我正在使用 cell_renderer 来定义我的单元格,如下所示:

        var cell_renderer = function(params) {
            var element = "";
            var values = params.value;
                angular.forEach(values, function(each_param){
                    element += '<a href="#/workunit/' + each_param.id + '" target="_blank">' + each_param.id +
                            '<span class="text-danger text-bold">'+
                            '<span class="" title="' + inactive_message +
                            '">' + inactive_flag + ' </span>' +
                            '<span class="" title="' + misconfigured_message +
                            '"> ' +misconfigured_flag + '</span>'+
                            '</span></a><br>';
                })
            return element;
        };
Run Code Online (Sandbox Code Playgroud)

我的列定义是这样的:

                var testObject = {};
                testObject.headerName = "my header";
                testObject.field = each_branch;
                testObject.width = 200;
                testObject.cellClassRules = cell_class_rules; …
Run Code Online (Sandbox Code Playgroud)

angularjs ag-grid

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