public boolean dispatch ( String dispatch , String [ ] parameters ) // throws IOException { String dispatchURL = dispatch ; HttpServletRequest servletRequest = httpRequest . get ( ) ; HttpServletResponse servletResponse = httpResponse . get ( ) ; //set content type, because otherwise the response // may be interpreted as text/plain servletResponse . setContentType ( "text/html; charset=UTF-8" ) ; try { //pass set attributes as new servlet parameters (a hack to get rid of) Request request = requestRegistry . getCurrentRequest ( ) ; if ( request != null ) { for ( Object name : request . getAttributeMap ( ) . keySet ( ) ) { Object o = request . getAttributeMap ( ) . get ( name ) ; servletRequest . setAttribute ( name . toString ( ) , o ) ; } } //servlet-include, servlet-forward, service-invocation switch ( this . dispatchMode ) { case FORWARD : { ServletSupport . forward ( dispatchURL , servletRequest , servletResponse ) ; } default : //INCLUDE { ServletSupport . include ( dispatchURL , servletRequest , servletResponse ) ; } } } catch ( ServletException e ) { throw new ResourceException ( "failed to dispatch servlet request to " + dispatchURL , e ) ; } catch ( IOException e ) { throw new ResourceException ( "failed to dispatch servlet request to " + dispatchURL , e ) ; } return true ; }
Iglu request attributes will be copied to the servlet request .