小编cht*_*cht的帖子

Spring安全注销处理

根据Spring Security 4.0.0文档:

4.2.4注销处理

logout元素通过导航到特定URL添加了对注销的支持.默认的注销URL是/ logout,但您可以使用logout-url属性将其设置为其他内容.有关其他可用属性的更多信息,请参见命名空间附录.

但是,在doc中遵循安全设置后,URL/logout不会显示注销页面.相反,它表明

在此输入图像描述

相反,URL /登录正常.

在此输入图像描述

以下是我的设置:

Spring Framework 4.1.6
Spring Security 4.0.0

在web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">
    <display-name>Test8</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/security-config.xml</param-value>
    </context-param>


</web-app>
Run Code Online (Sandbox Code Playgroud)

安全-config.xml中

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/security
           http://www.springframework.org/schema/security/spring-security.xsd">
    <http>
        <intercept-url pattern="/**" access="hasRole('USER')" />
        <form-login />
        <logout />
    </http>

    <authentication-manager>
        <authentication-provider>
            <user-service> …
Run Code Online (Sandbox Code Playgroud)

spring spring-security

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

将位图转换为字符串

我可以将Bitmap转换为String吗?然后将String转换回Bitmap?

提前致谢.

android

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

在Android上使用URL会抛出IOException:格式错误的ipv6地址

我想将android模拟器上的数据发送到本地主机网站,并获得一些结果.

String temp = "http://10.0.2.2:8888/json/rec?user_data=" + user_data + "&friends=" + friends;
URL url = new URL(temp);

HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setReadTimeout(5000);
InputStreamReader is = new InputStreamReader(urlConnection.getInputStream(), "UTF-8");
String output = "";
while(is.ready()) {
    output += is.read();
}
Run Code Online (Sandbox Code Playgroud)

这是例外.

java.io.IOException: Malformed ipv6 address: [10.0.2.2:8888]
Run Code Online (Sandbox Code Playgroud)

为什么这么说?有人能帮助我吗?提前致谢.

java android

3
推荐指数
1
解决办法
5438
查看次数

标签 统计

android ×2

java ×1

spring ×1

spring-security ×1