小编Cha*_*ith的帖子

chrome的user.agent值

快问.使用gwt 2.4的chrome浏览器的user.agent值是多少?我试图限制我的chrome的排列并且它不编译(使用的值 - 'chrome').但是这个编译正确

<set-property name="user.agent" value="safari" />   
Run Code Online (Sandbox Code Playgroud)

javascript gwt google-chrome-devtools

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

AWS Lambda无服务器框架错误"无法找到模块"

我正在尝试使用无服务器框架来创建使用开放天气NPM模块的Lambda函数.但是,我得到以下异常,但我的node_modules包含特定的库.

我成功运行了样本,(https://github.com/serverless/examples/tree/master/aws-node-rest-api-with-dynamodb),现在黑客添加节点模块来集成开放天气API .

Endpoint response body before transformations: {"errorMessage":"Cannot find module 'Openweather-Node'","errorType":"Error","stackTrace":["Module.require (module.js:353:17)","require (internal/module.js:12:17)","Object.<anonymous> (/var/task/todos/weather.js:4:17)","Module._compile (module.js:409:26)","Object.Module._extensions..js
Run Code Online (Sandbox Code Playgroud)

我的代码

'use strict';

  const AWS = require('aws-sdk'); // eslint-disable-line import/no-extraneous-dependencies
  var weather = require('Openweather-Node');

  const dynamoDb = new AWS.DynamoDB.DocumentClient();

  module.exports.weather = (event, context, callback) => {
    const params = {
      TableName: process.env.DYNAMODB_TABLE,
      Key: {
        id: event.pathParameters.id,
      },
    };

    weather.setAPPID("mykey");
    //set the culture
    weather.setCulture("fr");
    //set the forecast type
    weather.setForecastType("daily");

    const response = {
      statusCode: 200,
      body: "{test response}",
    };
    callback(null, response);          
  };
Run Code Online (Sandbox Code Playgroud)

amazon-web-services node.js aws-sdk aws-lambda serverless-framework

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

创建一个接受POST和GET的Jax-RS RESTful服务?

我正在将我现有的一项服务转换为RESTful,并且我已经使用了RestEasy的基本功能.我的一些客户端应用程序应该能够对多个服务执行GET和POST请求.我只是想找到一个简单的方法来解决jax-rs指定API应该同时接受GET和POST的问题.下面你可以找到一个测试方法,如果你看到任何方法而没有在@GET和@QueryParam的另一个类中复制它,请告诉我.

@POST
@Path("/add")
public Response testREST(@FormParam("paraA") String paraA,
        @FormParam("paraB")  int paraB) {

    return Response.status(200)
            .entity("Test my input : " + paraA + ", age : " + paraB)
            .build();

}
Run Code Online (Sandbox Code Playgroud)

rest jax-rs jersey java-ee resteasy

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

IntelliJ IDE中具有@RequiredArgsConstructor错误的实体

我正在尝试运行示例Spring引导应用程序,并且遇到了在我的IDE上标记为@RequiredArgsConstructor的实体的问题。我在Java 1.8上使用最新的intelliJ IDEA(14.1)。当我尝试使用构造函数参数初始化实体时,在IDE上标记了一个错误。

例如,将在下一行显示“无法解析符号”。

itemRepository.save(new Item("MacBook Pro"));
Run Code Online (Sandbox Code Playgroud)

我的实体如下。

@Entity
@Data
@RequiredArgsConstructor
public class Item {

    private @Id @GeneratedValue Long id;
    private final String description;

    Item() {
        this.description = null;
    }
}
Run Code Online (Sandbox Code Playgroud)

除了IDE错误之外,项目的构建和正常运行。

java spring intellij-idea spring-data spring-boot

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

在版本7.0.27之后,Tomcat不会进行流式处理?

我发现我的flex应用程序在tomcat版本$ subject之后不再起作用了.请帮我解决这个问题.我尝试了许多事情但没有成功.

这是我的配置.

Blaze - 4.x Tomcat - 最新 - 7.0.32 Java 7

应用程序挂起没有任何错误或任何东西.它从7.0.32再次起作用.我检查了tomcat发行说明(http://tomcat.apache.org/tomcat-7.0-doc/changelog.html)并将问题排除在Coyote jar文件之外.

当我将Coyote.jar从版本7.0.27替换为7.0.32时,它可以正常工作.

以下是Coyote的变化(http://tomcat.apache.org/tomcat-7.0-doc/changelog.html)

52858: Correct fix for high CPU load (fhanik)
53138: Broken Sendfile on SSL introduced in 7.0.27 (fhanik)
52055: Additional fix required to ensure that InputFilters are recycled between requests. (markt)
53061: Fix a problem in the NIO connector whereby if the poller was under low but consistent load (>1 request/per second and always less than 1 second between requests) …
Run Code Online (Sandbox Code Playgroud)

apache-flex tomcat blazeds java-ee tomcat7

3
推荐指数
1
解决办法
1546
查看次数

InvalidDataAccessApiUsageException:执行更新/删除查询Spring XML to Java config

我正在尝试将spring xml配置转换为java配置.这通过XML配置完美地工作.但是,如果我使用java config initializer,它会抛出以下异常.当它尝试运行JQL时会发生这种情况.应用程序正常启动(初始化所有JPA映射).

org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:410) [spring-orm-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:216) [spring-orm-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:417) [spring-orm-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.dao.support.ChainedPersistenceExceptionTranslat
Run Code Online (Sandbox Code Playgroud)

以下是我的持久化初始化类.一点点阅读建议我这与交易没有正确启动有关.我已经将调试点放到这些方法中,但是在服务器启动期间或之后的任何时间都不会执行transactionManager方法.我不确定我做错了什么:(.当通过persistence.xml初始化持久性时,基于相同代码的工作非常完美.

@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(basePackages = "au.mypkg")
public class DatabaseConfig  {


    @Bean(name = "dataSource")
    @Primary
    public DataSource dataSource() throws Exception {
        Context ctx = new InitialContext();
        return (DataSource) ctx.lookup("java:jboss/datasources/mydb");
    }

    @PersistenceContext(unitName = "persistenceUnit")
    @Primary
    @Bean(name = "entityManagerFactory")
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws Exception {
    ..........

    @Primary
    @Bean(name = "transactionManager")
    public PlatformTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { …
Run Code Online (Sandbox Code Playgroud)

spring hibernate spring-transactions spring-data-jpa spring-java-config

3
推荐指数
2
解决办法
8591
查看次数