DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31931>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31931

request wrapper class is not pluggable





------- Additional Comments From [EMAIL PROTECTED]  2004-10-28 05:16 -------
Hmm ... looks like RequestProcessor.processMultipart() always uses a
MultipartRequestWrapper if the content type is "multipart/form-data". 
The controller setting you are trying to change sets the
MultipartHandler class, not the request wrapper class.

One could argue that the wrapper class ought to be pluggable as well
(if you believe so, the best thing would be to submit an enhancement
request into http://issues.apache.org/bugzilla/).  In the mean time,
one thing you can do is use the getRequest() method of each wrapper,
and walk up the chain of wrappers to find the one you want.  Something
like:

    MySpecialRequest myRequest = null;
    if (request instanceof MySpecialRequest) {
        myRequest = (MySpecialRequest) request;
    } else if (request instance of HttpServletRequestWrapper) {
        HttpServletRequestWrapper wrapper = (HttpServletRequestWrapper) request;
        while (wrapper != null) {
            if (wrapper instanceof MySpecialRequest) {
                myRequest = (MySpecialRequest) wrapper;
                break;
            }
            wrapper = (HttpServletRequestWrapper) wrapper.getRequest();
        }
    }

You'll run into problems if for some reason your wrapped request isn't
in the stack, so you might put some extra error checking in for that
... but something along these lines should get you access to the
special things in your wrapper.

Craig

On Wed, 27 Oct 2004 12:45:49 +0300, Seyhan Basmaci 
<[EMAIL PROTECTED]> wrote:
> 
> We are decorating each request object for our requirements.
> 
>     MySpecialRequest customReq=  MySpecialRequest(request);
> 
> Also , MySpecialRequest extends HttpRequest
> 
> If the content type is  multipart/form-data ,also struts decorates  our request 
object in
> processMultipart method and returns an instance of "MultipartRequestWrapper" 
class.
> Then our code fall into "ClassCastException" error.
>  (  MySpecialRequest req=  (MySpecialRequest) request;  )
> 
> to override this problem;
> 
> firstly,in struts-config.xml , I added  MultipartClass class definiton,
> <controller 
MultipartClass="com.internet.common.util.MyServletRequestWrapper" >
> 
> later, I changed superClass of my "MySpecialRequest" class as such below ;
> MySpecialRequest extends MultipartRequestWrapper
> 
> but, struts still returns an instance of  MultipartRequestWrapper,, my code still 
fails..
> 
> any idea or solution to this problem ???
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to