小编Mah*_*leh的帖子

Spring错误导致Spring安全问题?

问候所有,我正在使用spring security 3.0.2,urlRewrite 3.1.0,我有一个Spring安全问题,我有一个规则,即应用程序中的所有页面都需要身份验证,除了某些页面,所以我的security.xml是:

<http use-expressions="true" > 
<intercept-url pattern="/" access="permitAll" />
<intercept-url pattern="/error"  filter="none" />  
<intercept-url pattern="/**" access="isAuthenticated()" />
.
.
.</http>
Run Code Online (Sandbox Code Playgroud)

在web.xml中我定义了错误页面

<error-page>
   <error-code>404</error-code>
   <location>/p/error</location>
</error-page>
Run Code Online (Sandbox Code Playgroud)

问题是,如果我不是登录用户,并输入app/notFoundUrl等应用程序中不存在的某个url,则spring安全性将此页面与需要身份验证的模式/**匹配,因此用户是未按预期重定向到错误页面,但重定向到登录页面,然后重定向到错误页面

我希望如果用户输入了一个坏网址,如果他已经登录,他会直接重定向到错误页面.

我认为这个问题与web.xml有关,这就是它:

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

    <!-- Beans in these files will makeup the configuration of the root web application context -->
    <!-- Bootstraps the root web application context before servlet initialization-->
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Deploys the 'projects' dispatcher servlet whose configuration resides in /WEB-INF/servlet-config.xml-->
    <servlet> …
Run Code Online (Sandbox Code Playgroud)

spring spring-mvc spring-security

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

表单组件需要在其祖先中具有UIForm.建议:在<h:form>中包含必要的组件

我在我的Facelet页面上收到以下错误,该页面只包含一个带有两个字段和两个按钮的IceFaces表单:

表单组件需要在其祖先中具有UIForm.建议:在<h:form>中包含必要的组件

这是表格:

<ice:form id="form1" partialSubmit="false">
    <ice:panelLayout id="panelLayout3">
        <ice:graphicImage id="graphicImage1" url="/resources/images/LoginImage.jpg" width="560" />
        <ice:outputLabel for="j_username" id="outputLabel1" value="Username:"/>
        <ice:outputLabel for="j_password" id="outputLabel2" value="Password:"/>
        <ice:inputText binding="#{login.username}" id="j_username" required="true" />
        <ice:inputSecret binding="#{login.password}" id="j_password" required="true" />
        <ice:commandButton  actionListener="#{login.login}" id="loginBtn" value="Login"/>
        <ice:commandButton action="#{login.reset}" id="resetBtn" value="Reset"/>
        <ice:outputText id="errorMessage" />
        <ice:message errorClass="errorMessage" for="j_username" fatalClass="fatalMessage" id="messages1" infoClass="infoMessage" showSummary="false" warnClass="warnMessage"/>
    </ice:panelLayout>
</ice:form>
Run Code Online (Sandbox Code Playgroud)

这是怎么造成的,我该如何解决?

jsf icefaces jsf-2

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

验证失败时JSF中的条件样式

我有h:消息显示错误消息,并且有一个组件,我希望在发生验证错误时更改其样式(如果任何组件有验证错误或呈现任何验证消息然后更改此特定组件的样式) .

我知道如果组件有验证错误,改变样式的方法: JSF:检查是否存在<h:message for ="id"/>的更好方法

但我想要一种更通用的方法,如果表单中的任何组件无效,或者换句话说任何验证消息都会被渲染,则更改样式.

请告知如何实现这一目标.

jsf jsf-2

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

无法使用EWS Java API获取发件人电子邮件地址

我正在使用EWS Java API 1.1.5.我试图让电子邮件发件人如下:

ItemView view = new ItemView(10);
FindItemsResults<Item> findResults = service.findItems(
    WellKnownFolderName.Inbox, view);
    for (Item item : findResults.getItems()) {
        if (item instanceof EmailMessage) {
            String senderEmail = ((EmailMessage) item).getSender().getAddress();
            System.out.println("Sender Email: " + senderEmail);
        }
    }
);
Run Code Online (Sandbox Code Playgroud)

但它总是回归null.我也尝试过以下方法:

String senderEmail = ((EmailMessage) item).getFrom().getAddress();
Run Code Online (Sandbox Code Playgroud)

但它也会回归null.我可以看到该电子邮件包含发件人,如:

Test User <testuser@testdomain.com> 
Run Code Online (Sandbox Code Playgroud)

它出现在邮件中以及回复电子邮件时.

请告知如何解决此问题.

exchange-server exchangewebservices ewsjavaapi

11
推荐指数
1
解决办法
4295
查看次数

String包含jsf中的方法

我想知道如何在不使用JSTL的情况下在jsf2中使用/实现string contains方法.请指教,谢谢.

jsf el jsf-2

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

验证者ID未注册

我在日食中得到这个警告:

Validator id is not registered
Run Code Online (Sandbox Code Playgroud)

在线上:

<f:validator validatorId="confirmPasswordValidator" />
Run Code Online (Sandbox Code Playgroud)

我正在使用JSF 2和tomcat 6

我的el-impl库是org.glassfish.web

任何想法为什么?以及如何解决?

eclipse jsf jsf-2

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

使用Apache POI在Excel文件中获取列的名称

如何使用Apache POI在Excel文件中获取列名称,以确保按预期方式对列进行排序.

java apache-poi

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

名称空间http://xmlns.jcp.org/jsf/core中名为passThroughAttribute的标记定义了一个null处理程序类

我正在尝试在Jboss 7.1.1上使用JSF 2.2.2.我在这个链接中遵循解决方案1:http: //www.mastertheboss.com/jsf/installing-jsf-22-on-jboss-as-7 这是基于替换当前的jboss jsf库,之后我更改了faces配置.但在尝试运行应用程序时,我收到以下异常:

22:28:56,076 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1) Critical error during deployment: : com.sun.faces.config.ConfigurationException: The tag named passThroughAttribute from namespace http://xmlns.jcp.org/jsf/core has a null handler-class defined
    at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processHandlerClass(FaceletTaglibConfigProcessor.java:422) [jsf-impl-2.2.2.jar:2.2.2]
    at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:378) [jsf-impl-2.2.2.jar:2.2.2]
    at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:321) [jsf-impl-2.2.2.jar:2.2.2]
    at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:270) [jsf-impl-2.2.2.jar:2.2.2]
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:437) [jsf-impl-2.2.2.jar:2.2.2]
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214) [jsf-impl-2.2.2.jar:2.2.2]
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_25]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_25]

22:28:56,080 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/motivosity]] (MSC …
Run Code Online (Sandbox Code Playgroud)

eclipse jboss jsf-2 jboss7.x

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

应用程序启动时缓存查找不起作用

我在tomcat 9.0.2上使用Spring Boot 1.5.9 并尝试使用spring @Cacheable调度在应用程序启动时运行的缓存刷新作业来缓存查找,并且每24小时重复一次,如下所示:

@Component
public class RefreshCacheJob {

    private static final Logger logger = LoggerFactory.getLogger(RefreshCacheJob.class);

    @Autowired
    private CacheService cacheService;

    @Scheduled(fixedRate = 3600000 * 24, initialDelay = 0)
    public void refreshCache() {
        try {
            cacheService.refreshAllCaches();
        } catch (Exception e) {
            logger.error("Exception in RefreshCacheJob", e);
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

缓存服务如下:

@Service
public class CacheService {

    private static final Logger logger = LoggerFactory.getLogger(CacheService.class);

    @Autowired
    private CouponTypeRepository couponTypeRepository;

    @CacheEvict(cacheNames = Constants.CACHE_NAME_COUPONS_TYPES, allEntries = true)
    public void clearCouponsTypesCache() {} …
Run Code Online (Sandbox Code Playgroud)

java spring tomcat spring-boot spring-cache

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

无法传输依赖关系,缓存在本地存储库中

我正在使用eclipse上的maven 2项目,我有m2e插件,我在Eclipse中遇到以下错误:

Failure to transfer com.thoughtworks.xstream:xstream:pom:1.3.1 from http://repo1.maven.org/maven2 was cached in the 
 local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. 
 Original error: Could not transfer artifact com.thoughtworks.xstream:xstream:pom:1.3.1 from/to central (http://
 repo1.maven.org/maven2): Failed to create a selector. to http://repo1.maven.org/maven2/com/thoughtworks/xstream/
 xstream/1.3.1/xstream-1.3.1.pom
Run Code Online (Sandbox Code Playgroud)

我通过删除.lastUpdated文件然后清理和构建没有运气,仍然得到相同的错误,请遵循类似问题的答案,请指教.

eclipse maven-2 m2eclipse maven m2e

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