[ 
https://issues.apache.org/jira/browse/WICKET-3869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289231#comment-13289231
 ] 

Jonathan Crabtree commented on WICKET-3869:
-------------------------------------------

A work-around for this problem, that I've implemented in our applications and 
works. Is to create a custom ServletWebResponse which extends the 
org.apache.wicket.protocol.http.servlet.ServletWebResponse. In your custom 
version override the flush method to do the flush and catch any exceptions, and 
ignore Socket Exceptions.

for example..
<code>
    @Override
    public void flush() {
        try {
            getContainerResponse().flushBuffer();
        } catch (SocketException e) {
            LOGGER.debug("Socket exception encountered, ignoring", e);
        } catch (IOException e) {
            // Socket Exception can be wrapped by a container specific 
exception.
            // So we check the cause of the container exception
            Throwable rootCause = null != getRootCause(e) ? getRootCause(e) : e;
            if (rootCause instanceof SocketException) {
                LOGGER.debug("Socket exception encountered, ignoring.", 
rootCause);
                return;
            }
            throw new ResponseIOException(e);
        }
    }
</code>
( getRootCause() come from apache ExceptionUtils )

Then to use this you need to override the newWebResponse method in your 
WebApplication to return an instance of you custom WebResponse.

Hope this is useful for anyone who wants to avoid spurious exceptions in thier 
logs.
                
> ResponseIOException when ajax response contains resource reference
> ------------------------------------------------------------------
>
>                 Key: WICKET-3869
>                 URL: https://issues.apache.org/jira/browse/WICKET-3869
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-RC5.1
>         Environment: Internet Explorer
>            Reporter: Sodasmile
>              Labels: ResponseIOException, explorer, internet
>             Fix For: 1.5-RC6
>
>         Attachments: Eofproject.7z, internetexplorer-requests.png, 
> iwicket-no-image.tgz, iwicket.zip, lazyloaderror.zip
>
>
> When ajax response (show modal window) contains shared image response, server 
> log reports ResponseIOException.
> See attached example application. Using maven, type mvn package jetty:run. 
> Open http://localhost/8080/iwicket/ in Internet Explorer, click the link, 
> watch server log (may need to open/close modal window a few times, but 
> usually appears on first attempt). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to