axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 26654] - Temporary Redirect causes AxisFault
Date Wed, 18 Feb 2004 14:45:42 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26654>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26654

Temporary Redirect causes AxisFault





------- Additional Comments From matthias.mueller@datev.de  2004-02-18 14:45 -------
Here's my suggestion for 307 temporary redirects (code snippet only):

package org.apache.axis.transport.http;
...
public class HTTPSender extends BasicHandler {
    ...
    private InputStream readFromSocket(Socket sock,
                                       MessageContext msgContext,
                                       InputStream inp,
                                       Hashtable headers)
            throws IOException {
        ...
        } else {
            ByteArrayOutputStream buf = new ByteArrayOutputStream(4097);
            while (-1 != (b = (byte) inp.read())) {
                buf.write(b);
            }
                                        
            // Temporary Redirect
            if ( returnCode == 307) {
                // parse out new url
                String detail = buf.toString().toLowerCase();
                int start = detail.indexOf("<a href=") + 9;
                int end = detail.indexOf(">", start) - 1;
                String newURL = buf.toString().substring(start, end);
                // set our new target url
                msgContext.setProperty(MessageContext.TRANS_URL, newURL);
                // next try
                invoke(msgContext);			
                return inp;
            }
            
            // Unknown return code - so wrap up the content into a
            // SOAP Fault.
            String statusMessage = msgContext.getStrProp(			
	            HTTPConstants.MC_HTTP_STATUS_MESSAGE);
             
            AxisFault fault = new AxisFault("HTTP", "(" + returnCode + ")" +
                                                    statusMessage, null, null);

            fault.setFaultDetailString(Messages.getMessage("return01",
                    "" + returnCode, buf.toString()));
            fault.addFaultDetail(Constants.QNAME_FAULTDETAIL_HTTPERRORCODE,
                    Integer.toString(returnCode));
            throw fault;
        }
        ...
    }

    ...
}

If anybody is willing to put this in Axis 1.2, feel free to do so.

-Matthias

Mime
View raw message