You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Scott Snyder <ss...@flashpoint.com> on 2000/12/14 21:09:19 UTC

Forwarding into an Action servlet

I have a situation where I have a client that always issues requests to the
same servlet. This request is a multipart/form that contains the name of the
actual destination of the request.
I am trying to use struts to do this routing by having a (non action)servlet
parse the multipart/form to determine the actual destination, and then
forwarding to that destination (to /destination.do).
When I do this I get the following exception:

java.lang.NullPointerException
	at
org.apache.struts.upload.MultipartIterator.parseRequest(MultipartIterator.ja
va:271)
	at
org.apache.struts.upload.MultipartIterator.<init>(MultipartIterator.java:105
)
	at
org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMulti
partRequestHandler.java:52)
	at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:718)
	at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:16
92)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1320)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:447)

This is where the ActionServlet is trying to parse the multipart/form data.
This line in parseRequest is
        if (!readLine().startsWith(boundary)) {
where the first line of the multipart/form is being read. It is as if the
inputStream that readLine reads from is null.

My questions are:
1. Can one forward to an ActionServlet from another servlet?
2. Is there a better way of doing this that is more "compatible" with
struts?

Thanks for your help,

Scott Snyder

Flashpoint Technlogies Inc.