给定一个配置了会话范围的spring bean,例如:
@Component
@Scope(proxyMode=ScopedProxyMode.TARGET_CLASS,value=WebApplicationContext.SCOPE_SESSION)
public class SomeBean {
}
Run Code Online (Sandbox Code Playgroud)
有没有办法控制Spring在http会话中存储bean的名称?
默认情况下,使用会话密钥scopedTarget.someBean的弹簧接缝是否可以添加到注释中以在Session中显式指定属性名称?
我正在尝试使用我的grails 1.3.9版本安装webflow插件版本.
我试过以下的事情.,
使用命令grails intall-plugin webflow 1.3.8
Result是:org.grails#grails-webflow;1.3.8: not found
修改buildConfig文件并添加该行
plugins {compile":webflow:1.3.8"
运行应用程序结果时:
UNRESOLVED DEPENDENCIES
org.grails.plugins#webflow;1.3.8: not found
Run Code Online (Sandbox Code Playgroud)
我不知道还有什么可以尝试的.请帮忙.
我想在某些情况下绕过Spring webflow(Spring 2.0.5)应用程序的登录表单(因此登录表单是为普通用户提供的,但是当URL就像http://server.com/myspringapp/fakelogin?username = FakeUser&password = FakePassword然后不应该向用户显示登录表单,而是根据请求参数在内部进行身份验证,然后将其带到安全页面.
所以我不想要Preauthenticastion,而是特殊场合的透明身份验证(当URL如上所述).我看到了诸如http://forum.springsource.org/showthread.php?t=59108之类的线程,但没有提到解决方案的地方.我尝试实现AuthenticationProcessingFilter但不太确定如何实现requiresAuthentication()方法.
以下是我当前的安全性XML:
<?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-2.0.xsd">
<bean id="customAuthenticationProvider" class="com.myco.jsf.spring.security.MyAuthenticationProvider">
<security:custom-authentication-provider/>
<constructor-arg>
<ref bean="webSessionFactory"/>
</constructor-arg>
<constructor-arg>
<ref bean="authenticationBridge"/>
</constructor-arg>
</bean>
<bean id="myEntryPoint" class="com.myco.web.filter.CustomAuthenticationEntryPoint">
<property name="loginFormUrl" value="/spring/login" />
</bean>
<bean id="myProcessingFilter" class="com.myco.web.filter.CustomAuthenticationProcessingFilter">
<security:custom-filter position="AUTHENTICATION_PROCESSING_FILTER" />
<property name="defaultTargetUrl" value="/spring/secure" />
<property name="authenticationFailureUrl" value="/spring/login" />
<property name="alwaysUseDefaultTargetUrl" value="false" />
<property name="filterProcessesUrl" value="/spring/j_spring_security_check" />
<property name="authenticationManager" ref="authenticationManager" />
<!--
<property name="allowSessionCreation" value="true" />
-->
</bean>
<security:authentication-manager alias="authenticationManager"/> …Run Code Online (Sandbox Code Playgroud) 我有一个动作状态,它评估一个表达式,然后根据结果转换到各种其他状态.结果状态之一是将子流控制到另一个流的子流状态,例如;
<action-state id="doWork">
<evaluate expression="someAction.doWork(someInput)" />
<transition on="WORKSUCCESS" to="workSuccess" />
<transition on="WORKFAIL" to="fixFail" />
</action-state>
<subflow-state id="fixFail" subflow="someOtherPlace/someOtherWorkToFixFail">
<input name="someNumber" value="1" type="java.lang.Integer" />
<transition on="finish" to="workSuccess" />
</subflow-state>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我可以通过输入标记将输入传递给子流,但我的问题是,当且仅当从转换WORKFAIL调用子流状态时,如何指定和传递我想要的其他输入?假设可以从其他动作状态调用子流状态"fixFail".
我尝试过类似以下的东西但没有效果;
<action-state id="doWork">
<evaluate expression="someAction.doWork(someInput)" />
<transition on="WORKSUCCESS" to="workSuccess" />
<transition on="WORKFAIL" to="fixFail">
<attribute name="newInput" value="3000" type="java.lang.Integer" />
</transition>
</action-state>
<subflow-state id="fixFail" subflow="someOtherPlace/someOtherWorkToFixFail">
<input name="someNumber" value="1" type="java.lang.Integer" />
<input name="someNumber2" value="flowScope.newInput" type="java.lang.Integer" />
<transition on="finish" to="workSuccess" />
</subflow-state>
Run Code Online (Sandbox Code Playgroud) 我想知道Spring在其Web流产品中使用Spring EL而不是OGNL究竟是什么原因:
使用OGNL,我可以直接通过流动态创建简单类和执行方法等.我知道这不是一个很好的做法,这样做内实际的网页模板(即JSP)的,因为它们是基于演示文稿,但网络流量控制你的程序的逻辑,我觉得使用OGNL有效那里是非常方便的功能.此外,您可以测试流量以确保其轻松工作.
那么,有两个问题:
使用Spring EL而不是OGNL有什么主要好处,特别是在Spring Webflow的上下文中?
你能用Spring EL创建对象吗?
我想知道如何使用on-exception属性访问异常对象?我当前的配置如下所示:
<transition on-exception="{business_exception}" to="errorView" >
</transition>
Run Code Online (Sandbox Code Playgroud)
我必须在errorView中访问一些异常属性.有谁知道我该怎么办?
spring webflow文档提到他们向流添加消息的方法是在流中的文件messages.properties中定义关于该流的所有消息:
国际化消息在Spring MessageSource访问的消息包中定义.要创建特定于流的消息包,只需在流的目录中定义messages.properties文件即可.为您需要支持的每个其他区域设置创建默认的messages.properties文件和.properties文件.
在我们的webapp中,我们使用Spring Webflow和专有框架.我们将所有国际化消息都放在一个文件中,我们希望Spring Webflow可以访问这个消息,而不是使用几十个属性文件乱丢我们的项目.有没有办法为spring webflow配置消息源,还是我们坚持使用messages.properties?
我view-state在flow.xml中有不同之处.所有这些州都有相同的观点.现在我想设置一个变量,它只包含一个String,并在视图文件中调用它来自定义内容.
这是我的文件:
flow.xml:对于示例两个视图状态
<view-state id="rcpm" view="rc/rcmembers.xhtml">
<on-entry>
<evaluate expression="RCHtmlCache.getCommunityList('rcpm')"
result="flowScope.members" />
</on-entry>
</view-state>
<view-state id="rcarch" view="rc/rcmembers.xhtml">
<on-entry>
<evaluate expression="RCHtmlCache.getCommunityList('rcarch')"
result="flowScope.members" />
</on-entry>
</view-state>
Run Code Online (Sandbox Code Playgroud)
在这个文件中,我需要一个带有视图状态ID值的变量,例如"rcarch".
rcmembers.xhtml 只是我要调用变量的代码部分
<p:panel id="panel" header="Memberslist of **Here comes the value of the variable">
Run Code Online (Sandbox Code Playgroud)
希望你能理解我的问题......
当我创建模型时,我想保存模型的图像.我正在使用PrimeFaces fileUpload组件.当我保存图片时,我想知道特定图像所指的模型.这就是我需要将模型的id发送到支持bean的原因.
有没有可能将模型的id发送到fileUploadListener?
<h:form enctype="multipart/form-data">
<p:panelGrid columns="2">
<h:outputLabel for="hotelName" value="#{msg.hotelName}"/>
<p:inputText value="#{apartmentNew.name}" id="hotelName"/>
<h:outputLabel for="hotelDescription" value="#{msg.hotelDescription}"/>
<p:inputText value="#{apartmentNew.description}" id="hotelDescription"/>
<h:outputLabel for="hotelImages" value="#{msg.hotelImages}"/>
<h:form enctype="multipart/form-data">
<p:fileUpload id="hotelImages"
fileUploadListener="#{apartments.handleImageUpload}"
mode="advanced"
sizeLimit="10000000"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/">
</p:fileUpload>
</h:form>
</p:panelGrid>
<p:commandButton id="saveApartmentButton" value="#{msg.save}" action="save"/>
<p:commandButton id="cancelCreationApartmentButton" value="#{msg.cancel}"
action="cancel"/>
</h:form>
Run Code Online (Sandbox Code Playgroud) 我正在编写一个验证器,需要测试弹簧形式对象是否已更改.
在验证程序中,如果未对表单进行任何更改,则应显示错误.
有弹簧机制吗?
这是因为我提交时会进行非常昂贵的Web服务更新调用,如果没有进行任何更改,我需要阻止进行webservice调用.
干杯.
spring-webflow ×10
spring ×5
java ×3
file-upload ×1
grails ×1
jsf ×1
jsf-2 ×1
ognl ×1
plugins ×1
primefaces ×1
spring-el ×1
spring-mvc ×1