本文整理汇总了Java中org.springframework.extensions.webscripts.Status.STATUS_NOT_FOUND属性的典型用法代码示例。如果您正苦于以下问题:Java Status.STATUS_NOT_FOUND属性的具体用法?Java Status.STATUS_NOT_FOUND怎么用?Java Status.STATUS_NOT_FOUND使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.springframework.extensions.webscripts.Status
的用法示例。
在下文中一共展示了Status.STATUS_NOT_FOUND属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeImpl
@Override
protected Map<String, Object> executeImpl(SiteInfo site, String linkName,
WebScriptRequest req, JSONObject json, Status status, Cache cache)
{
Map<String, Object> model = new HashMap<String, Object>();
// Try to find the link
LinkInfo link = linksService.getLink(site.getShortName(), linkName);
if (link == null)
{
String message = "No link found with that name";
throw new WebScriptException(Status.STATUS_NOT_FOUND, message);
}
// Build the model
model.put(PARAM_ITEM, renderLink(link));
model.put("node", link.getNodeRef());
model.put("link", link);
model.put("site", site);
model.put("siteId", site.getShortName());
// All done
return model;
}
示例2: getClassQName
@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;
}
示例3: getFullNamespaceURI
/**
* @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");
}
}
示例4: buildModel
@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);
}
示例5: getAssociationQname
@Override
protected QName getAssociationQname(WebScriptRequest req)
{
String associationName = req.getServiceMatch().getTemplateVars().get(DICTIONARY_ASSOCIATION_SHORTNAME);
String associationPrefix = req.getServiceMatch().getTemplateVars().get(DICTIONARY_ASSOCIATION_PREFIX);
if(associationPrefix == null)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Missing parameter association prefix in the URL");
}
if(associationName == null)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Missing parameter association name in the URL");
}
return QName.createQName(getFullNamespaceURI(associationPrefix, associationName));
}
示例6: execute
private Map<String, Object> execute(WebScriptRequest req, Status status)
{
// initialise model to pass on for template to render
Map<String, Object> model = new HashMap<String, Object>();
// get inviteId and inviteTicket
String inviteId = req.getServiceMatch().getTemplateVars().get("inviteId");
String inviteTicket = req.getServiceMatch().getTemplateVars().get("inviteTicket");
try
{
Invitation invitation = invitationService.getInvitation(inviteId);
if (invitation instanceof NominatedInvitation)
{
NominatedInvitation theInvitation = (NominatedInvitation)invitation;
String ticket = theInvitation.getTicket();
if (ticket == null || (! ticket.equals(inviteTicket)))
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Ticket mismatch");
}
// return the invite info
model.put("invite", toInviteInfo(theInvitation));
return model;
}
else
{
// Not a nominated invitation
throw new WebScriptException(Status.STATUS_FORBIDDEN, "Not a nominated invitation");
}
}
catch (InvitationExceptionNotFound nfe)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND,
"No invite found for given id");
}
}
示例7: getAssociationQname
@Override
protected QName getAssociationQname(WebScriptRequest req)
{
String associationName = req.getServiceMatch().getTemplateVars().get(DICTIONARY_ASSOCIATION_NAME);
if(associationName == null)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Missing parameter association name in the URL");
}
return QName.createQName(getFullNamespaceURI(associationName));
}
示例8: getClassQname
@Override
protected QName getClassQname(String namespacePrefix, String name)
{
String className = namespacePrefix + "_" + name;
if(isValidClassname(className) == false)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the name - " + name + "parameter in the URL");
}
return QName.createQName(getFullNamespaceURI(className));
}
示例9: executeImpl
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map<String, Object> model = new HashMap<String, Object>(7);
String appName = getParamAppName(req);
if (appName == null)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "audit.err.app.notProvided");
}
AuditApplication app = auditService.getAuditApplications().get(appName);
if (app == null)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "audit.err.app.notFound", appName);
}
// Get from/to times
Long fromTime = getParamFromTime(req); // might be null
Long toTime = getParamToTime(req); // might be null
// Clear
int cleared = auditService.clearAudit(appName, fromTime, toTime);
model.put(JSON_KEY_CLEARED, cleared);
// Done
if (logger.isDebugEnabled())
{
logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
}
return model;
}
示例10: unprotectedExecuteImpl
@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");
Map<String, Object> model = new HashMap<String, Object>(1);
if (filterID == null)
{
model.put("filters", facetService.getFacets());
}
else
{
SolrFacetProperties fp = facetService.getFacet(filterID);
if (fp == null)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Filter not found");
}
model.put("filter", fp);
}
if (logger.isDebugEnabled())
{
logger.debug("Retrieved all available facets: " + model.values());
}
return model;
}
示例11: getClassQname
@Override
protected QName getClassQname(String namespacePrefix, String name)
{
if(isValidClassname(namespacePrefix, name) == false)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the name - " + name + "parameter in the URL");
}
return QName.createQName(getFullNamespaceURI(namespacePrefix, name));
}
示例12: getClassQname
/**
* Override method from AbstractClassGet
*/
@Override
protected QName getClassQname(WebScriptRequest req)
{
String prefix = req.getServiceMatch().getTemplateVars().get(DICTIONARY_PREFIX);
String shortName = req.getServiceMatch().getTemplateVars().get(DICTIONARY_SHORT_CLASS_NAME);
//validate the classname and throw appropriate error message
if (isValidClassname(prefix, shortName) == false)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the classname - " + prefix + ":" + shortName + " - parameter in the URL");
}
return QName.createQName(getFullNamespaceURI(prefix, shortName));
}
示例13: getPropertyQname
@Override
protected QName getPropertyQname(WebScriptRequest req)
{
String propertyName = req.getServiceMatch().getTemplateVars().get(DICTIONARY_PROPERTY_NAME);
//validate the presence of property name
if(propertyName == null)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Missing parameter propertyname in the URL");
}
return QName.createQName(getFullNamespaceURI(propertyName));
}
示例14: executeImpl
@Override
protected Map<String, Object> executeImpl(SiteInfo site, NodeRef nodeRef,
BlogPostInfo blog, WebScriptRequest req, JSONObject json, Status status, Cache cache)
{
if (blog == null)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Blog Post Not Found");
}
// Build the response
Map<String, Object> model = new HashMap<String, Object>();
// TODO Fetch this from the BlogPostInfo object
NodeRef node = blog.getNodeRef();
Map<String, Object> item = BlogPostLibJs.getBlogPostData(node, services);
model.put(ITEM, item);
model.put(POST, blog);
model.put("externalBlogConfig", BlogPostLibJs.hasExternalBlogConfiguration(node, services));
int contentLength = -1;
String arg = req.getParameter("contentLength");
if (arg != null)
{
try
{
contentLength = Integer.parseInt(arg);
}
catch (NumberFormatException ignored)
{
// Intentionally empty
}
}
model.put("contentLength", contentLength);
return model;
}
示例15: getClassQname
@Override
protected QName getClassQname(WebScriptRequest req)
{
String className = req.getServiceMatch().getTemplateVars().get(DICTIONARY_CLASS_NAME);
// validate the classname
if (isValidClassname(className) == false)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Check the classname - " + className + " - parameter in the URL");
}
return QName.createQName(getFullNamespaceURI(className));
}