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


Java Response.getResponse方法代码示例

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


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

示例1: generateFormModel

import org.springframework.extensions.webscripts.connector.Response; //导入方法依赖的package包/类
/**
 * Generates the "form" model passed to the FreeMarker engine.
 * 
 * @param request The WebScriptRequest
 * @param mode The mode of the form
 * @param formSvcResponse Response representing the form definition
 * @param formConfig The form configuration
 * @return Map representing the "form" model
 */
protected Map<String, Object> generateFormModel(WebScriptRequest request, Mode mode, 
            Response formSvcResponse, FormConfigElement formConfig)
{
    try
    {
        String jsonResponse = formSvcResponse.getResponse();
        
        if (logger.isDebugEnabled())
            logger.debug("form definition JSON = \n" + jsonResponse);
            
        // create JSON representation of form defintion from response
        JSONObject formDefinition = new JSONObject(new JSONTokener(jsonResponse));
    
        // create model to return
        Map<String, Object> model = new HashMap<String, Object>(1);
        model.put(MODEL_FORM, generateFormUIModel(new ModelContext(request, mode, formDefinition, formConfig)));
        return model;
    }
    catch (JSONException je)
    {
        if (logger.isErrorEnabled())
            logger.error(je);
        
        return null;
    }
}
 
开发者ID:ecm4u,项目名称:ecm4u-alfresco-bugpatches,代码行数:36,代码来源:FormUIGet.java

示例2: generateErrorModel

import org.springframework.extensions.webscripts.connector.Response; //导入方法依赖的package包/类
/**
* Generates the "error" model used when an error occurs.
*
* @param errorResponse Response object representing the error
* @param errorKey String
* @return The "error" model
*/
protected Map<String, Object> generateErrorModel(Response errorResponse, String errorKey)
{
    String error = "";
    
    // retrieve and log the error
    try
    {
        JSONObject json = new JSONObject(new JSONTokener(errorResponse.getResponse()));
        if (json.has(MODEL_MESSAGE))
        {
            error = json.getString(MODEL_MESSAGE);
            
            // Common AccessDeniedException is reported as a 500 server error from the repository
            if ((error.indexOf("org.alfresco.repo.security.permissions.AccessDeniedException") == -1) &&
                    (errorKey == null || errorKey.isEmpty()))
            {
               if (logger.isErrorEnabled())
                   logger.error(error);
            }
        }
    }
    catch (JSONException je)
    {
        error= "";
    }
    
    if (errorKey == null || errorKey.isEmpty())
    {
        errorKey = MSG_DEFAULT_FORM_ERROR;
    }
    String id = errorKey + "." + errorResponse.getStatus().getCode();
    error = retrieveMessage(id);
    if (error.equals(id))
    {
        // use key if key+"."+status is not found
        error = retrieveMessage(errorKey);
    }

    // create model with error
    Map<String, Object> model = new HashMap<String, Object>(1);
    model.put(MODEL_ERROR, error);
    return model;
}
 
开发者ID:ecm4u,项目名称:ecm4u-alfresco-bugpatches,代码行数:51,代码来源:FormUIGet.java

示例3: getProbeSettings

import org.springframework.extensions.webscripts.connector.Response; //导入方法依赖的package包/类
@Override
protected Settings getProbeSettings(final WebScriptRequest req) {
  try {
    Pair<String, String> parseRequestedTransformation = parseRequestedTransformation(req);
    final RequestContext requestContext = ThreadLocalRequestContext.getRequestContext();

    final ConnectorService connService = requestContext.getServiceRegistry().getConnectorService();

    final String currentUserId = requestContext.getUserId();

    final HttpSession currentSession = ServletUtil.getSession(true);

    final Connector connector = connService.getConnector(ENDPOINT_ID, currentUserId, currentSession);

    final String alfrescoURL = "/org/redpill/alfresco/clusterprobe/probe/transform/" + parseRequestedTransformation.getFirst() + "/" + parseRequestedTransformation.getSecond();

    final Response response = connector.call(alfrescoURL);

    return new Settings(response.getResponse(), response.getStatus().getCode());
  } catch (final Exception ex) {
    LOG.error(ex.getMessage(), ex);
    final StringBuilder sb = new StringBuilder();

    StackTraceUtil.buildStackTrace(ex.getMessage(), ex.getStackTrace(), sb, 0);

    return new Settings("Couldn't get settings from repo server.\n" + sb.toString(), 500);
  }
}
 
开发者ID:Redpill-Linpro,项目名称:alfresco-cluster-probe,代码行数:29,代码来源:ProbeTransform.java

示例4: getProbeSettings

import org.springframework.extensions.webscripts.connector.Response; //导入方法依赖的package包/类
@Override
protected Settings getProbeSettings(final WebScriptRequest req) {
  try {

    final RequestContext requestContext = ThreadLocalRequestContext.getRequestContext();

    final ConnectorService connService = requestContext.getServiceRegistry().getConnectorService();

    final String currentUserId = requestContext.getUserId();

    final HttpSession currentSession = ServletUtil.getSession(true);

    final Connector connector = connService.getConnector(ENDPOINT_ID, currentUserId, currentSession);

    final String alfrescoURL = "/org/redpill/alfresco/clusterprobe/probe/search";

    final Response response = connector.call(alfrescoURL);

    return new Settings(response.getResponse(), response.getStatus().getCode());
  } catch (final Exception ex) {
    LOG.error(ex.getMessage(), ex);
    final StringBuilder sb = new StringBuilder();

    StackTraceUtil.buildStackTrace(ex.getMessage(), ex.getStackTrace(), sb, 0);

    return new Settings("Couldn't get settings from repo server.\n" + sb.toString(), 500);
  }
}
 
开发者ID:Redpill-Linpro,项目名称:alfresco-cluster-probe,代码行数:29,代码来源:ProbeSearch.java

示例5: getProbeSettings

import org.springframework.extensions.webscripts.connector.Response; //导入方法依赖的package包/类
@Override
protected Settings getProbeSettings(final WebScriptRequest req) {
  try {
    final String server = getServer();

    final RequestContext requestContext = ThreadLocalRequestContext.getRequestContext();

    final ConnectorService connService = requestContext.getServiceRegistry().getConnectorService();

    final String currentUserId = requestContext.getUserId();

    final HttpSession currentSession = ServletUtil.getSession(true);

    final Connector connector = connService.getConnector(ENDPOINT_ID, currentUserId, currentSession);

    final String alfrescoURL = "/org/redpill/alfresco/clusterprobe/settings?server=" + server;

    final Response response = connector.call(alfrescoURL);

    final String jsonResponse = response.getResponse();

    final JSONObject json = new JSONObject(new JSONTokener(jsonResponse));

    return new Settings(json.getString("text"), json.getInt("code"));
  } catch (final Exception ex) {
    LOG.error(ex.getMessage(), ex);
    final StringBuilder sb = new StringBuilder();

    StackTraceUtil.buildStackTrace(ex.getMessage(), ex.getStackTrace(), sb, 0);

    return new Settings("Couldn't get settings from repo server.\n" + sb.toString(), 500);
  }
}
 
开发者ID:Redpill-Linpro,项目名称:alfresco-cluster-probe,代码行数:34,代码来源:ProbeGet.java

示例6: getProbeSettings

import org.springframework.extensions.webscripts.connector.Response; //导入方法依赖的package包/类
@Override
protected Settings getProbeSettings(final WebScriptRequest req) {
  try {

    final RequestContext requestContext = ThreadLocalRequestContext.getRequestContext();

    final ConnectorService connService = requestContext.getServiceRegistry().getConnectorService();

    final String currentUserId = requestContext.getUserId();

    final HttpSession currentSession = ServletUtil.getSession(true);

    final Connector connector = connService.getConnector(ENDPOINT_ID, currentUserId, currentSession);

    final String alfrescoURL = "/org/redpill/alfresco/clusterprobe/probe";

    final Response response = connector.call(alfrescoURL);

    return new Settings(response.getResponse(), response.getStatus().getCode());
  } catch (final Exception ex) {
    LOG.error(ex.getMessage(), ex);
    final StringBuilder sb = new StringBuilder();

    StackTraceUtil.buildStackTrace(ex.getMessage(), ex.getStackTrace(), sb, 0);

    return new Settings("Couldn't get settings from repo server.\n" + sb.toString(), 500);
  }
}
 
开发者ID:Redpill-Linpro,项目名称:alfresco-cluster-probe,代码行数:29,代码来源:ProbeRepoGet.java


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