NamedDispatcher

"Karl Rove" <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
Hello,

I noticed that servletContext.getNamedDispatcher() isn't implemented in
com/meterware/servletunit/ServletUnitServletContext.java.

As President Bush's Deputy Chief of Staff, I need this for my servlets. I've
attached a diff of the change I made to get it to work for me. Any
objections to including this?

diff --recursive
original-src/com/meterware/servletunit/ServletUnitServletContext.java
src/com/meterware/servletunit/ServletUnitServletContext.java
22a23,24
> import javax.servlet.ServletContext;
> import javax.servlet.ServletException;
26d27
<
30d30
<
33d32
< import java.util.Vector;
35,36c34
<
< import javax.servlet.*;
---
> import java.util.Vector;
173,175c171,188
<     public javax.servlet.RequestDispatcher getNamedDispatcher(
java.lang.String A) {
<         return null;   // XXX not implemented
<     }
---
>     public javax.servlet.RequestDispatcher getNamedDispatcher(
java.lang.String servletName) {
>       URL url;
>       try {
>           if ( ! servletName.startsWith("/")) {
>               servletName = "/" + servletName;
>           }
>           url = new URL( "http", "localhost",
_application.getContextPath() + servletName );
>       } catch (MalformedURLException e) {
>           e.printStackTrace();
>           return null;
>       }
>       try {
>           return new RequestDispatcherImpl(this._application, url);
>       } catch (ServletException e) {
>           e.printStackTrace();
>           return null;
>       }
>   }


Yours in Oil,
Karl Rove
_______________________________________________________________
Enron - Boeing - General Electric - Pfizer - White House
ServletUnitServletContext.java.diff (application/octet-stream, 1 KB)
diff --recursive original-src/com/meterware/servletunit/ServletUnitServletContext.java src/com/meterware/servletunit/ServletUnitServletContext.java
22a23,24
> import javax.servlet.ServletContext;
> import javax.servlet.ServletException;
26d27
< 
30d30
< 
33d32
< import java.util.Vector;
35,36c34
< 
< import javax.servlet.*;
---
> import java.util.Vector;
173,175c171,188
<     public javax.servlet.RequestDispatcher getNamedDispatcher(java.lang.String A) {
<         return null;   // XXX not implemented
<     }
---
>     public javax.servlet.RequestDispatcher getNamedDispatcher(java.lang.String servletName) {
> 		URL url;
> 		try {
> 			if ( ! servletName.startsWith("/")) {
> 				servletName = "/" + servletName;
> 			}
> 			url = new URL( "http", "localhost", _application.getContextPath() + servletName );
> 		} catch (MalformedURLException e) {
> 			e.printStackTrace();
> 			return null;
> 		}
> 		try {
> 			return new RequestDispatcherImpl(this._application, url);
> 		} catch (ServletException e) {
> 			e.printStackTrace();
> 			return null;
> 		}
> 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.