pátek 21. září 2012

Windows update KB2735855

Hello, 21.9.2012

Do you have Windows?
Is your stream freezing, timeouting, or you are getting samething like this:

missing CR

Caused by: org.jvnet.mimepull.MIMEParsingException: java.io.IOException: missing CR
 at org.jvnet.mimepull.MIMEParser.fillBuf(MIMEParser.java:436)
 at org.jvnet.mimepull.MIMEParser.readBody(MIMEParser.java:204)
 at org.jvnet.mimepull.MIMEParser.access$600(MIMEParser.java:62)
 at org.jvnet.mimepull.MIMEParser$MIMEEventIterator.next(MIMEParser.java:154)
 at org.jvnet.mimepull.MIMEParser$MIMEEventIterator.next(MIMEParser.java:123)
 at org.jvnet.mimepull.MIMEMessage.makeProgress(MIMEMessage.java:193)
 at org.jvnet.mimepull.MIMEMessage.parseAll(MIMEMessage.java:176)
 at org.jvnet.mimepull.MIMEMessage.(MIMEMessage.java:89)
 at com.sun.xml.ws.encoding.MimeMultipartParser.(MimeMultipartParser.java:88)
 at com.sun.xml.ws.encoding.MimeCodec.decode(MimeCodec.java:180)
 at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:352)
 ... 101 more
Caused by: java.io.IOException: missing CR
 at sun.net.www.http.ChunkedInputStream.processRaw(ChunkedInputStream.java:378)
 at sun.net.www.http.ChunkedInputStream.readAheadBlocking(ChunkedInputStream.java:545)
 at sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:582)
 at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:669)
 at java.io.FilterInputStream.read(FilterInputStream.java:116)
 at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2668)
 at java.io.FilterInputStream.read(FilterInputStream.java:116)
 at org.jvnet.mimepull.MIMEParser.fillBuf(MIMEParser.java:434)
 ... 111 more
or
XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '<' (code 60)excepted either space or "?>" after PI target

Uninstall Windows Update KB2735855

Boys totally destroyed TCP. I hate them! It took us a lot of time to find out what is going on.

středa 5. září 2012

Spring Security - How to prolong resonse times on login failed?

Spring Security - How to prolong resonse times on login failed?
It seems that there is nice and simple way to achive it, if you create own UsernamePasswordAuthenticationFilter.

An article on this topic can be found here http://mrather.blogspot.cz/2010/02/extending-usernamepasswordauthenticatio.html

import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class CustomUsernamePasswordAuthenticationFilter extends
        UsernamePasswordAuthenticationFilter {

    @Override
    protected void unsuccessfulAuthentication(HttpServletRequest request,
                                              HttpServletResponse response,
                                              AuthenticationException failed)
            throws IOException, ServletException {
        super.unsuccessfulAuthentication(request, response, failed);

        //Well login failed - we are going to prolong server response

        String username = request.getParameter(getUsernameParameter());
        String password = request.getParameter(getPasswordParameter());
        String ip = request.getRemoteAddr();

        //And here must be some code,
        // that prolong response based on previous login failed attempts
        ownResponseTimeProlonger.prolong(username, password, ip);
    }
}
OK - now you just need, or find something like ownResponseTimeProlonger.prolong(username, password, ip);