You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Thomas Bellembois <th...@univ-rennes1.fr> on 2005/05/23 10:59:14 UTC

507 error in a listener

Hello,

How can we send a 507 (Insufficient Storage) exception in a listener.
I tried with the following code :

InsufficientStorageException insufficientStorageException = new 
InsufficientStorageException(requestUri, connectedUser, QUOTA_EXCEEDED);
VetoException vetoException = new VetoException(QUOTA_EXCEEDED);
vetoException.initCause(insufficientStorageException);
throw vetoException;

...but a 406 error is sent.

Any idea ?

Thank you.

Thomas

-- 
+---=(    Thomas Bellembois    )=---+
| CRI - University of Rennes 1 - FR |
| thomas.bellembois@univ-rennes1.fr |
| +33 2 23 23 69 60                 |
+-----------------------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: 507 error in a listener

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
Hello Stefan,

Thank you very much for comiting my changes.
Concerning the put method, your solution is what I have done.
I have now a first version of quotas.
I will finish to comment my code and make other tests.

Regards,

Thomas

Stefan Lützkendorf wrote:

> Hello Thomas,
>
> I added your changes at the cvs head. Thanks. Next time a patch would 
> be nice, which you can submit in bugzilla.
>
> To the other point you wrote earlier regarding events in PUT methods:
>
> - the PutMethod does not delete an existing resource so we cant create 
> putBeforeDelete,
>   putAfterDelete events.
>
> - may be you can test whether a resource exists by trying
>
>    public void put(WebdavEvent event) throws VetoException {
>       PutMethod method = (PutMethod)event.getSource();
>
>       try {
>          method.getContent().retrieve(method.getSlideToken(), 
> method.getRequestUri());
>
>          // the resource always exists
>          ...
>       } catch(ObjectNotFoundException e) {
>          // the resource does not exist
>          ...
>       }
>    }
>
> Regards,
> Stefan
>
>
> Thomas Bellembois wrote:
>
>> Hi Stefan !
>>
>> The getCause method comes not from the java.lang.Exception class but 
>> from the java.lang.Throwable class (I was too tired ;-))
>> But it is not present in the JDK 1.3 either.
>> I have put the getCause and initCause methods in the SlideException 
>> class and modified the WebdavUtils class to manage 
>> InsufficientStorageException.
>> It's working but I would appreciate very much you to check my work 
>> because I am not sure that is is very... clean...
>> I don't know how I can send you my work (mail attachment ?). So I 
>> have put it at :
>> http://perso.univ-rennes1.fr/thomas.bellembois/partage/Slide/
>>
>> Thank you.
>> Regards,
>>
>> Thomas
>>
>>
>> Stefan Lützkendorf wrote:
>>
>>> thomas.bellembois@univ-rennes1.fr wrote:
>>>
>>>> Hi Stefan,
>>>>
>>>> The initCause method comes from the java.lang.Exception class.
>>>> There is also a getCause method. 
>>>
>>>
>>>
>>> Ok, I see. But it only exists there in JDK 1.4.
>>> The last decision regarding supported JDK was to maintain 1.3.
>>>
>>> We should add the required methods to SlideException, I think.
>>>
>>>> I will provide a patch for the WebdavUtils
>>>
>>>
>>>
>>>
>>> Great
>>>
>>>> class. I will do it next week given that I am currently not at my 
>>>> office
>>>> (training). Thank you very much for your help.
>>>>
>>>
>>> Cheers, Stefan
>>>
>>>
>>
>>
>
>


-- 
+---=(    Thomas Bellembois    )=---+
| CRI - University of Rennes 1 - FR |
| thomas.bellembois@univ-rennes1.fr |
| +33 2 23 23 69 60                 |
+-----------------------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: 507 error in a listener

Posted by Stefan Lützkendorf <lu...@apache.org>.
Hello Thomas,

I added your changes at the cvs head. Thanks. Next time a patch would be nice, which you can submit 
in bugzilla.

To the other point you wrote earlier regarding events in PUT methods:

- the PutMethod does not delete an existing resource so we cant create putBeforeDelete,
   putAfterDelete events.

- may be you can test whether a resource exists by trying

    public void put(WebdavEvent event) throws VetoException {
       PutMethod method = (PutMethod)event.getSource();

       try {
          method.getContent().retrieve(method.getSlideToken(), method.getRequestUri());

          // the resource always exists
          ...
       } catch(ObjectNotFoundException e) {
          // the resource does not exist
          ...
       }
    }

Regards,
Stefan


Thomas Bellembois wrote:
> Hi Stefan !
> 
> The getCause method comes not from the java.lang.Exception class but 
> from the java.lang.Throwable class (I was too tired ;-))
> But it is not present in the JDK 1.3 either.
> I have put the getCause and initCause methods in the SlideException 
> class and modified the WebdavUtils class to manage 
> InsufficientStorageException.
> It's working but I would appreciate very much you to check my work 
> because I am not sure that is is very... clean...
> I don't know how I can send you my work (mail attachment ?). So I have 
> put it at :
> http://perso.univ-rennes1.fr/thomas.bellembois/partage/Slide/
> 
> Thank you.
> Regards,
> 
> Thomas
> 
> 
> Stefan Lützkendorf wrote:
> 
>> thomas.bellembois@univ-rennes1.fr wrote:
>>
>>> Hi Stefan,
>>>
>>> The initCause method comes from the java.lang.Exception class.
>>> There is also a getCause method. 
>>
>>
>> Ok, I see. But it only exists there in JDK 1.4.
>> The last decision regarding supported JDK was to maintain 1.3.
>>
>> We should add the required methods to SlideException, I think.
>>
>>> I will provide a patch for the WebdavUtils
>>
>>
>>
>> Great
>>
>>> class. I will do it next week given that I am currently not at my office
>>> (training). Thank you very much for your help.
>>>
>>
>> Cheers, Stefan
>>
>>
> 
> 


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: 507 error in a listener

Posted by Thomas Bellembois <th...@univ-rennes1.fr>.
Hi Stefan !

The getCause method comes not from the java.lang.Exception class but 
from the java.lang.Throwable class (I was too tired ;-))
But it is not present in the JDK 1.3 either.
I have put the getCause and initCause methods in the SlideException 
class and modified the WebdavUtils class to manage 
InsufficientStorageException.
It's working but I would appreciate very much you to check my work 
because I am not sure that is is very... clean...
I don't know how I can send you my work (mail attachment ?). So I have 
put it at :
http://perso.univ-rennes1.fr/thomas.bellembois/partage/Slide/

Thank you.
Regards,

Thomas


Stefan Lützkendorf wrote:

> thomas.bellembois@univ-rennes1.fr wrote:
>
>> Hi Stefan,
>>
>> The initCause method comes from the java.lang.Exception class.
>> There is also a getCause method. 
>
> Ok, I see. But it only exists there in JDK 1.4.
> The last decision regarding supported JDK was to maintain 1.3.
>
> We should add the required methods to SlideException, I think.
>
>> I will provide a patch for the WebdavUtils
>
>
> Great
>
>> class. I will do it next week given that I am currently not at my office
>> (training). Thank you very much for your help.
>>
>
> Cheers, Stefan
>
>


-- 
+---=(    Thomas Bellembois    )=---+
| CRI - University of Rennes 1 - FR |
| thomas.bellembois@univ-rennes1.fr |
| +33 2 23 23 69 60                 |
+-----------------------------------+


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: 507 error in a listener

Posted by Stefan Lützkendorf <lu...@apache.org>.
thomas.bellembois@univ-rennes1.fr wrote:
> Hi Stefan,
> 
> The initCause method comes from the java.lang.Exception class.
> There is also a getCause method. 
Ok, I see. But it only exists there in JDK 1.4.
The last decision regarding supported JDK was to maintain 1.3.

We should add the required methods to SlideException, I think.

>I will provide a patch for the WebdavUtils

Great
> class. I will do it next week given that I am currently not at my office
> (training). Thank you very much for your help.
> 

Cheers, Stefan


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: 507 error in a listener

Posted by th...@univ-rennes1.fr.
Hi Stefan,

The initCause method comes from the java.lang.Exception class.
There is also a getCause method. I will provide a patch for the WebdavUtils
class. I will do it next week given that I am currently not at my office
(training). Thank you very much for your help.

Thomas

Selon Stefan Lützkendorf <lu...@apache.org>:

> Hello Thomas,
> 
> we have to adapt the getErrorCode method in
> org.apache.slide.webdav.util.WebdavUtils.
> There are handled VetoExceptions an translated to 406.
> 
> Where comes the initCause method from? Is there a getCause method to. Then we
> could
> switch with regard to the cause in the getErrorCode method.
> 
> Can you do that and provide a patch?
> 
> The other point of your earlier mail (regarding putBeforeDelete,
> putAfterDelete, ...) I have not 
> checked yet. But I'll do.
> 
> Best regards,
> Stefan
> 
> Thomas Bellembois wrote:
> 
> > Hello,
> > 
> > How can we send a 507 (Insufficient Storage) exception in a listener.
> > I tried with the following code :
> > 
> > InsufficientStorageException insufficientStorageException = new 
> > InsufficientStorageException(requestUri, connectedUser, QUOTA_EXCEEDED);
> > VetoException vetoException = new VetoException(QUOTA_EXCEEDED);
> > vetoException.initCause(insufficientStorageException);
> > throw vetoException;
> > 
> > ...but a 406 error is sent.
> > 
> > Any idea ?
> > 
> > Thank you.
> > 
> > Thomas
> > 
> 
> 
> -- 
> Stefan Lützkendorf  --  luetzkendorf@apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: 507 error in a listener

Posted by Stefan Lützkendorf <lu...@apache.org>.
Hello Thomas,

we have to adapt the getErrorCode method in org.apache.slide.webdav.util.WebdavUtils.
There are handled VetoExceptions an translated to 406.

Where comes the initCause method from? Is there a getCause method to. Then we could
switch with regard to the cause in the getErrorCode method.

Can you do that and provide a patch?

The other point of your earlier mail (regarding putBeforeDelete, putAfterDelete, ...) I have not 
checked yet. But I'll do.

Best regards,
Stefan

Thomas Bellembois wrote:

> Hello,
> 
> How can we send a 507 (Insufficient Storage) exception in a listener.
> I tried with the following code :
> 
> InsufficientStorageException insufficientStorageException = new 
> InsufficientStorageException(requestUri, connectedUser, QUOTA_EXCEEDED);
> VetoException vetoException = new VetoException(QUOTA_EXCEEDED);
> vetoException.initCause(insufficientStorageException);
> throw vetoException;
> 
> ...but a 406 error is sent.
> 
> Any idea ?
> 
> Thank you.
> 
> Thomas
> 


-- 
Stefan Lützkendorf  --  luetzkendorf@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org