小编Bal*_*nan的帖子

RestEasy:找不到类型的响应对象的MessageBodyWriter:java.util.Array媒体类型列表:application/json

消息:找不到类型的响应对象的MessageBodyWriter:java.util.Array媒体类型列表:application/json

说明:服务器遇到内部错误(找不到类型的响应对象的MessageBodyWriter:媒体类型的java.util.ArrayList:application/json)阻止它完成此请求

@GET
@Path("/{userName}/questions")
//@Produces("application/json")
public Response getUserQuestions(@PathParam("userName") String userName){               
    UserDAO userDAO = new UserDAO();        
    List<Question> questions = userDAO.getUserQuestionsByUserName(userName);        
    GenericEntity<List<Question>> entity = new GenericEntity<List<Question>>(questions){};      
    return Response.status(200).entity(entity).type(MediaType.APPLICATION_JSON).build();
}
Run Code Online (Sandbox Code Playgroud)

我在classpath中有resteasy jackson提供程序.尝试将返回类型表单更改ArrayListList,然后GenericEntity根据resteasy响应将其包装,但仍然遇到相同的问题.

在tomcat7上运行.

谢谢.

java json resteasy

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

cxf + wss4j + maven NoSuchMethod错误

试图使用maven使用cxf + wss4j.在没有任何编译问题的情况下创建了服务和客户端.该服务在tomcat中运行良好.
问题: 当我运行客户端代码时,我得到"java.lang.NoSuchMethodError:org.apache.xml.security.utils.I18n.init(Ljava/util/ResourceBundle;)V".这个类在xmlsec jar中,它带有cxf发行版.

服务项目的pom.xml:

<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>userNameTokenService</groupId>
    <artifactId>userNameTokenService</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <dependencies>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-ws-security</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.security</groupId>
            <artifactId>wss4j</artifactId>
            <version>1.6.15</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>3.2.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>3.2.6.RELEASE</version>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <webXml>WebContent\WEB-INF\web.xml</webXml>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project> …
Run Code Online (Sandbox Code Playgroud)

maven-2 cxf jax-ws xmlsec wss4j

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

使用更少的预处理器或普通CSS定制Angular Material2主题

是否可以使用less / plain CSS定制主题?看了几个选项,所有这些都建议使用scss

自从我们的项目。已经内置较少,无法切换到scss。尝试设置mat-primary类的背景颜色,但正如预期的那样-它不起作用。PFB图像-工具栏背景看起来很好,但是所有表单输入字段也都变成了相同的颜色 在此处输入图片说明

less material-design angular-material2 angular

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

window.print()CSS未在打印预览中加载

我需要提供打印部分网页的选项.这是使用javascript window.print()回答:Bill Paetzke实现的.弹出窗口打开(这包含CSS样式),打印对话框也会打开.但CSS样式并没有出现在印刷品中.试过@media = print,但这也行不通.CSS样式主要由背景颜色组成.我得到的一个选项是用1px*1px的图像替换背景颜色并重复它.还有其他方法吗?

浏览器:IE7代码:

<html>
<head>
<style type="text/css" media="print,screen">
.hideMe{
display:block;
}

.PrintClass {
display:block;

}
.NoPrintClass{
display:block;
}
</style>
<script type="text/javascript"
    src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js"> </script>
<script type="text/javascript">

    function PrintElem(elem)
    {
        Popup($('<div/>').append($(elem).clone()).html());
    }

    function Popup(data) 
    {

        var mywindow;       
        mywindow = window.open('', 'mydiv','height=400,width=600,scrollbars=yes','');            
        mywindow.document.write('<html><head><title>my div</title>');
        mywindow.document.write('<style type="text/css" media="print,screen">.hideMe{display:none;}.NoPrintClass{display:none;}</style>');               
        mywindow.document.write('</head><body>');
        mywindow.document.write('drop down selected value in parent: '+mywindow.opener.document.getElementById('testSelect').options[mywindow.opener.document.getElementById('testSelect').selectedIndex].text+'<br/>');
        mywindow.document.write('contentStarts<br/>');
        mywindow.document.write('  using jquery:  '+data);
        mywindow.document.write(' using javascript: '+mywindow.opener.document.getElementById('mydiv').innerHTML);
        mywindow.document.write('<br/>contentEnds'); 
        mywindow.document.write('<br/>');                                     
        mywindow.document.write('</body></html>');        
        mywindow.document.focus();
        mywindow.document.close();      
        mywindow.print();             
        return true;
    }

   </script>
</head>


<body>

This is not …
Run Code Online (Sandbox Code Playgroud)

javascript css printing internet-explorer

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