小编Ang*_*ons的帖子

JSF中的CSRF,XSS和SQL注入攻击防范

我有一个基于JSF的Web应用程序,MySQL作为DB.我已经实现了代码来防止我的应用程序中出现CSRF.

现在,由于我的底层框架是JSF,我想我不必处理XSS攻击,因为它已经被处理了UIComponent.我没有在任何视图页面中使用任何JavaScript.即使我使用,我真的需要实现代码来防止XSS攻击?

对于DB,我们在所有数据库交互中使用预准备语句和存储过程.

是否还需要处理其他任何事情以防止这3种常见攻击?我已经通过了OWASP网站和他们的备忘单.

我是否需要处理任何其他潜在的攻击媒介?

xss jsf sql-injection csrf owasp

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

RESTful v/s MQ.除保证交付之外的差异和其他关键功能

好的..所以我开始研究MQ及其目的/用例等...我现有的应用程序(使用JSP等制作的Web)使用RestFUL接口与远程服务器通信并从服务器发布/接收数据.

我们经常要处理远程服务器的连接问题.同步问题总是在那里.

从我们的结束发送的消息.但是远程服务器发生故障.或相反亦然.

我遇到了MQ的事情,并发现在从远程服务器发送和接收消息时它是可靠的.

但同样,使用REST我认为对MQ的整个需求似乎有点模糊.我基本上在寻找MQ和RestFUL之间的一些差异.

我在其他博客文章中看到,随着RestFUL领域研究的不断增加,MQ的速度将逐渐放松.

我对MQ没有太多了解,所以不会发表任何评论,但肯定与RestFUL合作很有趣.

如果有人提供使用RestFUL和MQ之间的差异,将不胜感激.

rest activemq-classic web-applications rabbitmq

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

尝试使用ESAPI但收到错误

我正在尝试使用ESAPI.jar为我的Web应用程序提供安全性.基本上我刚开始使用ESAPI.jar.但问题是我无法使用ESAPI运行一个简单的程序.小代码片段是:

String clean = ESAPI.encoder().canonicalize("someString");
Randomizer r=ESAPI.randomizer();    
System.out.println(r);
System.out.println(clean);
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Attempting to load ESAPI.properties via file I/O.
Attempting to load ESAPI.properties as resource file via file I/O.
Not found in 'org.owasp.esapi.resources' directory or file not readable: D:\Eclipse-Workspace\Test\ESAPI.properties
Not found in SystemResource Directory/resourceDirectory: .esapi\ESAPI.properties
Not found in 'user.home' (C:\Documents and Settings\user.user) directory: C:\Documents and Settings\user.user\esapi\ESAPI.properties
Loading ESAPI.properties via file I/O failed. Exception was: java.io.FileNotFoundException
Attempting to load ESAPI.properties via the classpath.
ESAPI.properties could not be loaded by any means. Fail. Exception …
Run Code Online (Sandbox Code Playgroud)

java security web-applications esapi

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

在JasperReport中创建/传递Java bean数据源

我在我的JSF应用程序中使用JasperReport和ireport来动态生成报告.这就是我想要实现的目标: -

  1. 我的结构(读作HashMap/ArrayList)包含需要传递给报表的数据,以便在报表中显示相同的数据.

  2. 我的报告已经包含一个数据源连接,我使用该连接从DB获取一些值并在报告中填充它.

  3. 我正在创建一个子报表,以便对于需要从代码传递的数据,我可以使用子报表并将此子报表嵌入主报表中.

我的问题是: - 1.我无法将集合(读作HashMap/ArrayList)传递给子报告,用我的代码中的数据填充它.

我绝对相信必须有整个集合传递给子报表,以填充它的一些方法,我也试过但是创建一个JavaBean数据源连接,同时创造它说缺少类路径条目的连接.

我不能在jar中捆绑各自的类并将jar放在classpath中,因为值在结构中不断变化,....

任何人都可以指导我如何创建/传递java bean数据源到报告,以便可以填充数据...

请指导......

更新部分: -

用于将参数传递到报告和生成报告的Java代码: -

public class TestDataSource
{
    public static void main(String[] args)
    {

        try {
            JasperDesign jasperDesign = JRXmlLoader.load("D:\\jasperReports\\subReportDataSource.jrxml");
            JasperReport jasperReport =(JasperReport)JasperCompileManager.compileReport(jasperDesign);
            Map<String,Object> parameters = new HashMap<String,Object>();
            parameters.put ("Title",generateCollection());

            JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JRBeanCollectionDataSource(generateCollection()));

            JasperViewer.viewReport(jasperPrint);
            }catch(Exception e)
            {
                e.printStackTrace();
            }
    }

    public static ArrayList<PersonBean> generateCollection()
    {
        ArrayList<PersonBean> arrlist=new ArrayList<PersonBean>();
        arrlist.add(new PersonBean("A", 20));
        arrlist.add(new PersonBean("B",30));
        arrlist.add(new PersonBean("C",40));
        arrlist.add(new PersonBean("D",50));
        arrlist.add(new PersonBean("E",40));
        arrlist.add(new PersonBean("F",60));

        return arrlist; …
Run Code Online (Sandbox Code Playgroud)

java reporting jasper-reports

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

javax.faces.FacesException:加载JSF页面时解码资源数据时出错

我在加载JSF页面时遇到了下面提到的错误.页面成功加载,页面上的所需操作也已完成,但是出现此错误.

jsf页面包含选项卡面板,单击每个选项卡面板时出现错误.另外,我发现如果我将页面的某一部分保留为render = false,则错误不会出现,但该部分也不会被重新呈现.

我正在使用JSF2.0和JSP.和RF3.3

ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Error decode resource data
at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:627)
at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceDataForKey(ResourceBuilderImpl.java:371)
at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:156)
at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:508)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.zip.DataFormatException: incorrect data check
at java.util.zip.Inflater.inflateBytes(Native …
Run Code Online (Sandbox Code Playgroud)

jboss richfaces jsf-2

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

在SOAPUI中创建JDBC连接

我是SOAPUI的新手,并且一直在尝试使用SOAPUI进行查询和过程测试.我在网上浏览了SOAPUI文档但是我无法与我的数据库建立连接.我已经在SOAPUI的lib文件夹中复制了mysql jar.我得到的例外是

Tue Nov 08 12:54:51 IST 2011:ERROR:com.eviware.soapui.support.SoapUIException: Failed to init connection for drvr [com.mysql.jdbc.Driver], connectionString [jdbc:mysql://DB SERVER IP:PORT/DB NAMES?user=username&password=password]
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我有什么问题...以下是我在SOAPUI中为这个JDBC做的事情的步骤: -

> 1.New project.
> 2. Clock on New Project.
> 3.Go to JDBC Connections tab.
> 4. Add a new Data Connection.
> 5. Specified unique name.
> 6. selected driver as mysql:com.jdbc.driver
> 7.I can only see to mention host,port and DB.
> 8.Mentioned Host,Port and DB..
> 9.Tested the Connection.
> 10.Got the above mentioned excpetion... …
Run Code Online (Sandbox Code Playgroud)

java mysql soap jdbc soapui

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

单个JasperReport内的两个SQL查询

我们正在基于iReports和JasperReports为Web应用程序生成报告.

使用iReports我发现我遇到了大问题.

我想使用两个SQL查询来填充我的主报告...在查询设计器中我只能写一个查询..

对于另一个查询我不能使用子报告...

我如何编写第二个查询,它将返回不同的字段并将它们包含在我的报告中.

请指导......

我不能使用子报告......

reporting jasper-reports ireport

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

在Java中检查有效的IPv4地址

我正在使用该sun.net.util.IPAddressUtil包检查字符串是否包含有效的IPv4和IPv6地址.

代码片段是: -

String ipv4addr="200";

    if(IPAddressUtil.isIPv4LiteralAddress(ipv4addr))
    {
        System.out.println("valid ipv4 address");
    }
    else
    {
        System.out.println("not valid");

    }
Run Code Online (Sandbox Code Playgroud)

但是对于200和300这样的地址,它仍然说它是一个有效的IPv4地址,但事实并非如此.当我使用相同的包并检查IPV6地址时使用: -

String ipv6addr="200";

    if(IPAddressUtil.isIPv6LiteralAddress(ipv6addr))
    {
        System.out.println("valid ipv6 address");
    }
    else
    {
        System.out.println("not valid");

    }
Run Code Online (Sandbox Code Playgroud)

我得到了正确的结果.但是,IPv4似乎没有工作,或者可能是我错误地使用它.请指导我.我不想使用正则表达式进行IPv4验证...

java string ipv4 ipv6

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

如何检查Date对象的Null值

我正在使用JSF 2.0和RichFaces 3.3.在我的View中,用户将从日历中查看日期.使用的标签是<rich:calendar>.这是使用Dateobject 映射到backing bean中的.但是,此字段是可选的,因此当用户没有选择日期时,此特定条目的辅助bean getter返回null,这是正确的.

我的问题是我必须将此日期存储在DB中.所以在存储之前我是以这种方式输入它:

if (newProfile.get(Constants.DETAILS_EXPIRY_DATE_1).equals(null)) {
    this.cStmt.setDate(15,null);
} else {
    java.sql.Date sqlDate = new java.sql.Date(((java.util.Date)newProfile.get(Constants.DETAILS_EXPIRY_DATE_1)).getTime());
    this.cStmt.setDate(15,sqlDate);
}
Run Code Online (Sandbox Code Playgroud)

但是它被扔NullPointerExceptionif状态.我想null在用户没有选择日期时在DB中插入值.我怎样才能做到这一点?

java date richfaces nullpointerexception jsf-2

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

将.jrxml文件转换为.pdf文件

我在我的Web应用程序上运行了一些负载测试.问题是负载测试应用程序的结果是.jrxml格式.结果包含图表图表和某些参数.我知道它是一种jasperreport格式.因此,如果我将.jrxml文件转换为.pdf文件,我将能够看到所有图表,图形和值...

我假设无论.jrxml关于图表或图表的内容如何,​​生成的pdf将包含适当的值,因为模板是根据图表API准备的.

我可以生成jasper报告而不指定任何数据源连接.我不需要数据源连接,因为我的.jrxml文件不包含数据源属性...如果是,我怎么能实现它..请建议

java jasper-reports ireport

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