小编Vla*_*kov的帖子

javax.mail的mail.debug = true选项应该怎么办?

javax.mail.Session我设置的配置属性中mail.debug=true,但由于某种原因,这不会向应用程序日志添加任何新输出.

我已经将log4f日志记录级别设置为ALL log4j.rootLogger=ALL, stdout,但是......没有.

是否有可能将javax.mail调试输出写入其他地方?听起来不太可能,但我认为值得一提.

java log4j javax.mail

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

如何使用Enunciate为Spring-Jersey项目生成REST文档?

我正在努力处理我认为非常简单的事情 - 为一组已经存在的REST服务生成文档,这些服务基本上只是用JAX-RS注释注释的POJO .我使用Jersey作为实现提供者.REST API作为Spring Web应用程序的一部分进行部署.

我想只生成REST服务POJO的文档,所以我的enunciate.xml配置是这样的:

<?xml version="1.0"?>
<enunciate label="novaglobalapi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.25.xsd">

    <api-classes>
        <include pattern="com.something.api.rest.*"/>
    </api-classes>

    <modules>
        <docs docsDir="restapi" title="REST API"/>
    </modules>
</enunciate>
Run Code Online (Sandbox Code Playgroud)

我按照enunciate文档中的建议配置了我的pom.xml:

<build>
...
    <plugin>
        <groupId>org.codehaus.enunciate</groupId>
            <artifactId>maven-enunciate-plugin</artifactId>
            <version>1.25</version>
            <executions>
                <execution>
                    <goals>
                        <goal>docs</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <configFile>enunciate.xml</configFile>
            </configuration>
    </plugin>
...
</build>
Run Code Online (Sandbox Code Playgroud)

但是当我运行时mvn enunciate:docs,我收到以下构建错误:

[ERROR] Failed to execute goal org.codehaus.enunciate:maven-enunciate-plugin:1.25:docs (default-cli) on project NovaGlobalSSOAPI: Problem assembling the enunciate app. invalid LOC header (bad signature) -> …
Run Code Online (Sandbox Code Playgroud)

spring jersey enunciate maven

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

如何在Enunciate生成的文档中包含JSON Response Body的格式?

目前Enunciate生成REST API文档,但Response Body不包含有关响应的JSON结构的信息.根据我的理解,如果我将类包含在由Jersey to JSON序列化/反序列化的数据实体中,则enunciate将能够生成该文档的那一部分.

数据实体位于不同的模块中,按照发布文档 - 多模块项目中的建议与其源一起打包

...
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>2.1.2</version>
    <executions>
        <execution>
            <id>attach-sources</id>
            <phase>package</phase>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>
...
Run Code Online (Sandbox Code Playgroud)

这就是我的enunciate.xml的样子:

<?xml version="1.0"?>
<enunciate label="someapi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.25.xsd">

    <api-import pattern="com.something.business.vo.**"/>
    <api-import pattern="com.something.business.domain.**"/>

    <api-classes>
        <include pattern="com.something.web.ssoApi.rest.*"/>
        <include pattern="com.something.business.vo.**"/>
        <include pattern="com.something.business.domain.**"/>
    </api-classes>

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

这就是文档的样子:

文档截图

如您所见,响应主体只包含element: (custom).

如何使其包含响应的JSON结构?

enunciate maven

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

使用renderMode = GPU在iPad AIR应用程序上突然降低性能

我们在Apple iPad上运行AIR应用程序,偶尔会出现性能突然下降.帧速率从60fps下降到2fps,它永远不会从中恢复.

我们的一些观察是:

  • 这只能在iOS 4上重现,但从未在iOS 5上重现 - 我们在两个相同的iPad(第1代)上检查过
  • 性能偶尔下降,但总是在我们在应用程序之间切换时 - 从我们的应用程序切换到另一个应用程序
  • 很少,性能下降也会在应用程序首次启动时发生
  • 此性能问题不会发生renderMode=CPU,但此模式对我们不起作用,因为渲染很难看,特别是在旋转的位图上

还有其他人遇到类似的问题吗?任何想法如何解决它?

air flash actionscript-3 ipad ios4

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

动态/以编程方式停止/删除路径不会删除相应的线程

在处理从JMS收到的Exchange时,我正在动态创建一个从FTP获取文件到文件系统的路由,当批处理完成后,我需要删除相同的路由.以下代码片段显示了我是如何做到这一点的:

public void execute() {
    try {
        context.addRoutes(createFetchIndexRoute(routeId()));
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

private RouteBuilder createFetchIndexRoute(final String routeId) {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("ftp://" + getRemoteQuarterDirectory() +
                "?fileName=" + location.getFileName() +
                "&binary=true" +
                "&localWorkDirectory=" + localWorkDirectory)
                .to("file://" + getLocalQuarterDirectory())
                .process(new Processor() {
                    RouteTerminator terminator;

                    @Override
                    public void process(Exchange exchange) throws Exception {
                        if (camelBatchComplete(exchange)) {
                            terminator = new RouteTerminator(routeId, 
                                    exchange.getContext());
                            terminator.start();
                        }
                    }
                })
                .routeId(routeId);
            }
        };
}
Run Code Online (Sandbox Code Playgroud)

我正在 …

apache-camel

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

如何在AUTO_ACKNOWLEDGE JMS会话场景中模拟消息重新传递?

在下面的测试中,我试图模拟以下场景:

  1. 消息队列已启动.
  2. 在消息处理期间设计为失败的消费者已启动.
  3. 生成一条消息.
  4. 消费者开始处理消息.
  5. 在处理期间,抛出异常以模拟消息处理失败.失败的消费者被停止了.
  6. 另一个消费者的目的是获取重新传递的消息.

但是我的测试失败了,并且消息没有重新传递给新的消费者.我会很感激任何提示.

MessageProcessingFailureAndReprocessingTest.java

@ContextConfiguration(locations="com.prototypo.queue.MessageProcessingFailureAndReprocessingTest$ContextConfig",
        loader=JavaConfigContextLoader.class)
public class MessageProcessingFailureAndReprocessingTest  extends AbstractJUnit4SpringContextTests {
    @Autowired
    private FailureReprocessTestScenario testScenario;

    @Before
    public void setUp() {
        testScenario.start();
    }

    @After
    public void tearDown() throws Exception {
        testScenario.stop();
    }

    @Test public void 
    should_reprocess_task_after_processing_failure() {
        try {
            Thread.sleep(20*1000);

            assertThat(testScenario.succeedingWorker.processedTasks, is(Arrays.asList(new String[]{
                    "task-1",
            })));
        } catch (InterruptedException e) {
            fail();
        }
    }

    @Configurable
    public static class FailureReprocessTestScenario {
        @Autowired
        public BrokerService broker;

        @Autowired
        public MockTaskProducer mockTaskProducer;

        @Autowired
        public FailingWorker failingWorker;

        @Autowired
        public SucceedingWorker succeedingWorker; …
Run Code Online (Sandbox Code Playgroud)

junit spring activemq-classic jms spring-jms

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

如何使用弹簧安全性保护混合Spring MVC + Flex应用程序

我试过在Spring论坛上问这个问题(http://forum.springsource.org/showthread.php?109948-Problem-configuring-spring-security-3.1-with-hybrid-Spring-MVC-Flex-application)但是没有得到回应.

我正在开发一个Web应用程序,它具有内置Flex的(最终用户)用户界面和使用Spring MVC构建的管理用户界面.我正在尝试保护两个接口,并且可以让每个接口单独工作,但不能一起工作.

我正在使用带有Spring Security 3.1RC1和Spring 3.1M1的spring-flex-core 1.5.0的快照构建

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">

<!-- All Spring Security related configuration goes here -->

<security:global-method-security secured-annotations="enabled" jsr250-annotations="enabled"/>

<security:http pattern="/messagebroker/**" entry-point-ref="entryPoint">
    <security:anonymous enabled="false"/>
</security:http>

<bean id="entryPoint" class="org.springframework.flex.security3.FlexAuthenticationEntryPoint"/>

<security:http pattern="/favicon.ico" security="none"/>
<security:http pattern="/login*" security="none"/>
<security:http pattern="/logoutSuccess*" security="none"/>
<security:http pattern="/apollo/css/**" security="none"/>
<security:http pattern="/apollo/js/**" security="none"/>
<security:http pattern="/apollo/img/**" security="none"/>
<security:http pattern="/common/css/**" security="none"/>
<security:http pattern="/common/js/**" security="none"/>
<security:http pattern="/common/img/**" security="none"/>
<security:http pattern="/MoneyManager.swf" security="none"/>
<security:http pattern="/assets/**" security="none"/>
<security:http pattern="/index.jsp" security="none"/>

<security:http servlet-api-provision="true"> …
Run Code Online (Sandbox Code Playgroud)

java apache-flex spring-mvc spring-security

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