Robin Wyles pisze:
Hi,

How can I get hold of a MultipartHttpServletRequest in a generator?

If I do this...

final WebApplicationContext parentContext = WebAppContextUtils.getCurrentWebApplicationContext(); final ProcessInfoProvider infoProvider = (ProcessInfoProvider) parentContext.getBean(ProcessInfoProvider.ROLE);
HttpServletRequest request = infoProvider.getRequest();
MultipartHttpServletRequest mpr = (MultipartHttpServletRequest) request;

I get the following error when the final line is executed...

java.lang.ClassCastException: $Proxy13

Eclipse debugger shows that request is an instance of MultipartHttpServletRequest.

What's the secret?

The secret is how JVM proxies work with the fact that MultipartHttpServletRequest is a class not interface.

Situations like this are little bit worrying me but anyway standard question: why do you want to cast to MultipartHttpServletRequest?

--
Grzegorz Kossakowski

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

Reply via email to