Delete URL generated does not work

View: New views
3 Messages — Rating Filter:   Alert me  

Delete URL generated does not work

by MarkAtHarvest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At first, I would like to thank James for a amazing Jets3t Toolkit,

Everything is working but the Delete URL. (I can use Get URL to retrieve files, HEAD Url to generate S3Object back)
I have generated Get URL and Delete URL from JetS3t objects, my Get URL is working but my Del URL is not working

Here is the code to generate the URLs
Calendar cal = Calendar.instance;
        cal.add(Calendar.MINUTE, 5);
        Date expiryDate = cal.getTime();
 
AznS3Object as3obj = new AznS3Object(bucket:it.bucketName,key:it.key)
 String getUrl = S3Service.createSignedGetUrl(it.bucketName,it.key, awsCredentials, expiryDate, false)
 String delUrl = S3Service.createSignedDeleteUrl(it.bucketName, it.key, awsCredentials, expiryDate, false)
 log.debug("DEBUG DELE URL is-> $delUrl")

############
Here is my Debug Message
10:13:52.859 DEBUG DELE URL is->  https://harvesttrial.s3.amazonaws.com/OUTROS_L
earning_JQuery.pdf?AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231427932&Signat
ure=w42joM9BZpugbBZ1gYTLPngrSQQ%3D


###########################3
Here is my Corresponding HTML Page

<code>
                     
     <tr class="odd">                        
     
     <td>a href="https://harvesttrial.s3.amazonaws.com/OUTROS_Learning_JQuery.pdf?AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231426644&Signature=5UaxwOhXsJ5d9bucyirBwL9wJ2M%3D" target="_blank">OUTROS_Learning_JQuery.pdf</td>
                       
     
     <td>application/pdf</td>

     <td></td>

     <td>a href="https://harvesttrial.s3.amazonaws.com/OUTROS_Learning_JQuery.pdf?AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231426644&Signature=4lw7ovgAclmjj3FZNNfFVG4A6sA%3D" target="_blank">Delete</td>
                       
                       
     </tr>

<code>
############################33
If I try to Delete the Object by clicking the URL

I get following message
<Error>
<Code>SignatureDoesNotMatch</Code>

<Message>
The request signature we calculated does not match the signature you provided. Check your key and signing method.
</Message>

<StringToSignBytes>
47 45 54 0a 0a 0a 31 32 33 31 34 32 37 39 33 32 0a 2f 68 61 72 76 65 73 74 74 72 69 61 6c 2f 42 6f 6f 6b 4f 6e 47 69 74 2e 70 64 66
</StringToSignBytes>
<RequestId>B8039A6F3E90F2CA</RequestId>

<HostId>
i4/pA/SDJIK3x8aWdeB17YEH0QPRzjJAHzowK5oWr0bSBw6BYmm+o6cpPj9i7Mjf
</HostId>
<SignatureProvided>VwsgUw2TbnDhwEkdIvsUux7kqVs=</SignatureProvided>
<StringToSign>GET


1231427932
/harvesttrial/BookOnGit.pdf</StringToSign>
<AWSAccessKeyId>14M0Q3PZ3W9HHZZN6AR2</AWSAccessKeyId>
</Error>

#####################################33
After 5mins, when the link expires, I do get the right expiry message though

Pls Help!!

Re: Delete URL generated does not work

by James Murty-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The signed Delete URLs will not work directly within web browsers,  
because you must send a DELETE HTTP request to S3 to delete an object  
instead of the standard GET request that a browser sends when it  
follows a link.

To used signed Delete URLs within a browser the way you want, you will  
need to use Javascript to create and send the DELETE request that S3  
requires. This could get tricky because you will need to create a  
request with exactly the same HTTP headers as the ones you signed.

While using S3 GET requests is very easy, the other request types are  
much harder.

Hope this helps,
James


On 09/01/2009, at 2:17 AM, MarkAtHarvest <mark@...>  
wrote:

>
> At first, I would like to thanks James for Jets3t Toolkit,
>
> I have generated Get URL and Delete URL from JetS3t objects, my Get  
> URL is
> working but my Del URL is not working
>
> Here is the code to generate the URLs
> Calendar cal = Calendar.instance;
>        cal.add(Calendar.MINUTE, 5);
>        Date expiryDate = cal.getTime();
>
> AznS3Object as3obj = new AznS3Object(bucket:it.bucketName,key:it.key)
> String getUrl = S3Service.createSignedGetUrl(it.bucketName,it.key,
> awsCredentials, expiryDate, false)
> String delUrl = S3Service.createSignedDeleteUrl(it.bucketName, it.key,
> awsCredentials, expiryDate, false)
> log.debug("DEBUG DELE URL is-> $delUrl")
>
> ############
> Here is my Debug Message
> 10:13:52.859 DEBUG DELE URL is->
> https://harvesttrial.s3.amazonaws.com/OUTROS_L
> earning_JQuery.pdf?
> AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231427932&Signat
> ure=w42joM9BZpugbBZ1gYTLPngrSQQ%3D
>
>
> ###########################3
> Here is my Corresponding HTML Page
>
> <code>
>
>     <tr class="odd">
>
>     <td>a
> href="https://harvesttrial.s3.amazonaws.com/OUTROS_Learning_JQuery.pdf?AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231426644&Signature=5UaxwOhXsJ5d9bucyirBwL9wJ2M%3D 
> "
> target="_blank">OUTROS_Learning_JQuery.pdf </td>
>
>
>     <td>application/pdf</td>
>
>     <td></td>
>
>     <td>a
> href="https://harvesttrial.s3.amazonaws.com/OUTROS_Learning_JQuery.pdf?AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231426644&Signature=4lw7ovgAclmjj3FZNNfFVG4A6sA%3D 
> "
> target="_blank">Delete </td>
>
>
>     </tr>
>
> <code>
> ############################33
> If I try to Delete the Object by clicking the URL
>
> I get following message
> <Error>
> <Code>SignatureDoesNotMatch</Code>
> −
> <Message>
> The request signature we calculated does not match the signature you
> provided. Check your key and signing method.
> </Message>
> −
> <StringToSignBytes>
> 47 45 54 0a 0a 0a 31 32 33 31 34 32 37 39 33 32 0a 2f 68 61 72 76 65  
> 73 74
> 74 72 69 61 6c 2f 42 6f 6f 6b 4f 6e 47 69 74 2e 70 64 66
> </StringToSignBytes>
> <RequestId>B8039A6F3E90F2CA</RequestId>
> −
> <HostId>
> i4/pA/SDJIK3x8aWdeB17YEH0QPRzjJAHzowK5oWr0bSBw6BYmm+o6cpPj9i7Mjf
> </HostId>
> <SignatureProvided>VwsgUw2TbnDhwEkdIvsUux7kqVs=</SignatureProvided>
> <StringToSign>GET
>
>
> 1231427932
> /harvesttrial/BookOnGit.pdf</StringToSign>
> <AWSAccessKeyId>14M0Q3PZ3W9HHZZN6AR2</AWSAccessKeyId>
> </Error>
>
> #####################################33
> After 5mins, when the link expires, I do get the right expiry  
> message though
>
> Pls Help!!
>
> --
> View this message in context: http://www.nabble.com/Delete-URL-generated-does-not-work-tp21353795p21353795.html
> Sent from the JetS3t Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Delete URL generated does not work

by MarkAtHarvest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Now I realize, if the objects are deleted , its a big impact, so its better they go through jets3t S3Service on server side,  S3Service.deleteObject() method, that way we can ask for a confirmation and then go ahead.
Thank you for the guidance.


James Murty-3 wrote:
The signed Delete URLs will not work directly within web browsers,  
because you must send a DELETE HTTP request to S3 to delete an object  
instead of the standard GET request that a browser sends when it  
follows a link.

To used signed Delete URLs within a browser the way you want, you will  
need to use Javascript to create and send the DELETE request that S3  
requires. This could get tricky because you will need to create a  
request with exactly the same HTTP headers as the ones you signed.

While using S3 GET requests is very easy, the other request types are  
much harder.

Hope this helps,
James


On 09/01/2009, at 2:17 AM, MarkAtHarvest <mark@harvestinfotech.com>  
wrote:

>
> At first, I would like to thanks James for Jets3t Toolkit,
>
> I have generated Get URL and Delete URL from JetS3t objects, my Get  
> URL is
> working but my Del URL is not working
>
> Here is the code to generate the URLs
> Calendar cal = Calendar.instance;
>        cal.add(Calendar.MINUTE, 5);
>        Date expiryDate = cal.getTime();
>
> AznS3Object as3obj = new AznS3Object(bucket:it.bucketName,key:it.key)
> String getUrl = S3Service.createSignedGetUrl(it.bucketName,it.key,
> awsCredentials, expiryDate, false)
> String delUrl = S3Service.createSignedDeleteUrl(it.bucketName, it.key,
> awsCredentials, expiryDate, false)
> log.debug("DEBUG DELE URL is-> $delUrl")
>
> ############
> Here is my Debug Message
> 10:13:52.859 DEBUG DELE URL is->
> https://harvesttrial.s3.amazonaws.com/OUTROS_L
> earning_JQuery.pdf?
> AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231427932&Signat
> ure=w42joM9BZpugbBZ1gYTLPngrSQQ%3D
>
>
> ###########################3
> Here is my Corresponding HTML Page
>
> <code>
>
>     <tr class="odd">
>
>     <td>a
> href="https://harvesttrial.s3.amazonaws.com/OUTROS_Learning_JQuery.pdf?AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231426644&Signature=5UaxwOhXsJ5d9bucyirBwL9wJ2M%3D 
> "
> target="_blank">OUTROS_Learning_JQuery.pdf </td>
>
>
>     <td>application/pdf</td>
>
>     <td></td>
>
>     <td>a
> href="https://harvesttrial.s3.amazonaws.com/OUTROS_Learning_JQuery.pdf?AWSAccessKeyId=14M0Q3PZ3W9HHZZN6AR2&Expires=1231426644&Signature=4lw7ovgAclmjj3FZNNfFVG4A6sA%3D 
> "
> target="_blank">Delete </td>
>
>
>     </tr>
>
> <code>
> ############################33
> If I try to Delete the Object by clicking the URL
>
> I get following message
> <Error>
> <Code>SignatureDoesNotMatch</Code>
> −
> <Message>
> The request signature we calculated does not match the signature you
> provided. Check your key and signing method.
> </Message>
> −
> <StringToSignBytes>
> 47 45 54 0a 0a 0a 31 32 33 31 34 32 37 39 33 32 0a 2f 68 61 72 76 65  
> 73 74
> 74 72 69 61 6c 2f 42 6f 6f 6b 4f 6e 47 69 74 2e 70 64 66
> </StringToSignBytes>
> <RequestId>B8039A6F3E90F2CA</RequestId>
> −
> <HostId>
> i4/pA/SDJIK3x8aWdeB17YEH0QPRzjJAHzowK5oWr0bSBw6BYmm+o6cpPj9i7Mjf
> </HostId>
> <SignatureProvided>VwsgUw2TbnDhwEkdIvsUux7kqVs=</SignatureProvided>
> <StringToSign>GET
>
>
> 1231427932
> /harvesttrial/BookOnGit.pdf</StringToSign>
> <AWSAccessKeyId>14M0Q3PZ3W9HHZZN6AR2</AWSAccessKeyId>
> </Error>
>
> #####################################33
> After 5mins, when the link expires, I do get the right expiry  
> message though
>
> Pls Help!!
>
> --
> View this message in context: http://www.nabble.com/Delete-URL-generated-does-not-work-tp21353795p21353795.html
> Sent from the JetS3t Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@jets3t.dev.java.net
> For additional commands, e-mail: users-help@jets3t.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@jets3t.dev.java.net
For additional commands, e-mail: users-help@jets3t.dev.java.net