我正在使用spring/spring-security 3.1并希望在用户注销时(或者如果会话超时)采取某些操作.我设法为注销完成了操作,但是对于会话超时,我无法使其正常工作.
在web.xml中我只指定了ContextLoaderListener(这可能是问题吗?),当然还有DelegatingFilterProxy.
我像这样使用自动配置.
<security:http auto-config="false" use-expressions="false">
<security:intercept-url pattern="/dialog/*"
access="ROLE_USERS" />
<security:intercept-url pattern="/boa/*"
access="ROLE-USERS" />
<security:intercept-url pattern="/*.html"
access="ROLE-USERS" />
<security:form-login login-page="/auth/login.html"
default-target-url="/index.html" />
<security:logout logout-url="/logout"
invalidate-session="true"
delete-cookies="JSESSIONID" success-handler-ref="logoutHandler" />
</security:http>
<bean id="logoutHandler" class="com.bla.bla.bla.LogoutHandler">
<property name="logoutUrl" value="/auth/logout.html"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
当用户单击注销时,将调用注销处理程序,这将调用数据库.
但是如何处理会话超时???
处理它的一种方法是在用户登录时将用户名注入会话,然后使用普通的httpsessionlistener并在会话超时时执行相同的操作.
弹簧安全性是否有类似的方式,因此当spring发现会话超时时,我可以在那里挂钩,访问Authentication并从那里获取UserDetails并进行清理.
大家好我用这样PreparedStatement的java 创建一个批处理
for(Item item: list){
ps.setString(1, item.getSome());
ps.setString(2, item.getFoo());
ps.setString(3, item.getBatman());
statement.addBatch();
if (++count % batchSize == 0) {
results = ps.executeBatch(); //execute parcial batch
if (results != null)
System.out.println(results.length);
}
}
results= ps.executeBatch(); //execute rest of batch
Run Code Online (Sandbox Code Playgroud)
数据库服务器是一个MySQL,在表中插入我有几个限制
当我插入生成错误时受这些限制
我想运行批处理并省略错误,此时抛出一个异常结束批处理
在我创建批处理之前,我有一个Big来逐个保存
//seudocode level
For item
Try{
insert item
}catch(E){nothing happens}
Run Code Online (Sandbox Code Playgroud)
但它很慢,在某些情况下,批处理产生4000项,插入1500并省略其余部分
我该如何处理批次?
编辑
我使用weblogic与这个驱动程序进行连接 mysql-connector-java-commercial-5.0.3-bin
我测试了这个属性
1.
continueBatchOnError=true
Run Code Online (Sandbox Code Playgroud)
2.
rewriteBatchedStatements=true
Run Code Online (Sandbox Code Playgroud)
3.
continueBatchOnError=true
rewriteBatchedStatements=true
Run Code Online (Sandbox Code Playgroud)
并添加connection.setAutoCommit(false);但继续抛出重复的异常
编辑
忘了提,我用来连接Hibernate + Spring
唯一的For-Save示例是在Hibernate中创建的,但是为了性能,我尝试使用JDBC Batch,在webapp的其他过程中也使用JDBC与Hibernate的连接并且运行良好
这是完整的代码
@Transactional
public void …Run Code Online (Sandbox Code Playgroud) 我有这种情况:
我打开了一个解决方案,配置了一个使用的Web项目IIS
Express.
我做了解决方案的构建,然后关闭Visual Studio.
然后我重新打开VS到那个解决方案.
有没有办法只需启动IIS Express而不必做ctrl- F5或类似的东西(我不需要再次构建,因为我知道什么都没有改变)?
我试图自动装配一个包含@Async方法的bean,但它失败了,"注入自动连接的依赖项失败"
我的servlet.xml包含声明
<task:annotation-driven executor="executor" />
<task:executor id="executor" pool-size="7"/>
Run Code Online (Sandbox Code Playgroud)
我可以得到一些帮助,为什么这不能自动装配?
--- UPDATE ---这是错误的堆栈跟踪.
"cancelAppointment"是为MailService bean完成Autowire的bean id
2013-08-14 17:06:46,488|main|DEBUG|org.springframework.beans.factory.support.DisposableBeanAdapter|Invoking destroy() on bean with name 'org.springframework.scheduling.annotation.internalScheduledAnnotationProcessor'
2013-08-14 17:06:46,488|main|DEBUG|org.springframework.beans.factory.support.DisposableBeanAdapter|Invoking destroy() on bean with name 'executor'
2013-08-14 17:06:46,488|main|INFO|org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor|Shutting down ExecutorService
2013-08-14 17:06:46,492|main|ERROR|org.springframework.web.context.ContextLoader|Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cancelAppointment': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ge.appl.service.fs.manager.email.MailService com.ge.appl.service.fs.manager.cancel.consumer.CancelAppointmentImpl.mailService; nested exception is java.lang.IllegalArgumentException: Can not set com.ge.appl.service.fs.manager.email.MailService field com.ge.appl.service.fs.manager.cancel.consumer.CancelAppointmentImpl.mailService to $Proxy35
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) …Run Code Online (Sandbox Code Playgroud) 我正在使用IBM i(通常称为AS/400服务器).
目前我已经能够创建.CLASS文件并完美运行
在as400目录(我认为它被称为IFS或类似的东西)a我的树像:
/
+--Javacfd/
+--bin/
+--com/
+---company/
Class1.class
Class2.class
Hello.class
Server.class
+---other/
Other.class
Another.class
Etc.class
Run Code Online (Sandbox Code Playgroud)
当我运行RUNJVA CLASS('com.company.Hello')良好的作品!要么
RUNJVA CLASS('com.company.other.Other')
现在我需要运行一个可执行jar
在Windows中运行java -jar my-jar.jar良好
我尝试了as400
RUNJVA CLASS('hello.Application') CLASSPATH(':\Javacfd\bin\my-jar.jar')
Run Code Online (Sandbox Code Playgroud)
我明白了
线程"main"中的异常java.lang.NoClassDefFoundError:hello.Application
RUNJVA CLASS('hello.Application') CLASSPATH('Javacfd\bin\my-jar.jar')
Run Code Online (Sandbox Code Playgroud)
我明白了
线程"main"中的异常java.lang.NoClassDefFoundError:hello.Application
RUNJVA CLASS('hello.Application') CLASSPATH('\Javacfd\bin\my-jar.jar')
Run Code Online (Sandbox Code Playgroud)
我明白了
线程"main"中的异常java.lang.NoClassDefFoundError:hello.Application
RUNJVA CLASS('hello.Application')
Run Code Online (Sandbox Code Playgroud)
我明白了
线程"main"中的异常java.lang.NoClassDefFoundError:hello.Application
注意 hello是包,Application是一个Main类.Jar文件是语言环境\Javacfd\bin\my-jar.jar
我做错了?
我安装了https://github.com/aws/aws-sdk-php-laravel?SDK 并按照 readme.md 中的说明进行操作。一切都安装好了,我把我的密钥、秘密、地区等放在/app/config/packages/aws/aws-sdk-php-laravel.
我得到的错误
PHP Fatal error: Class 'Aws\Common\Aws' not found in /Volumes/Data/Users/chris/Sites/ln.com/vendor/aws/aws-sdk-php-laravel/src/Aws/Laravel/AwsServiceProvider.php on line 48
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Aws\\Common\\Aws' not found","file":"\/Volumes\/Data\/Users\/chris\/Sites\/ln.com\/vendor\/aws\/aws-sdk-php-laravel\/src\/Aws\/Laravel\/AwsServiceProvider.php","line":48}}
Run Code Online (Sandbox Code Playgroud)
上面引用的那个文件的第 48 行简单地说:
$aws = Aws::factory($config);
Run Code Online (Sandbox Code Playgroud)
我按照说明安装
我把我的提供者和别名放在 /app/config/app.php 中:
'Aws\Laravel\AwsServiceProvider'
Run Code Online (Sandbox Code Playgroud)
在提供者数组中。
我输入:
'AWS' => 'Aws\Laravel\AwsFacade'
Run Code Online (Sandbox Code Playgroud)
在别名部分。
然后,我尝试使用他们相同的用法示例:
$s3 = AWS::get('s3');
$s3->putObject(array(
'Bucket' => 'My Bucket',
'Key' => 'My Key',
'SourceFile'=> Config::get('settings.ProcessListings.image_dir') . $listing->mls_listing_id . "/test.txt"
));
Run Code Online (Sandbox Code Playgroud)
我试过的
我唯一的想法是在我试图在其中使用 SDK 的文件中,在顶部我有:
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
Run Code Online (Sandbox Code Playgroud)
我补充说:
use Aws\Laravel\AwsFacade;
use Aws\Laravel\AwsServiceProvider;
Run Code Online (Sandbox Code Playgroud)
和两者的组合,但都不起作用。有任何想法吗?
我想检查对象的每个属性值,如果所有值都等于0然后警告.如果只有一个属性包含0,则代码正在执行警报
var arr={a:"0", b:"1", c:"2"};
$.each(arr,function(i,val){
if(val=="0")
alert(0)
})
Run Code Online (Sandbox Code Playgroud) 我运行命令:
sudo python manage.py runserver 0.0.0.0:8800
Run Code Online (Sandbox Code Playgroud)
但是当我输入时:
http://xx.xx.xxx.xxx:8800
Run Code Online (Sandbox Code Playgroud)
其中 x 是我的外部 ip。我的 iPhone 无法访问该网站。
我朋友以前也这么做过。我该如何进行这项工作?
目前我必须生成一个XML文件,模拟SOAP请求,该文件应该使用X.509证书进行签名
此刻我有这种方法来签名文件
public static void SignXml(XmlDocument xmlDoc, X509Certificate2 uidCert)
{
CspParameters cspParams = new CspParameters();
cspParams.KeyContainerName = "XML_DSIG_RSA_KEY";
RSACryptoServiceProvider rsaKey = new RSACryptoServiceProvider(cspParams);
// Check arguments.
if (xmlDoc == null)
throw new ArgumentException("xmlDoc");
if (rsaKey == null)
throw new ArgumentException("Key");
// Create a SignedXml object.
SignedXml signedXml = new SignedXml(xmlDoc);
// Add the key to the SignedXml document.
signedXml.SigningKey = rsaKey;
// Specify a canonicalization method.
signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl;
// Set the InclusiveNamespacesPrefixList property.
XmlDsigExcC14NTransform canMethod = (XmlDsigExcC14NTransform)signedXml.SignedInfo.CanonicalizationMethodObject;
canMethod.InclusiveNamespacesPrefixList = …Run Code Online (Sandbox Code Playgroud) java ×3
console ×2
spring ×2
amazon-s3 ×1
c# ×1
django ×1
ibm-midrange ×1
iis-express ×1
jar ×1
javascript ×1
jdbc ×1
jquery ×1
laravel ×1
mysql ×1
php ×1
sdk ×1
soap ×1
spring-mvc ×1
weblogic ×1
xml ×1