当前位置: 首页>>代码示例>>Java>>正文


Java WebScriptRequest.getContent方法代码示例

本文整理汇总了Java中org.springframework.extensions.webscripts.WebScriptRequest.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java WebScriptRequest.getContent方法的具体用法?Java WebScriptRequest.getContent怎么用?Java WebScriptRequest.getContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.extensions.webscripts.WebScriptRequest的用法示例。


在下文中一共展示了WebScriptRequest.getContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildModel

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
private Map<String, Object> buildModel(WebScriptRequest req) throws JSONException, IOException
{
    Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);

    Content content = req.getContent();
    if(content == null)
    {
        throw new WebScriptException("Failed to convert request to String");
    }
    JSONObject o = new JSONObject(content.getContent());
    JSONArray jsonModels = o.getJSONArray("models");
    Map<QName, Long> models = new HashMap<QName, Long>(jsonModels.length());
    for(int i = 0; i < jsonModels.length(); i++)
    {
        JSONObject jsonModel = jsonModels.getJSONObject(i);
        models.put(QName.createQName(jsonModel.getString("name")), jsonModel.getLong("checksum"));
    }

    List<AlfrescoModelDiff> diffs = solrTrackingComponent.getModelDiffs(models);
    model.put("diffs", diffs);

    if (logger.isDebugEnabled())
    {
        logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
    }
    
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:29,代码来源:AlfrescoModelsDiff.java

示例2: getContent

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
public static String getContent(WebScriptRequest request) throws IOException
{
    Content content = request.getContent();
    return content.getContent();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:6,代码来源:WebScriptUtil.java

示例3: buildModel

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
private Map<String, Object> buildModel(WebScriptRequest req) throws JSONException, IOException
{
    List<Long> aclChangeSetIds = null;
    
    Content content = req.getContent();
    if (content == null)
    {
        throw new WebScriptException("Request content is empty");
    }
    JSONObject o = new JSONObject(content.getContent());
    JSONArray aclChangeSetIdsJSON = o.has("aclChangeSetIds") ? o.getJSONArray("aclChangeSetIds") : null;
    if (aclChangeSetIdsJSON == null)
    {
        throw new WebScriptException(
                Status.STATUS_BAD_REQUEST,
                "Parameter 'aclChangeSetIds' not provided in request content.");
    }
    else if (aclChangeSetIdsJSON.length() == 0)
    {
        throw new WebScriptException(
                Status.STATUS_BAD_REQUEST,
                "Parameter 'aclChangeSetIds' must hold from 1 or more IDs.");
    }
    aclChangeSetIds = new ArrayList<Long>(aclChangeSetIdsJSON.length());
    for (int i = 0; i < aclChangeSetIdsJSON.length(); i++)
    {
        aclChangeSetIds.add(aclChangeSetIdsJSON.getLong(i));
    }

    String fromIdParam = req.getParameter("fromId");
    String maxResultsParam = req.getParameter("maxResults");

    Long fromId = (fromIdParam == null ? null : Long.valueOf(fromIdParam));
    int maxResults = (maxResultsParam == null ? 1024 : Integer.valueOf(maxResultsParam));
    
    // Request according to the paging query style required
    List<Acl> acls = solrTrackingComponent.getAcls(aclChangeSetIds, fromId, maxResults);
    
    Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);
    model.put("acls", acls);

    if (logger.isDebugEnabled())
    {
        logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
    }
    
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:49,代码来源:AclsGet.java

示例4: buildModel

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
private Map<String, Object> buildModel(WebScriptRequest req) throws JSONException, IOException
{
    List<Long> aclIds = null;
    
    Content content = req.getContent();
    if (content == null)
    {
        throw new WebScriptException("Request content is empty");
    }
    JSONObject o = new JSONObject(content.getContent());
    JSONArray aclIdsJSON = o.has("aclIds") ? o.getJSONArray("aclIds") : null;
    if (aclIdsJSON == null)
    {
        throw new WebScriptException(
                Status.STATUS_BAD_REQUEST,
                "Parameter 'aclIds' not provided in request content.");
    }
    else if (aclIdsJSON.length() == 0)
    {
        throw new WebScriptException(
                Status.STATUS_BAD_REQUEST,
                "Parameter 'aclIds' must hold from 1 or more IDs.");
    }
    aclIds = new ArrayList<Long>(aclIdsJSON.length());
    for (int i = 0; i < aclIdsJSON.length(); i++)
    {
        aclIds.add(aclIdsJSON.getLong(i));
    }

    // Request according to the paging query style required
    List<AclReaders> aclsReaders = solrTrackingComponent.getAclsReaders(aclIds);
    
    Map<String, Object> model = new HashMap<String, Object>(1, 1.0f);
    model.put("aclsReaders", aclsReaders);

    if (logger.isDebugEnabled())
    {
        logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
    }
    
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:43,代码来源:AclsReadersGet.java


注:本文中的org.springframework.extensions.webscripts.WebScriptRequest.getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。