當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpMethod類代碼示例

本文整理匯總了Java中org.springframework.extensions.webscripts.connector.HttpMethod的典型用法代碼示例。如果您正苦於以下問題:Java HttpMethod類的具體用法?Java HttpMethod怎麽用?Java HttpMethod使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HttpMethod類屬於org.springframework.extensions.webscripts.connector包,在下文中一共展示了HttpMethod類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: remoteCall

import org.springframework.extensions.webscripts.connector.HttpMethod; //導入依賴的package包/類
private void remoteCall(HttpServletRequest request, JSONObject auditSample) throws JSONException, URIException,
        UnsupportedEncodingException {
    Connector connector;
    try {
        connector = FrameworkUtil.getConnector(request.getSession(true), auditSample.getString(AUDIT_USER_ID),
                AlfrescoUserFactory.ALFRESCO_ENDPOINT_ID);

        ConnectorContext postContext = new ConnectorContext(null, buildDefaultHeaders());
        postContext.setMethod(HttpMethod.POST);
        postContext.setContentType("text/plain;charset=UTF-8");
        InputStream in = new ByteArrayInputStream(auditSample.toString().getBytes("UTF-8"));

        // Webscript call
        connector.call("/share-stats/insert-audit", postContext, in);

    } catch (ConnectorServiceException e) {
        if (logger.isDebugEnabled()) {
            logger.debug(e.getMessage(), e);
        }
    }
}
 
開發者ID:atolcd,項目名稱:alfresco-audit-share,代碼行數:22,代碼來源:ProxyAuditFilter.java

示例2: remoteCall

import org.springframework.extensions.webscripts.connector.HttpMethod; //導入依賴的package包/類
private void remoteCall(HttpServletRequest request, JSONObject auditSample) throws JSONException, URIException,
        UnsupportedEncodingException {
    Connector connector;
    try {
        connector = FrameworkUtil.getConnector(request.getSession(true), auditSample.getString(AUDIT_USER_ID),
                AlfrescoUserFactory.ALFRESCO_ENDPOINT_ID);
        // if (parameters == null), we use the 'inputstream'
        // The webscript is called with the audit converted into JSON.
        ConnectorContext postContext = new ConnectorContext(null, buildDefaultHeaders());
        postContext.setMethod(HttpMethod.POST);
        postContext.setContentType("text/plain;charset=UTF-8");
        InputStream in = new ByteArrayInputStream(auditSample.toString().getBytes("UTF-8"));

        // Webscript call
        connector.call("/share-stats/insert-audit", postContext, in);
    } catch (ConnectorServiceException e) {
        if (logger.isDebugEnabled()) {
            logger.debug(e.getMessage(), e);
        }
    }
}
 
開發者ID:atolcd,項目名稱:alfresco-audit-share,代碼行數:22,代碼來源:AuditFilter.java

示例3: retrieveFormDefinition

import org.springframework.extensions.webscripts.connector.HttpMethod; //導入依賴的package包/類
/**
 * Retrieves the form definition from the repository FormService for the
 * given item.
 * 
 * @param itemKind The form item kind
 * @param itemId The form item id
 * @param visibleFields The list of field names to return or null
 *        to return all fields
 * @param formConfig The form configuration
 * @return Response object from the remote call
 */
protected Response retrieveFormDefinition(String itemKind, String itemId, 
            List<String> visibleFields, FormConfigElement formConfig)
{
    Response response = null;
    
    try
    {
        // setup the connection
        ConnectorService connService = FrameworkUtil.getConnectorService();
        RequestContext requestContext = ThreadLocalRequestContext.getRequestContext();
        String currentUserId = requestContext.getUserId();
        HttpSession currentSession = ServletUtil.getSession(true);
        Connector connector = connService.getConnector(ENDPOINT_ID, currentUserId, currentSession);
        ConnectorContext context = new ConnectorContext(HttpMethod.POST, null, buildDefaultHeaders());
        context.setContentType("application/json");
        
        // call the form service
        response = connector.call("/api/formdefinitions", context, generateFormDefPostBody(itemKind,
                    itemId, visibleFields, formConfig));
        
        if (logger.isDebugEnabled())
            logger.debug("Response status: " + response.getStatus().getCode());
    }
    catch (Exception e)
    {
        if (logger.isErrorEnabled())
            logger.error("Failed to get form definition: ", e);
    }
    
    return response;
}
 
開發者ID:ecm4u,項目名稱:ecm4u-alfresco-bugpatches,代碼行數:43,代碼來源:FormUIGet.java


注:本文中的org.springframework.extensions.webscripts.connector.HttpMethod類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。