本文整理汇总了Java中org.springframework.extensions.webscripts.Status类的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Status类属于org.springframework.extensions.webscripts包,在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildModel
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(ReplicationModelBuilder modelBuilder,
WebScriptRequest req, Status status, Cache cache)
{
// Which definition did they ask for?
String replicationDefinitionName =
req.getServiceMatch().getTemplateVars().get("replication_definition_name");
ReplicationDefinition replicationDefinition =
replicationService.loadReplicationDefinition(replicationDefinitionName);
// Does it exist?
if(replicationDefinition == null) {
throw new WebScriptException(
Status.STATUS_NOT_FOUND,
"No Replication Definition found with that name"
);
}
// Have it turned into simple models
return modelBuilder.buildDetails(replicationDefinition);
}
示例2: buildModel
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(WorkflowModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache)
{
Map<String, String> params = req.getServiceMatch().getTemplateVars();
// getting workflow instance id from request parameters
String workflowInstanceId = params.get("workflow_instance_id");
boolean includeTasks = getIncludeTasks(req);
WorkflowInstance workflowInstance = workflowService.getWorkflowById(workflowInstanceId);
// task was not found -> return 404
if (workflowInstance == null)
{
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find workflow instance with id: " + workflowInstanceId);
}
Map<String, Object> model = new HashMap<String, Object>();
// build the model for ftl
model.put("workflowInstance", modelBuilder.buildDetailed(workflowInstance, includeTasks));
return model;
}
示例3: testGetInvitesBySiteShortName
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
public void testGetInvitesBySiteShortName() throws Exception
{
// inviter starts invite workflow
JSONObject result = startInvite(INVITEE_FIRSTNAME,
INVITEE_LASTNAME, INVITEE_SITE_ROLE, SITE_SHORT_NAME_INVITE_1, Status.STATUS_CREATED);
// get hold of site short name property of started invite workflow instance
JSONObject data = result.getJSONObject("data");
String siteShortName = data.getString("resourceName");
assertEquals(true, ((siteShortName != null) && (siteShortName.length() != 0)));
// get pending invites matching site short name from invite started above
JSONObject getInvitesResult = getInvitesBySiteShortName(siteShortName,
Status.STATUS_OK);
assertEquals(true, getInvitesResult.getJSONArray("invites").length() > 0);
JSONObject inviteJSONObj = getInvitesResult.getJSONArray("invites").getJSONObject(0);
assertEquals(siteShortName, inviteJSONObj.getJSONObject("site").get("shortName"));
}
示例4: executeImpl
import org.springframework.extensions.webscripts.Status; //导入依赖的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;
}
示例5: getClassQName
import org.springframework.extensions.webscripts.Status; //导入依赖的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;
}
示例6: getFullNamespaceURI
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
/**
* @param classname the class name as cm_person
* @return String the full name in the following format {namespaceuri}shorname
*/
public String getFullNamespaceURI(String classname)
{
try
{
String result = null;
String prefix = this.getPrefix(classname);
String url = this.namespaceService.getNamespaceURI(prefix);
String name = this.getShortName(classname);
result = "{" + url + "}"+ name;
return result;
}
catch (Exception e)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "The exact classname - " + classname + " parameter has not been provided in the URL");
}
}
示例7: testStartInviteForSameInviteeButTwoDifferentSites
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
public void testStartInviteForSameInviteeButTwoDifferentSites()
throws Exception
{
final String inviteeUsername = INVITEE_FIRSTNAME + "_" + INVITEE_LASTNAME;
final String inviteeEmail = INVITEE_EMAIL_PREFIX + RandomStringUtils.randomAlphanumeric(6) + "@" + INVITEE_EMAIL_DOMAIN;
// Create person
AuthenticationUtil.runAs(new RunAsWork<Object>()
{
public Object doWork() throws Exception
{
createPerson(INVITEE_FIRSTNAME, INVITEE_LASTNAME, inviteeUsername, inviteeEmail);
return null;
}
}, AuthenticationUtil.getSystemUserName());
JSONObject result = startInvite(INVITEE_FIRSTNAME, INVITEE_LASTNAME, inviteeEmail, INVITEE_SITE_ROLE, SITE_SHORT_NAME_INVITE_1,
Status.STATUS_CREATED);
startInvite(INVITEE_FIRSTNAME, INVITEE_LASTNAME, inviteeEmail, INVITEE_SITE_ROLE, SITE_SHORT_NAME_INVITE_2, Status.STATUS_CREATED);
}
示例8: getClassQName
import org.springframework.extensions.webscripts.Status; //导入依赖的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;
}
示例9: testAuthenticationGetJSON
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
/**
* Positive test - login and retrieve a ticket,
* - via json method
*/
public void testAuthenticationGetJSON() throws Exception
{
/**
* Login via get method to return json
*/
String loginURL = "/api/login.json?u=" + USER_ONE + "&pw=" + USER_ONE ;
Response resp = sendRequest(new GetRequest(loginURL), Status.STATUS_OK);
JSONObject result = new JSONObject(resp.getContentAsString());
JSONObject data = result.getJSONObject("data");
String ticket = data.getString("ticket");
assertNotNull("ticket is null", ticket);
/**
* This is now testing the framework ... With a different format.
*/
String login2URL = "/api/login?u=" + USER_ONE + "&pw=" + USER_ONE + "&format=json";
Response resp2 = sendRequest(new GetRequest(login2URL), Status.STATUS_OK);
JSONObject result2 = new JSONObject(resp2.getContentAsString());
JSONObject data2 = result2.getJSONObject("data");
String ticket2 = data2.getString("ticket");
assertNotNull("ticket is null", ticket2);
}
示例10: DISABLED_testGetContent
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
public void DISABLED_testGetContent() throws Exception
{
long nodeId = -1l;
String propertyName = ContentModel.PROP_CONTENT.toString();
buildTransactions3();
String url = "/api/solr/content?nodeId=" + nodeId + "&propertyName=" + propertyName;
TestWebScriptServer.GetRequest req = new TestWebScriptServer.GetRequest(url);
Response response = sendRequest(req, Status.STATUS_OK, admin);
if (logger.isDebugEnabled())
{
logger.debug("content1 = " + response.getContentAsString());
}
assertEquals("Content length is incorrect", "test content".length(), response.getContentLength());
}
示例11: buildModel
import org.springframework.extensions.webscripts.Status; //导入依赖的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);
}
示例12: executeImpl
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req,
Status status, Cache cache)
{
// Grab the site
String siteName =
req.getServiceMatch().getTemplateVars().get("shortname");
SiteInfo site = siteService.getSite(siteName);
if (site == null)
{
throw new WebScriptException(
Status.STATUS_NOT_FOUND,
"No Site found with that short name");
}
// Process
return executeImpl(site, req, status, cache);
}
示例13: executeImpl
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
if (! isEnabled())
{
throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "QuickShare is disabled system-wide");
}
// create map of params (template vars)
Map<String, String> params = req.getServiceMatch().getTemplateVars();
final NodeRef nodeRef = WebScriptUtil.getNodeRef(params);
if (nodeRef == null)
{
String msg = "A valid NodeRef must be specified!";
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, msg);
}
try
{
QuickShareDTO dto = quickShareService.shareContent(nodeRef);
Map<String, Object> model = new HashMap<String, Object>(1);
model.put("sharedDTO", dto);
return model;
}
catch (InvalidNodeRefException inre)
{
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: " + nodeRef);
}
}
示例14: executeImpl
import org.springframework.extensions.webscripts.Status; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req,
Status status, Cache cache)
{
Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
// Site is optional
SiteInfo site = null;
String siteName = templateVars.get("site");
if (siteName != null)
{
site = siteService.getSite(siteName);
// MNT-3053 fix, siteName was provided in request but it doesn't exists or user has no permissions to access it.
if (site == null)
{
status.setCode(HttpServletResponse.SC_NOT_FOUND, "Site '" + siteName + "' does not exist or user has no permissions to access it.");
return null;
}
}
return executeImpl(site, null, req, null, status, cache);
}
示例15: handle
import org.springframework.extensions.webscripts.Status; //导入依赖的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());
}