小编J.O*_*sen的帖子

如何使用python迭代webapp RequestHandler中的所有请求头?

我需要遍历所有请求标头对象并在App Engine中打印它.尝试使用循环时出错.如何正确地做到这一点?

class MainHandler(webapp.RequestHandler):
    def get(self):
        for e in self.request.headers:
            self.request.headers(e + "<br />")
Run Code Online (Sandbox Code Playgroud)

我收到错误: AttributeError: EnvironHeaders instance has no __call__ method

python google-app-engine

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

不能使用char类型的ArrayList作为方法的参数

无法定义ArrayList<char>为参数validate.为什么不能这样做?尝试ArrayList<?>时有效.为什么?应该ArrayList<?>用来代替ArrayList<char>?有什么不同?

public boolean validate(ArrayList<char> args){ ... }
Run Code Online (Sandbox Code Playgroud)

错误: Syntax error on token "char", Dimensions expected after this token

java generics

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

如何使用开发者工具在 Chrome 中保存所有缓存的图像

/我需要将 Chrome 中的所有缓存图像保存到本地文件夹。我有Developer ToolsRecources > Frames > Folder123 > Images大量的图片。将每个保存为: 1. Open in a new tab2. 然后Save as.... 有没有可以更快地获取所有图像?

更新:

也许这可以使用 Firefox 更轻松地完成?

google-chrome developer-tools

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

类没有@TestExecutionListeners

我将尝试测试我的端点中的一个方法(spring 3.1,junit 4.11)以下是我的代码:applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns: p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc     
http://www.springframework.org/schem...ng-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-3.0.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schem...ring-cache.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

<context:component-scan base-package="app.controller, app.samples" />
<context:annotation-config/>
<annotation-driven />

</beans>
Run Code Online (Sandbox Code Playgroud)

和测试类:

package app.tests;
import app.samples.TableEndpoint;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autow ired;
import org.springframework.test.context.ContextConfigurat ion;
import org.springframework.test.context.junit4.SpringJUni t4ClassRunner;

@ContextConfiguration(locations = {"classpath:/WEB-INF/applicationContext.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
public class TableTest {

public TableTest() {
}
@Autowired
TableEndpoint tableEndpoint;
@Test
public void testTableEndpoint(){
String result = tableEndpoint.getDane().get(0); …
Run Code Online (Sandbox Code Playgroud)

spring unit-testing junit4

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

java.lang.IllegalStateException:Autowired annotation需要至少一个参数

无法自动装配和运行Spring Web应用程序.

错误:

java.lang.IllegalStateException: Autowired annotation requires at least one argument: public main.java.com.springapp.mvc.controller.DSLRServletController()
Run Code Online (Sandbox Code Playgroud)

DSLRServletController:

package main.java.com.springapp.mvc.controller;

import main.java.com.springapp.mvc.dao.DSLRDAO;
import main.java.com.springapp.mvc.model.DSLR;
import main.java.com.springapp.mvc.pckg.DSLRForm;
import main.java.com.springapp.mvc.pckg.DSLRValidaor;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;

@Controller
public class DSLRServletController   {
    static Logger logger = Logger.getLogger(DSLRServletController.class);


    private DSLR DSLR;
    private DSLRDAO dslrDAO;
    private DSLR dslr;



    @Autowired
    public DSLRServletController() {
        this.dslrDAO = new …
Run Code Online (Sandbox Code Playgroud)

java spring

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

Spring Boot jar带来:java.lang.NoSuchMethodError:javax.persistence.Table.indexes([Ljavax / persistence / Index

我可以使用Maven的插件运行Spring Boot,spring-boot:run但是当我尝试执行打包后,jar它给出了:

Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes( [Ljavax/persistence/Index
Run Code Online (Sandbox Code Playgroud)

Pom.xml

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>123</groupId>
    <artifactId>event</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <url>http://maven.apache.org</url>

 <name>Event</name>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.1.6.RELEASE</version>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <start-class>go.Application</start-class>
        <guava.version>16.0.1</guava.version>
        <java.version>1.7</java.version>
    </properties>


    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
            </plugin>
            <!-- Spring Boot Maven -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <archive>
                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration> …
Run Code Online (Sandbox Code Playgroud)

java jar maven spring-boot

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

如何将BigDecimal带入分数功率?

BigDecimal是存储小数点后最多5位数的选项.我需要将BigDecimal提高到分数幂(小数点后最多2位).例如,我必须将9.09671带到1.51的功率.我需要从/到BigDecimal进行一些转换吗?怎么做?

编辑: 我不能使用Java的BigDecimal.power(BigDecimal指数)中描述的第三方库:是否有Java库可以做到这一点?

对于这种情况,是否存在比如何在Java中对BigDecimal进行分数处理所描述的更优雅,更舒适的方式

java

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

如何将swing.JTextArea绑定到PrintStream以接受数据

客户端有gui和额外的线程(处理套接字输入并将其打印出来以传递PrintStream类型的对象).gui形式有new javax.swing.JTextArea().我需要传递给PrintStream要写入的对象的线程:ClientThreadIn(PrintStream inOutput){...}.如何创建/绑定GUI的JTextArea接受数据的形式ClientThreadIn使用PrintStream


客户:

    in = new BufferedReader(new InputStreamReader(s.getInputStream())); 
    out = new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
ClientThreadIn threadIn = new ClientThreadIn(in, System.out); // client passes it's System.out to thread for writing
Run Code Online (Sandbox Code Playgroud)

所以JTextArea应该类似于控制台.它应该能够接受来自Thread的数据(实际上Thread写入gui的PrintStream)...是否有类似于JTextArea.getInputStream()的东西?

java user-interface swing multithreading jtextarea

4
推荐指数
1
解决办法
4836
查看次数

在执行JPA查询时获取NoSuchMethodError:javax.persistence.Table.indexes()

我有IntelliJ项目库:Hibernate-entitymanager 4.3.4和JPA 2.0-2.0.使用postgresql-9.3.1100.jdbc4连接到数据库.怎么解决?

jpa-ql>从ItemEntity中选择ItemEntity.name;

java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
    at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:936)
    at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:824)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3790)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3744)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:397)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:73)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:78)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
    at com.intellij.jpa.remote.impl.JpaFacadeImpl.createEntityManagerFactory(JpaFacadeImpl.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
    at sun.rmi.transport.Transport$1.run(Transport.java:177)
    at sun.rmi.transport.Transport$1.run(Transport.java:174)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Run Code Online (Sandbox Code Playgroud)

java postgresql hibernate jpa intellij-idea

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

如何让Maven下载特定依赖项的源代码和javadoc?

我需要特定的依赖文档,一些文档和源代码.告诉maven这样做的最好方法是什么?

dependencies intellij-idea maven

4
推荐指数
1
解决办法
2621
查看次数