dev@woodstock.java.net

Re: ? on upload filter init params

From: richard ratta <Richard.Ratta_at_Sun.COM>
Date: Wed, 24 Oct 2007 17:07:51 -0400

Bob Yennaco wrote:

>
>
> richard ratta wrote:
>
>> good question.
>>
>> I am always amazed how difficult it is to get certain information from
>> a web app's servlet, even when in the servlet. I can't find any.
>>
>> The closest thing I can see is adding listeners that get called when
>> filters
>> and servlets are invoked.
>>
>> Can I ask why you need to know this ?
>
> issue #132.

So you're gonna force me to waste another 5 minutes of my life waiting
for java.net ;)

> And so I figured the way to do this was in my validator - compare the
> size of the file to be uploaded with "maxSize" as specified in the
> filter. If it's too big, throw an exception.

How can you find out the size of the file you want to upload ?

>
>> Since you are the application developer, you set the value ;)
>
> It already is - in the filter.

What I meant was "You as the app developer set the value in web.xml" and
therefore you know what it is."
And therefore you don't have to find it at runtime you already know it,
so if want to
display the value just hard code it.

I don't think you are going to be able to do anything on the client to
prevent an
oversized file from being uploaded.

Are you sure this code is still throwing exceptions ?
Alot has changed, if "132" is any indication of when this issue was posted.

-rick

>
>>
>> -rick
>>
>> Bob Yennaco wrote:
>>
>>>
>>> If I have the following filter config in web.xml
>>>
>>> <filter>
>>> <filter-name>UploadFilter</filter-name>
>>> <filter-class>com.sun.webui.jsf.util.UploadFilter</filter-class>
>>> <init-param>
>>> <param-name>maxSize</param-name>
>>> <param-value>1000000</param-value>
>>> </init-param>
>>> </filter>
>>>
>>> Then can someone tell me what interface I need to use from my app to
>>> get access to the maxSize parameter? If I can get ahold of the
>>> javax.servlet.FilterConfig, then I can call
>>> getInitParameter("maxSize") on it and I'm in business, right? So
>>> then how do I get access to the FilterConfig? I would have thought
>>> that UploadFilter would have a getFilterConfig() method but it
>>> doesn't. Even if it did, how would I get a handle to the
>>> UploadFilter object?
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_woodstock.dev.java.net
>>> For additional commands, e-mail: dev-help_at_woodstock.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_woodstock.dev.java.net
>> For additional commands, e-mail: dev-help_at_woodstock.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_woodstock.dev.java.net
> For additional commands, e-mail: dev-help_at_woodstock.dev.java.net
>