本文整理汇总了Java中org.springframework.extensions.webscripts.WebScriptRequest类的典型用法代码示例。如果您正苦于以下问题:Java WebScriptRequest类的具体用法?Java WebScriptRequest怎么用?Java WebScriptRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebScriptRequest类属于org.springframework.extensions.webscripts包,在下文中一共展示了WebScriptRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String name = templateVars.get("name");
// get specified parameter constraint
ParameterConstraint parameterConstraint = actionService.getParameterConstraint(name);
if (parameterConstraint == null)
{
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find parameter constraint with name: " + name);
}
model.put("actionConstraint", parameterConstraint);
return model;
}
示例2: parseRequestForNodeRef
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
/**
* Parses the request and providing it's valid returns the NodeRef.
*
* @param req The webscript request
* @return The NodeRef passed in the request
*
*/
protected NodeRef parseRequestForNodeRef(WebScriptRequest req)
{
// get the parameters that represent the NodeRef, we know they are present
// otherwise this webscript would not have matched
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String storeType = templateVars.get("store_type");
String storeId = templateVars.get("store_id");
String nodeId = templateVars.get("id");
// create the NodeRef and ensure it is valid
StoreRef storeRef = new StoreRef(storeType, storeId);
NodeRef nodeRef = new NodeRef(storeRef, nodeId);
if (!this.nodeService.exists(nodeRef))
{
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: " + nodeRef.toString());
}
return nodeRef;
}
示例3: executeImpl
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
protected void executeImpl(NodeRef nodeRef, Map<String, String> templateVars, WebScriptRequest req, WebScriptResponse res, Map<String, Object> model) throws IOException
{
// render content
QName propertyQName = ContentModel.PROP_CONTENT;
String contentPart = templateVars.get("property");
if (contentPart.length() > 0 && contentPart.charAt(0) == ';')
{
if (contentPart.length() < 2)
{
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Content property malformed");
}
String propertyName = contentPart.substring(1);
if (propertyName.length() > 0)
{
propertyQName = QName.createQName(propertyName, namespaceService);
}
}
// determine attachment
boolean attach = Boolean.valueOf(req.getParameter("a"));
// Stream the content
streamContentLocal(req, res, nodeRef, attach, propertyQName, model);
}
示例4: 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>();
NodeRef nodeRef = parseRequestForNodeRef(req);
String ratingSchemeName = parseRequestForScheme(req);
Rating deletedRating = ratingService.removeRatingByCurrentUser(nodeRef, ratingSchemeName);
if (deletedRating == null)
{
// There was no rating in the specified scheme to delete.
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Unable to delete non-existent rating: "
+ ratingSchemeName + " from " + nodeRef.toString());
}
model.put(NODE_REF, nodeRef.toString());
model.put(AVERAGE_RATING, ratingService.getAverageRating(nodeRef, ratingSchemeName));
model.put(RATINGS_TOTAL, ratingService.getTotalRating(nodeRef, ratingSchemeName));
model.put(RATINGS_COUNT, ratingService.getRatingsCount(nodeRef, ratingSchemeName));
return model;
}
示例5: buildModel
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(WorkflowModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache)
{
Map<String, String> params = req.getServiceMatch().getTemplateVars();
// Get the definition id from the params
String workflowDefinitionId = params.get(PARAM_WORKFLOW_DEFINITION_ID);
WorkflowDefinition workflowDefinition = workflowService.getDefinitionById(workflowDefinitionId);
// Workflow definition is not found, 404
if (workflowDefinition == null)
{
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND,
"Unable to find workflow definition with id: " + workflowDefinitionId);
}
Map<String, Object> model = new HashMap<String, Object>();
model.put("workflowDefinition", modelBuilder.buildDetailed(workflowDefinition));
return model;
}
示例6: 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());
}
示例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);
}
}
示例8: buildModel
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(
RunningActionModelBuilder modelBuilder, WebScriptRequest req,
Status status, Cache cache) {
List<ExecutionSummary> actions = null;
// Do they want all actions, or only certain ones?
String type = req.getParameter("type");
String nodeRef = req.getParameter("nodeRef");
if(type != null) {
actions = actionTrackingService.getExecutingActions(type);
} else if(nodeRef != null) {
NodeRef actionNodeRef = new NodeRef(nodeRef);
Action action = runtimeActionService.createAction(actionNodeRef);
actions = actionTrackingService.getExecutingActions(action);
} else {
actions = actionTrackingService.getAllExecutingActions();
}
// Build the model list
return modelBuilder.buildSimpleList(actions);
}
示例9: executeImpl
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
/**
* @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(WebScriptRequest, Status, Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest request, Status status, Cache cache)
{
Map<String, Object> result = new HashMap<String, Object>();
cache.setNeverCache(true);
LicenseDescriptor licenseDescriptor = descriptorService.getLicenseDescriptor();
boolean isEnterprise = (licenseDescriptor == null ? false : (licenseDescriptor.getLicenseMode() == LicenseMode.ENTERPRISE));
result.put(IS_ENTERPRISE, Boolean.valueOf(isEnterprise));
result.put(RESULT_IMPORT_STATUS, bulkImporter.getStatus());
return(result);
}
示例10: getClassQName
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
@Override
protected QName getClassQName(WebScriptRequest req)
{
QName classQName = null;
String className = req.getServiceMatch().getTemplateVars().get(DICTIONARY_CLASS_NAME);
if (className != null && className.length() != 0)
{
classQName = createClassQName(className);
if (classQName == null)
{
// Error
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the className - " + className + " - parameter in the URL");
}
}
return classQName;
}
示例11: unprotectedExecuteImpl
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
@Override
protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache)
{
// get the filterID parameter.
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
String filterID = templateVars.get("filterID");
if (filterID == null)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Filter id not provided");
}
facetService.deleteFacet(filterID);
Map<String, Object> model = new HashMap<String, Object>(1);
model.put("success", true);
if (logger.isDebugEnabled())
{
logger.debug("Facet [" + filterID + "] has been deleted successfully");
}
return model;
}
示例12: executeImpl
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
/**
* Override method from DeclarativeWebScript
*/
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
Map<String, Object> model = new HashMap<String, Object>(3);
Map<QName, ClassDefinition> classdef = new HashMap<QName, ClassDefinition>();
Map<QName, Collection<PropertyDefinition>> propdef = new HashMap<QName, Collection<PropertyDefinition>>();
Map<QName, Collection<AssociationDefinition>> assocdef = new HashMap<QName, Collection<AssociationDefinition>>();
QName classQname = getClassQname(req);
classdef.put(classQname, this.dictionaryservice.getClass(classQname));
propdef.put(classQname, this.dictionaryservice.getClass(classQname).getProperties().values());
assocdef.put(classQname, this.dictionaryservice.getClass(classQname).getAssociations().values());
model.put(MODEL_PROP_KEY_CLASS_DETAILS, classdef.values());
model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, propdef.values());
model.put(MODEL_PROP_KEY_ASSOCIATION_DETAILS, assocdef.values());
model.put(MODEL_PROP_KEY_MESSAGE_LOOKUP, this.dictionaryservice);
return model;
}
示例13: getClassQName
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
@Override
protected QName getClassQName(WebScriptRequest req)
{
QName classQName = null;
String prefix = req.getServiceMatch().getTemplateVars().get(DICTIONARY_PREFIX);
String shortName = req.getServiceMatch().getTemplateVars().get(DICTIONARY_SHORT_CLASS_NAME);
if (prefix != null && prefix.length() != 0 && shortName != null && shortName.length()!= 0)
{
classQName = createClassQName(prefix, shortName);
if (classQName == null)
{
// Error
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the className - " + prefix + ":" + shortName + " - parameter in the URL");
}
}
return classQName;
}
示例14: 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>();
try
{
req.getContent().getInputStream().close();
model.put("result", "success");
}
catch (IOException e)
{
throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, "Fail to read request content.");
}
return model;
}
示例15: setExceptionResponse
import org.springframework.extensions.webscripts.WebScriptRequest; //导入依赖的package包/类
private void setExceptionResponse(WebScriptRequest req, Status responseStatus, String responseMessage, int statusCode, Exception e)
{
String message = responseMessage + req;
if (logger.isDebugEnabled())
{
logger.warn(message, e);
}
else
{
logger.warn(message);
}
responseStatus.setCode(statusCode, message);
responseStatus.setException(e);
}