本文整理匯總了Java中com.google.api.client.http.GenericUrl.appendRawPath方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericUrl.appendRawPath方法的具體用法?Java GenericUrl.appendRawPath怎麽用?Java GenericUrl.appendRawPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.api.client.http.GenericUrl
的用法示例。
在下文中一共展示了GenericUrl.appendRawPath方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createThumbnail
import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
/**
* Richiede ad Alfresco la creazione di una <i>thumbnail</i>.
* <p>
* Si tenga presente che in caso di creazione asincrona la <i>thumbnail</i> potrebbe non essere
* subito disponibile anche se il metodo ha restituito informazioni valide.
*
* @param pContentId
* L'id del contenuto.
* @param pThumbDefinition
* Il nome della <i>thumbnail</i> di cui si richiede la crezione.
* @param pAsync
* Se la crazione deve essere sincrona ({@code true} o asincrona ({@false}).
*
* @return La <i>thumbnail</i> richiesta o {@code null} se il tipo di <i>thumbnail</i> di cui si
* è richiesta la creazione non è valido per il contenuto specificato.
*
* @throws IOException
*/
public Thumbnail createThumbnail(String pContentId, String pThumbDefinition, boolean pAsync) throws IOException {
/*
* POST <base>/content{property}/thumbnails?as={async?}
*
* {
* "thumbnailName": <name>
* }
*/
GenericUrl lUrl = getContentUrl(pContentId);
lUrl.appendRawPath(URL_RELATIVE_THUMBNAILS);
lUrl.set("as", pAsync);
// Recupero delle definizioni valide
// Purtroppo Alfresco restituisce successo anche se viene richiesta la generazione di una
// thumbnail non possibile. Controllando preventivamente si può restituire null.
List<String> lThumbDefinitions = getThumbnailDefinitions(pContentId);
if (!lThumbDefinitions.contains(pThumbDefinition)) {
return null;
}
JsonHttpContent lContent = new JsonHttpContent(JSON_FACTORY, new Thumbnail(pThumbDefinition));
HttpHeaders lRequestHeaders = new HttpHeaders().setContentType("application/json");
HttpRequest lRequest =
mHttpRequestFactory.buildPostRequest(lUrl, lContent).setHeaders(lRequestHeaders);
HttpResponse lResponse = lRequest.execute();
Thumbnail lThumbnail = lResponse.parseAs(Thumbnail.class);
return lThumbnail;
}
示例2: getThumbnailDefinitions
import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
/**
* Recupera le definizioni di thumbnail valide per il contenuto.
*
* @param pContentId
* L'id del contenuto.
*
* @return La lista delle definizioni valide.
*
* @throws IOException
*/
public List<String> getThumbnailDefinitions(String pContentId) throws IOException {
/*
* GET <base>/content{property}/thumbnaildefinitions
*/
GenericUrl lUrl = getContentUrl(pContentId);
lUrl.appendRawPath(URL_RELATIVE_THUMBNAIL_DEFINITIONS);
HttpRequest lRequest = mHttpRequestFactory.buildGetRequest(lUrl);
TypeReference<List<String>> lType = new TypeReference<List<String>>() {};
@SuppressWarnings("unchecked")
List<String> lResponse = (List<String>) lRequest.execute().parseAs(lType.getType());
return lResponse;
}
示例3: download
import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
public void download(int projectID, int fileID) throws IOException {
GenericUrl projectURL = new GenericUrl("http://minecraft.curseforge.com/projects/" + projectID);
HttpRequest projectRequest = requestFactory.buildGetRequest(projectURL);
// This will redirect - the point of this is just to obtain the new URL!
HttpResponse projectResponse = projectRequest.execute();
projectResponse.disconnect();
GenericUrl newURL = projectResponse.getRequest().getUrl();
newURL.appendRawPath("/files/" + fileID + "/download");
try {
download(newURL);
} catch (HttpResponseException e) {
// TODO Return this, instead of only logging
log("FAILED to download "+ newURL + "; you should manually download another version of this mod from " + projectURL);
}
}
示例4: describe
import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
@Override
public SObjectDescriptor describe(SObjectMetadata metadata) {
String describeUrlText = metadata.urls().get("describe");
GenericUrl describeUrl = this.baseUrl.clone();
describeUrl.appendRawPath(describeUrlText);
return getAndParse(describeUrl, SObjectDescriptor.class);
}
示例5: pushTopics
import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
@Override
public List<PushTopic> pushTopics() {
GenericUrl pushTopicsUrl = this.versionBaseUrl.clone();
pushTopicsUrl.appendRawPath("/query/");
pushTopicsUrl.set("q", "SELECT Name, Query, ApiVersion, NotifyForOperationCreate, NotifyForOperationUpdate, NotifyForOperationUndelete, NotifyForOperationDelete, NotifyForFields from PushTopic");
PushTopicQueryResult queryResult = getAndParse(pushTopicsUrl, PushTopicQueryResult.class);
return queryResult.records();
}
示例6: getSignature
import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
public LinkedHashMap<String, String> getSignature(Map<String, String> options, RequestMethod requestMethod, String endpoint) {
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
OAuthParameters parameters = new OAuthParameters();
parameters.computeTimestamp();
parameters.computeNonce();
parameters.version = "1.0";
parameters.consumerKey = wooCommerce.getWc_key();
GenericUrl genericUrl = new GenericUrl();
genericUrl.setScheme(wooCommerce.isHttps() ? "https" : "http");
genericUrl.setHost(wooCommerce.getBaseUrl());
genericUrl.appendRawPath("/wc-api");
genericUrl.appendRawPath("/v3");
/*
* The endpoint to be called is specified next
* */
genericUrl.appendRawPath(endpoint);
for (Map.Entry<String, String> entry : options.entrySet())
{
System.out.println(entry.getKey() + "/" + entry.getValue());
genericUrl.appendRawPath("/"+entry.getValue());
}
OAuthHmacSigner oAuthHmacSigner = new OAuthHmacSigner();
oAuthHmacSigner.clientSharedSecret = wooCommerce.getWc_secret();
parameters.signer = oAuthHmacSigner;
parameters.signatureMethod = wooCommerce.getSigning_method().getVal();
try {
parameters.computeSignature(requestMethod.getVal(), genericUrl);
} catch (GeneralSecurityException e) {
e.printStackTrace();
}
map.put("oauth_consumer_key", parameters.consumerKey);
map.put("oauth_signature_method", parameters.signatureMethod);
map.put("oauth_timestamp", parameters.timestamp);
map.put("oauth_nonce", parameters.nonce);
map.put("oauth_version", parameters.version);
map.put("oauth_signature", parameters.signature);
genericUrl.put("oauth_consumer_key", parameters.consumerKey);
genericUrl.put("oauth_signature_method", parameters.signatureMethod);
genericUrl.put("oauth_timestamp", parameters.timestamp);
genericUrl.put("oauth_nonce", parameters.nonce);
genericUrl.put("oauth_version", parameters.version);
genericUrl.put("oauth_signature", parameters.signature);
Log.i(TAG,genericUrl.build());
return map;
}
示例7: getThumbnail
import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
/**
* Recupera la <i>thumbnail</i> del contenuto.
* <p>
* Il chiamante dovrebbe invocare {@link InputStream#close} una volta che lo {@link InputStream}
* resituito non è più necessario. Esempio d'uso:
*
* <pre>
* InputStream is = nodeService.getThumbnail(lContentId, lThumbDefinition, true);
* try {
* // Utilizzo dello stream
* } finally {
* is.close();
* }
* </pre>
*
* @param pContentId
* L'id del contenuto.
* @param pThumbDefinition
* Il nome della <i>thumbnail</i> desiderata.
* @param pForceCreate
* Se {@code true}, viene richiesta la crazione (sincrona) della <i>thumbnail</i> nel
* caso questa non esista.
*
* @return Lo {@link InputStream} della <i>thumbnail</i> richiesta o {@code null} se questa non
* esiste.
*
* @throws IOException
*/
public InputStream getThumbnail(String pContentId, String pThumbDefinition, boolean pForceCreate)
throws IOException {
/*
* GET <base>/content{property}/thumbnails/{thumbnailname}?c={queueforcecreate?}&ph={placeholder?}&lastModified={modified?}
* [placeholder e lastModified non gestiti; creazione queued non gestita]
*/
GenericUrl lUrl = getContentUrl(pContentId);
lUrl.appendRawPath(URL_RELATIVE_THUMBNAILS);
lUrl.getPathParts().add(pThumbDefinition);
if (pForceCreate) {
lUrl.set("c", Thumbnail.FORCE_CREATE);
}
HttpRequest lRequest = mHttpRequestFactory.buildGetRequest(lUrl);
HttpResponse lResponse;
try {
lResponse = lRequest.execute();
} catch (HttpResponseException e) {
// TODO (Alessio) logging e gestione più fine degli errori
return null;
}
InputStream lThumbnailStream = lResponse.getContent();
return lThumbnailStream;
}
示例8: objects
import com.google.api.client.http.GenericUrl; //導入方法依賴的package包/類
@Override
public SObjectsResponse objects() {
GenericUrl objectsUrl = this.versionBaseUrl.clone();
objectsUrl.appendRawPath("/sobjects/");
SObjectsResponse response = getAndParse(objectsUrl, SObjectsResponse.class);
return response;
}