当前位置: 首页>>代码示例>>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;未经允许,请勿转载。