本文整理汇总了Java中org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException类的典型用法代码示例。如果您正苦于以下问题:Java AbortWithHttpErrorCodeException类的具体用法?Java AbortWithHttpErrorCodeException怎么用?Java AbortWithHttpErrorCodeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbortWithHttpErrorCodeException类属于org.apache.wicket.request.http.flow包,在下文中一共展示了AbortWithHttpErrorCodeException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ArtifactListPage
import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; //导入依赖的package包/类
public ArtifactListPage() throws IOException {
setStatelessHint(true);
setVersioned(false);
//Retrieve the repository path from the request
HttpServletRequest httpServletRequest = WicketUtils.getHttpServletRequest();
RepoPath repoPath = (RepoPath) httpServletRequest.getAttribute(RepoFilter.ATTR_ARTIFACTORY_REPOSITORY_PATH);
if (repoPath == null || StringUtils.isEmpty(repoPath.getRepoKey())) {
throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND);
}
addTitle(repoPath);
Properties requestProps = (Properties) httpServletRequest
.getAttribute(RepoFilter.ATTR_ARTIFACTORY_REQUEST_PROPERTIES);
addFileList(repoPath, requestProps);
addAddress(httpServletRequest);
}
示例2: getRequestedNodeId
import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; //导入依赖的package包/类
protected Long getRequestedNodeId() {
StringValue id = getPageParameters().get("id");
if (id.isEmpty()) {
String key = getPageParameters().get("project-key")
.toOptionalString();
if (key != null) {
ITreeNode<String> node = treeNodeService
.getTreeNodeByKey(key);
if (node != null) {
id = StringValue.valueOf(node.getId());
} else {
// TODO give translated message for the 404 reason
throw new AbortWithHttpErrorCodeException(404);
}
}
}
return id.toOptionalLong();
}
示例3: getRequestedNodeId
import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; //导入依赖的package包/类
private Long getRequestedNodeId() {
StringValue id = getPageParameters().get("id");
if (id.isEmpty()) {
String key = getPageParameters().get("project-key")
.toOptionalString();
if (key != null) {
ITreeNode<String> node = treeNodeService
.getTreeNodeByKey(key);
if (node != null) {
id = StringValue.valueOf(node.getId());
} else {
// TODO give translated message for the 404 reason
throw new AbortWithHttpErrorCodeException(404);
}
}
}
return id.toOptionalLong();
}
示例4: getRequestedNodeId
import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; //导入依赖的package包/类
private Long getRequestedNodeId() {
StringValue id = getPageParameters().get("id");
if (id.isEmpty()) {
String key = getPageParameters().get("qmodel-key")
.toOptionalString();
if (key != null) {
IQMTreeNode<String> node = qmtreeNodeService
.getTreeNodeByKey(key);
if (node != null) {
id = StringValue.valueOf(node.getId());
} else {
// TODO give translated message for the 404 reason
throw new AbortWithHttpErrorCodeException(404);
}
}
}
return id.toOptionalLong();
}
示例5: getItems
import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; //导入依赖的package包/类
/**
* sort retrieved browsable item from repository
* @param repoPath - repository path
* @param requestProps - request properties
* @param rootNodesFilterResult - object hold the List node acceptance status flag,if flagged to false meaning
* at least one node has read permission issue by user
* @return list of sorted browsable item
*/
private List<? extends BaseBrowsableItem> getItems(RepoPath repoPath, Properties requestProps,
RootNodesFilterResult rootNodesFilterResult) {
boolean updateRootNodesFilterFlag = authorizationService.isAnonymous();
List<? extends BaseBrowsableItem> items;
try {
items = getBrowsableItemsList(repoPath, requestProps,rootNodesFilterResult,
updateRootNodesFilterFlag);
} catch (Exception e) {
throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND, e.getMessage());
}
Collections.sort(items, new ItemInfoComparator());
return items;
}
示例6: SimpleRepoBrowserPage
import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; //导入依赖的package包/类
public SimpleRepoBrowserPage() {
setStatelessHint(false);
setVersioned(false);
//Retrieve the repository path from the request
HttpServletRequest httpRequest = WicketUtils.getHttpServletRequest();
RepoPath repoPath = (RepoPath) httpRequest.getAttribute(RepoFilter.ATTR_ARTIFACTORY_REPOSITORY_PATH);
if (repoPath == null) {
//Happens on refresh after login redirection - return a 404
throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND);
}
String repoKey = repoPath.getRepoKey();
RemoteRepoDescriptor remoteRepoDescriptor = repoService.remoteRepoDescriptorByKey(repoKey);
if (authorizationService.isAdmin() && (remoteRepoDescriptor != null) &&
!remoteRepoDescriptor.isListRemoteFolderItems()) {
warn("Remote content browsing is disabled for this repository." +
"\n You can turn on remote browsing by enabling the 'List Remote Folder Items' flag for this repository.");
}
Properties requestProps = (Properties) httpRequest.getAttribute(RepoFilter.ATTR_ARTIFACTORY_REQUEST_PROPERTIES);
if (repoService.remoteRepoDescriptorByKey(repoKey) != null) {
add(new RemoteRepoBrowserPanel("browseRepoPanel", repoPath, requestProps));
} else if (repoService.virtualRepoDescriptorByKey(repoKey) != null) {
add(new VirtualRepoBrowserPanel("browseRepoPanel", repoPath, requestProps));
} else if (repoService.localOrCachedRepoDescriptorByKey(repoKey) != null) {
add(new LocalRepoBrowserPanel("browseRepoPanel", repoPath, requestProps));
} else {
throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND);
}
}
示例7: throwError
import org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException; //导入依赖的package包/类
/**
* Throws an AbortWithHttpErrorCodeException with the given status and message
*
* @param status Status to set for error
* @param errorMessage Message to display in the error
*/
private void throwError(int status, String errorMessage) {
logError(errorMessage);
throw new AbortWithHttpErrorCodeException(status, errorMessage);
}