forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure#21 from WindowsAzure/dev
Dev
- Loading branch information
Showing
8 changed files
with
1,415 additions
and
1,074 deletions.
There are no files selected for viewing
1,000 changes: 1,000 additions & 0 deletions
1,000
.../java/com/microsoft/windowsazure/services/blob/implementation/BlobOperationRestProxy.java
Large diffs are not rendered by default.
Oops, something went wrong.
959 changes: 9 additions & 950 deletions
959
.../src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java
Large diffs are not rendered by default.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
...rc/main/java/com/microsoft/windowsazure/services/media/implementation/SASTokenFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* Copyright 2012 Microsoft Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.microsoft.windowsazure.services.media.implementation; | ||
|
||
import java.net.URISyntaxException; | ||
|
||
import javax.ws.rs.core.UriBuilder; | ||
|
||
import com.sun.jersey.api.client.ClientHandlerException; | ||
import com.sun.jersey.api.client.ClientRequest; | ||
import com.sun.jersey.api.client.ClientResponse; | ||
import com.sun.jersey.api.client.filter.ClientFilter; | ||
|
||
/** | ||
* Filter responsible for adding SAS tokens to outgoing requests. | ||
* | ||
*/ | ||
public class SASTokenFilter extends ClientFilter { | ||
private final String sasToken; | ||
|
||
/** | ||
* Construct a SASTokenFilter that will insert the tokens given | ||
* in the provided sasUrl. | ||
* | ||
* @param sasUrl | ||
* URL containing authentication information | ||
* @throws URISyntaxException | ||
*/ | ||
public SASTokenFilter(String sasToken) { | ||
this.sasToken = sasToken; | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see com.sun.jersey.api.client.filter.ClientFilter#handle(com.sun.jersey.api.client.ClientRequest) | ||
*/ | ||
@Override | ||
public ClientResponse handle(ClientRequest cr) throws ClientHandlerException { | ||
UriBuilder newUri = UriBuilder.fromUri(cr.getURI()); | ||
String currentQuery = cr.getURI().getRawQuery(); | ||
if (currentQuery == null) { | ||
currentQuery = ""; | ||
} | ||
else if (currentQuery.length() > 0) { | ||
currentQuery += "&"; | ||
} | ||
currentQuery += sasToken; | ||
|
||
newUri.replaceQuery(currentQuery); | ||
cr.setURI(newUri.build()); | ||
|
||
return getNext().handle(cr); | ||
} | ||
|
||
} |
38 changes: 0 additions & 38 deletions
38
.../com/microsoft/windowsazure/services/media/implementation/content/CreateAssetRequest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.