You are here

jianyu's blog

Add custom spring securtiy expression method

There are no offcial ways to add custom security expression, like hasRole / hasAuthority etc, the only way is to do some tweaking.
 
Solution 1. Create a static method and invoke by spel. Like below:
 
                <security:authorize access="T(com.Class).doSomething(request.parameterMap['parameterName'], 'ROLE_ADMIN')">

python, xpath and ElementTree

Failed to find a xpath solution in python2.6 standard library. Seems like ElementTree is the only API have limited xpath support. But...
 
http://effbot.org/zone/element-xpath.htm
http://codespeak.net/pipermail/lxml-dev/2006-May/001294.html
And for my test code:

deps = tree.findall("//dependency[@testP='testV']")
print deps

 
Error:

SyntaxError: expected path separator ([)
 
Also Find:

Seam, JPA & Resin

These days I am transportting some seam-jpa based web applications from jboss to resin. But found there is a bug for seam to create EntityManagerFactory in resin:

[19:34:46.510]org.jboss.seam.InstantiationException: Could not instantiate Seam
component: application_form_Database
[19:34:46.510]  at org.jboss.seam.Component.newInstance(Component.java:2144)
[19:34:46.510]  at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)

...

Selenium-RC and https certification

It realy waste me several days to find a way to test our https application. Each time I start it manually I must add an exception of certificatioin into firefox, so it can't be ran in an automated test system. Until I found this:
 
http://townx.org/blog/elliot/dealing-self-signed-ssl-certificates-when-r...
 
Just in case of lost this article, I copied the solution here:
 

Pages