小编Hel*_*oem的帖子

onResourceReceived两次记录每个资源?

我正在尝试使用phantomjs来获取有关竞争条件影响页面的可能性的一些指标,我有2个脚本文件,我的网站上托管的某些功能依赖于来自第三方的文件设置的一些全局变量.

我认为,在phantomjs使用onResourceReceived我可以登录,当每个文件加载,然后运行该测试一堆次获得的这种竞争情况会如何往往导致问题的想法,我的代码的例子如下(它不是实际的代码而且我不隶属于BBC):

(function (p, wp) {
  "use strict";
  var page, start,
    count = 0, max = 10,
    webpage = require('webpage'),
    url = "http://www.bbc.co.uk";

  function process() {
    if (max == count) {
      console.log('done processing!');
      p.exit();
    } else {
      count++;
      start = new Date();
      page = wp.create();
      page.onResourceReceived = onResourceReceived;
      page.open(url, onOpen);
    }
  }

  function onResourceReceived(response) {
    var match, t = new Date(),
    url = response.url,
    status = response.status;
    t = t.valueOf() - start.valueOf();
    if (!!(match = url.match(/locator\.css/))) {
      console.log(match[0] + ': …
Run Code Online (Sandbox Code Playgroud)

javascript phantomjs

9
推荐指数
1
解决办法
1791
查看次数

为几乎所有路线配置dropwizard到服务器index.html?

我正在构建一个单页面应用程序,它在客户端和后端执行所有html请求路由,它使用dropwizard来提供一堆JSON服务.

基本上我无法使用dropwizard中的码头为每个请求提供index.html服务,但以下路径除外:

  /css
  /i18n
  /img
  /js
  /lib
  /services
  /templates
Run Code Online (Sandbox Code Playgroud)

事实上,我在查找文档时遇到了很多麻烦,这些文档告诉您如何设置任何http路由.(我不是一个java人).

这是我简单的yaml配置:`

http:
  port: 8082
  adminPort: 8083
  rootPath: /service/*`
Run Code Online (Sandbox Code Playgroud)

我需要添加什么才能实现这一目标.

谢谢

java configuration jetty dropwizard

9
推荐指数
1
解决办法
7017
查看次数

使用scm-maven-plugin时如何在pom中指定提交消息?

我正在尝试使用maven SCM插件在自动构建期间将一些文件提交到git repo,插件需要将提交消息设置为系统属性,我不想在命令上传递此信息line(我也使用release插件,这会导致问题).

我已经尝试了所有我想通过pom添加消息系统属性但没有运气,这是我的pom的精简版本:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.monkeys.coding</groupId>
    <artifactId>project</artifactId>
    <packaging>js</packaging>
    <version>1.0.4-SNAPSHOT</version>

    <name>Some Project</name>
    <description>Some Project where I want to add files to git during build</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <projectVersion>${project.version}</projectVersion>
    </properties>

    <scm>
        <connection>scm:git:http://some.git.repo:9080/git/module.git</connection>
        <developerConnection>scm:git:http://some.git.repo:9080/git/module.git</developerConnection>
        <url>http://some.git.repo:9080/git/module.git</url>
    </scm>

    <build>
        <finalName>${project.artifactId}</finalName>
        <!-- Package as js -->
        <extensions>
            <extension>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>javascript-maven-plugin</artifactId>
                <version>2.0.0-alpha-1</version>
            </extension>
        </extensions>
    ...
    </build>

    <profiles>
        <!-- run this profile when releasing the library -->
        <profile>
            <id>release</id>
            <properties>
                <message>Add version files to git</message>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId> …
Run Code Online (Sandbox Code Playgroud)

git commit system-properties maven-3 maven-scm

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