小编Mah*_*leh的帖子

如何检测mime类型是否为可执行文件?

我正在使用apache tika来检测输入流的mime类型,我想知道是否有一个现成的方法来检测这个文件是一个可执行文件,这里有一个大的可执行文件mime类型列表:

http://www.file-extensions.org/filetype/extension/name/program-executable-files

我想知道最好的方法来掩盖他们.请指教,谢谢.

java mime-types apache-tika

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

为了安全起见,应删除哪些XML标记?

我正在使用Java发布一个论坛发布Web应用程序,我想知道:

  1. 在像<script>标记一样发布时应该解析和删除的xml标记是什么?
  2. 我应该删除标记并保留内容,还是删除包含内容的标记?
  3. 删除它们的正则表达式是什么?

xss web-applications

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

无法在电子邮件模板中使用带速度的宏?

问候所有我在发送电子邮件时都使用速度模板,我想根据用户区域设置从属性文件中动态读取文本

xml配置:

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">

     <property name="basenames">
     <list>
     <value>classpath:messages</value>
     <value>classpath:messages_ar</value>
     </list>
     </property>

    <property name="defaultEncoding" value="UTF-8"/>
</bean>

<bean id="velocityEngine"
        class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
        <property name="velocityProperties">
            <props>
            <prop key="resource.loader">class</prop>
            <prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</prop>
            <prop key="velocimacro.library">org/springframework/web/servlet/view/velocity/spring.vm</prop>
            </props>
        </property>
    </bean>
Run Code Online (Sandbox Code Playgroud)
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath" value="/WEB-INF/classes/com/spacerdv/mailTemplates"/>
</bean>


    <!-- 

  View resolvers can also be configured with ResourceBundles or XML files. If you need
  different view resolving based on Locale, you have to use the resource bundle resolver.

   -->

<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
  <property name="cache" value="true"/>
  <property name="prefix" value=""/>
  <property name="suffix" value=".vm"/> …
Run Code Online (Sandbox Code Playgroud)

spring velocity spring-mvc

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

在eclipse中突出显示html标签(打开/结束)

我想在选择带光标的结束/打开时启用高亮显示打开/结束html标记 - 这意味着,如果您有以下示例:

.
.
.
<div id="div1">

</div> <!-- end of div1 -->
</div>
.
.
.
Run Code Online (Sandbox Code Playgroud)

将光标放在open标签旁边时div1,我希望此div的结束标记突出显示,并且当将光标放在旁边div1的开放标记的结束标记旁边时,div会突出显示该标记.

如何启用此功能?

html java xml eclipse

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

是否可以读取属性文件中另一个键内的键?

我正在使用spring框架&messageSource和PropertyPlaceholderConfigurer来处理属性文件,我想要如下所示?

key.num1=value1
key.num2= i am using ${key.num1}
Run Code Online (Sandbox Code Playgroud)

在一个键中读取另一个键的值.该怎么办?

java spring spring-mvc

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

无法在测试类中导入applicationContext

我的applicationContext.xml,webmvc-config.xml位于WEB-INF/spring/applicationContext.xml中

当我尝试以下,它不加载,我得到 java.io.FileNotFoundException

@ContextConfiguration(locations = { "classpath:WEB-INF/spring/applicationContext.xml" })
Run Code Online (Sandbox Code Playgroud)

我正在使用spring 3,junit 4.7.

它通过复制resources文件夹中的applicationContext.xml来处理脏的变通方法,因此它是重复的.

我把装载改为:

@ContextConfiguration(locations = { "classpath:/applicationContext.xml" })
Run Code Online (Sandbox Code Playgroud)

我的web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">

  <!-- start up and shut down Spring's root WebApplicationContext (Interface to provide configuration for a web application) -->
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  <!-- Central dispatcher for HTTP request handlers/controllers: take an incoming URI and find the right combination of handlers (generally methods on Controller classes) 
  and views (generally JSPs) that combine to …
Run Code Online (Sandbox Code Playgroud)

junit spring spring-mvc

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

对于与spring一起使用的丰富框架感到困惑

我的要求是快速,轻松地开发丰富的Web应用程序,并且框架必须易于/兼容像IceFaces这样的Spring

我对IceFaces/PrimeFaces感到困惑,或者使用带有YUI/DWR的jsp

请建议我.

spring rich-internet-application spring-mvc java-ee spring-webflow

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

关于在一个字段上使用FacesValidator(JSF验证)和Bean验证的问题

我有一个电子邮件字段,我想验证它是有效的电子邮件,并验证它在数据库中不存在,所以我使用有效的电子邮件模式来自bean中的hibernate的@Email:

@NotBlank(message = "{email.required}")
@Email(message = "{invalid.email}")
@Size(max = 25, message = "{long.value}")
Run Code Online (Sandbox Code Playgroud)

并在jsf页面中:

<f:validator binding="#{emailExistValidator}" />
Run Code Online (Sandbox Code Playgroud)

我的问题:

  1. 首先发生什么,面部验证器或bean验证?
  2. 您如何看待bean验证和FacesValidator之间的这种混合,这是不好的做法,如果是这样,你有什么建议?

validation jsf java-ee bean-validation jsf-2

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

Spring基于角色的授权VS ACL?

我只是想知道在spring security 3中使用ACL基于 Spring 角色的授权之间的区别?

authentication spring authorization spring-security

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

UserDetails的自定义实现示例

我正在寻找一个UserDetails在Spring Security 3 中制作自定义对象的示例.我希望有人可以提供帮助,谢谢.

spring spring-security

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