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


Java WebScriptRequest.getParameter方法代码示例

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


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

示例1: getState

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * Gets the specified {@link WorkflowState}, null if not requested.
 * 
 * @param req The WebScript request
 * @return The workflow state or null if not requested
 */
private WorkflowState getState(WebScriptRequest req)
{
    String stateName = req.getParameter(PARAM_STATE);
    if (stateName != null)
    {
        try
        {
            return WorkflowState.valueOf(stateName.toUpperCase());
        }
        catch (IllegalArgumentException e)
        {
            String msg = "Unrecognised State parameter: " + stateName;
            throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, msg);
        }
    }
    
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:WorkflowInstancesGet.java

示例2: handle

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
private void handle(WebScriptRequest req, WebScriptResponse res) throws JSONException, IOException
{
    // create map of template vars
    String modelQName = req.getParameter("modelQName");
    if(modelQName == null)
    {
        throw new WebScriptException(
                Status.STATUS_BAD_REQUEST,
                "URL parameter 'modelQName' not provided.");
    }

    ModelDefinition.XMLBindingType bindingType = ModelDefinition.XMLBindingType.DEFAULT;
    AlfrescoModel model = solrTrackingComponent.getModel(QName.createQName(modelQName));
    res.setHeader("XAlfresco-modelChecksum", String.valueOf(model.getModelDef().getChecksum(bindingType)));
    model.getModelDef().toXML(bindingType, res.getOutputStream());
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:AlfrescoModelGet.java

示例3: getIntParameter

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * Retrieves the named parameter as an integer, if the parameter is not present the default value is returned
 * 
 * @param req The WebScript request
 * @param paramName The name of parameter to look for
 * @param defaultValue The default value that should be returned if parameter is not present in request or if it is not positive
 * @return The request parameter or default value
 */
protected int getIntParameter(WebScriptRequest req, String paramName, int defaultValue)
{
    String paramString = req.getParameter(paramName);
    
    if (paramString != null)
    {
        try
        {
            int param = Integer.valueOf(paramString);
            
            if (param >= 0)
            {
                return param;
            }
        }
        catch (NumberFormatException e) 
        {
            throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
        }
    }
    
    return defaultValue;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:32,代码来源:AbstractArchivedNodeWebScript.java

示例4: executeImpl

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
    String urlType = req.getParameter("type");
    if (urlType == null || urlType.length() == 0)
    {
        urlType = URL_ARG_DESCRIPTION;
    }
    else if (!urlType.equals(URL_ARG_DESCRIPTION) && !urlType.equals(URL_ARG_TEMPLATE) && !urlType.equals(URL_ARG_ALL))
    {
        urlType = URL_ARG_DESCRIPTION;
    }
            
    //
    // retrieve open search engines configuration
    //

    Set<UrlTemplate> urls = getUrls(urlType);
    Map<String, Object> model = new HashMap<String, Object>(7, 1.0f);
    model.put("urltype", urlType);
    model.put("engines", urls);
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:SearchEngines.java

示例5: buildPagingRequest

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * Builds up a listing Paging request, based on the arguments specified in the URL
 *  
 * @param req WebScriptRequest
 * @return PagingRequest
 */
@Override
protected PagingRequest buildPagingRequest(WebScriptRequest req)
{
   // Grab the number of topics to return
   String pResultSize = req.getParameter("resultSize");
   int resultSize = DEFAULT_MAX_RESULTS;
   if (pResultSize != null)
   {
      try
      {
         resultSize = Integer.parseInt(pResultSize);
      }
      catch (NumberFormatException e)
      {
         //do nothing. ResultSize has already been preset to the default value.
      }  
   }
   return new ScriptPagingDetails(req, resultSize);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:ForumTopicsFilteredGet.java

示例6: executeImpl

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
    // extract username and password
    String username = req.getParameter("u");
    if (username == null || username.length() == 0)
    {
        throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Username not specified");
    }
    String password = req.getParameter("pw");
    if (password == null)
    {
        throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Password not specified");
    }

    try
    {
        return login(username, password);
    }
    catch(WebScriptException e)
    {
        status.setCode(e.getStatus());
        status.setMessage(e.getMessage());
        status.setRedirect(true);
        return null;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:27,代码来源:Login.java

示例7: processDateFilter

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * Processes the given date filter parameter from the provided webscript request.
 * 
 * If the parameter is present but set to an empty string or to "null" the
 * date is added to the given filters Map as "", if the parameter
 * contains an ISO8601 date it's added as a Date object to the filters.
 * 
 * @param req The WebScript request
 * @param paramName The name of the parameter to look for
 * @param filters Map of filters to add the date to
 */
protected void processDateFilter(WebScriptRequest req, String paramName, Map<String, Object> filters)
{
    // TODO: support other keywords i.e. today, tomorrow
    
    String dateParam = req.getParameter(paramName);
    if (dateParam != null)
    {
        Object date = EMPTY;
        
        if (!EMPTY.equals(dateParam) && !NULL.equals(dateParam))
        {
            date = getDateParameter(req, paramName);
        }
        
        filters.put(paramName, date);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:29,代码来源:AbstractWorkflowWebscript.java

示例8: acquireLongParameter

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
private long acquireLongParameter(WebScriptRequest req, String parameterName) {
	String parameter = req.getParameter(parameterName);
	Long result;
	
	try {
		result = Long.parseLong(parameter);
	} catch (Exception e) {
		LOGGER.debug("Failed to acquire parameter: " + parameterName);
		result = Long.parseLong(depth);
	}
	
	return result;
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:14,代码来源:MonitorAclHierarchyWebscript.java

示例9: getSiteInfo

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * returns SiteInfo needed for post activity
 * @param req
 * @return
 */
protected SiteInfo getSiteInfo(WebScriptRequest req, boolean searchForSiteInJSON)
{
    String siteName = req.getParameter(JSON_KEY_SITE);

    if (siteName == null && searchForSiteInJSON )
    {
        JSONObject json = parseJSON(req);
        if (json != null){
            if (json.containsKey(JSON_KEY_SITE))
            {
                siteName = (String) json.get(JSON_KEY_SITE);
            }
            else if (json.containsKey(JSON_KEY_SITE_ID))
            {
                siteName = (String) json.get(JSON_KEY_SITE_ID);
            }
        }
    }
    if (siteName != null)
    {
        SiteInfo site = siteService.getSite(siteName);
        return site;
    }

    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:32,代码来源:AbstractCommentsWebScript.java

示例10: getRecognizedParams

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * Finds the formal set of params that any rest service could potentially have passed in as request params
 *
 * @param req WebScriptRequest
 * @return RecognizedParams a POJO containing the params for use with the Params objects
 */
default Params.RecognizedParams getRecognizedParams(WebScriptRequest req)
{
    Paging paging = findPaging(req);
    List<SortColumn> sorting = getSort(req.getParameter(PARAM_ORDERBY));
    Map<String, BeanPropertiesFilter> relationFilter = getRelationFilter(req.getParameter(PARAM_RELATIONS));
    Query whereQuery = getWhereClause(req.getParameter(PARAM_WHERE));
    Map<String, String[]> requestParams = getRequestParameters(req);
    boolean includeSource = Boolean.valueOf(req.getParameter(PARAM_INCLUDE_SOURCE_ENTITY));

    List<String> includedFields = getIncludeClause(req.getParameter(PARAM_INCLUDE));
    List<String> selectFields = getSelectClause(req.getParameter(PARAM_SELECT));

    String fields = req.getParameter(PARAM_FILTER_FIELDS);
    String properties = req.getParameter(PARAM_FILTER_PROPERTIES);

    if ((fields != null) && (properties != null))
    {
        if (rpeLogger().isWarnEnabled())
        {
            rpeLogger().warn("Taking 'fields' param [" + fields + "] and ignoring deprecated 'properties' param [" + properties + "]");
        }
    }

    BeanPropertiesFilter filter = getFilter((fields != null ? fields : properties), includedFields);

    return new Params.RecognizedParams(requestParams, paging, filter, relationFilter, includedFields, selectFields, whereQuery, sorting,
                includeSource);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:35,代码来源:RecognizedParamsExtractor.java

示例11: executeImpl

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
@Override
protected Map<String, Object> executeImpl(final WebScriptRequest req, final Status status)
{
    String tenantDomain = TenantService.DEFAULT_DOMAIN;
    final String inviteeUserName = req.getParameter(PARAM_INVITEE_USER_NAME);
    
    if (tenantService.isEnabled())
    {
        if (inviteeUserName != null)
        {
            tenantDomain = tenantService.getUserDomain(inviteeUserName);
        }
    }
    
    // run as system user
    return TenantUtil.runAsSystemTenant(new TenantRunAsWork<Map<String, Object>>()
    {
        public Map<String, Object> doWork() throws Exception
        {
            String oldUser = null;
            try
            {
                if (inviteeUserName != null && !inviteeUserName.equals(oldUser))
                {
                    oldUser = AuthenticationUtil.getFullyAuthenticatedUser();
                    AuthenticationUtil.setFullyAuthenticatedUser(inviteeUserName);
                }
                return execute(req, status);
            }
            finally
            {
                if (oldUser != null && !oldUser.equals(inviteeUserName))
                {
                    AuthenticationUtil.setFullyAuthenticatedUser(oldUser);
                }
            }
        }
    }, tenantDomain);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:40,代码来源:InviteResponse.java

示例12: addActivityEntry

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * Generates an activity entry for the link
 */
protected void addActivityEntry(String event, LinkInfo link, SiteInfo site, 
      WebScriptRequest req, JSONObject json)
{
   // What page is this for?
   String page = req.getParameter("page");
   if (page == null && json != null)
   {
      if (json.containsKey("page"))
      {
         page = (String)json.get("page");
      }
   }
   if (page == null)
   {
      // Default
      page = "links";
   }
   
   try
   {
      StringWriter activityJson = new StringWriter();
      JSONWriter activity = new JSONWriter(activityJson);
      activity.startObject();
      activity.writeValue("title", link.getTitle());
      activity.writeValue("page", page + "?linkId=" + link.getSystemName());
      activity.endObject();
      
      activityService.postActivity(
            "org.alfresco.links.link-" + event,
            site.getShortName(),
            LINKS_SERVICE_ACTIVITY_APP_NAME,
            activityJson.toString());
   }
   catch (Exception e)
   {
      // Warn, but carry on
      logger.warn("Error adding link " + event + " to activities feed", e);
   }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:43,代码来源:AbstractLinksWebScript.java

示例13: executeImpl

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
    Map<String, Object> model = new HashMap<String, Object>();

    // get request parameters
    NodeRef nodeRef = parseRequestForNodeRef(req);
    String ruleType = req.getParameter("ruleType");

    RuleType type = ruleService.getRuleType(ruleType);

    if (type == null)
    {
        ruleType = null;
    }

    // get all rules (including inherited) filtered by rule type
    List<Rule> inheritedRules = ruleService.getRules(nodeRef, true, ruleType);

    // get owned rules (excluding inherited) filtered by rule type
    List<Rule> ownedRules = ruleService.getRules(nodeRef, false, ruleType);

    // remove owned rules
    inheritedRules.removeAll(ownedRules);

    List<RuleRef> inheritedRuleRefs = new ArrayList<RuleRef>();

    for (Rule rule : inheritedRules)
    {
        inheritedRuleRefs.add(new RuleRef(rule, fileFolderService.getFileInfo(ruleService.getOwningNodeRef(rule))));
    }

    model.put("inheritedRuleRefs", inheritedRuleRefs);

    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:37,代码来源:InheritedRulesGet.java

示例14: buildPagingRequest

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * Builds up a listing Paging request, based on the arguments
 *  specified in the URL
 */
protected PagingRequest buildPagingRequest(WebScriptRequest req)
{
   if (req.getParameter("page") == null || req.getParameter("pageSize") == null)
   {
      throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Paging size parameters missing");
   }
   return new ScriptPagingDetails(req, 100);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:13,代码来源:AbstractLinksWebScript.java

示例15: findPaging

import org.springframework.extensions.webscripts.WebScriptRequest; //导入方法依赖的package包/类
/**
 * Find paging setings based on the request parameters.
 *
 * @param req
 * @return Paging
 */
default Paging findPaging(WebScriptRequest req)
{
    String skip = req.getParameter(PARAM_PAGING_SKIP);
    String maxItems = req.getParameter(PARAM_PAGING_MAX);

    return getPaging(skip,maxItems);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:14,代码来源:RecognizedParamsExtractor.java


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