Reputation: 13
sorry for my poor english, my current config like this:
<bean class="org.springframework.session.web.http.DefaultCookieSerializer">
<property name="cookieName" value="test_sessionid"></property>
<property name="cookiePath" value="/"></property>
<!-- <property name="domainName" value="example.com"></property> -->
<property name="domainNamePattern" value="^.+?\\.(\\w+\\.[a-z]+)$"></property>
</bean>
i want to custom a domain,it is working well while i configured the domainName
property.but when i configure the domainNamePattern
as above,it just working on localhost
and ip address,but no
www.example.com
test.example.com
tks.
Upvotes: 1
Views: 2095
Reputation: 21720
It looks like you are not using a valid Regular Expression (the expression is escaped for Java String but you are using XML). The expression will not match any of the domains so it will always use the current domain. Try the following instead:
<bean class="org.springframework.session.web.http.DefaultCookieSerializer">
<property name="cookieName" value="test_sessionid"></property>
<property name="cookiePath" value="/"></property>
<!-- <property name="domainName" value="example.com"></property> -->
<property name="domainNamePattern" value="^.+?\.(\w+\.[a-z]+)$"></property>
</bean>
Upvotes: 3