• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AbstractResource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.wicket.request.resource.AbstractResource的典型用法代码示例。如果您正苦于以下问题:Java AbstractResource类的具体用法?Java AbstractResource怎么用?Java AbstractResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AbstractResource类属于org.apache.wicket.request.resource包,在下文中一共展示了AbstractResource类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPhotoModel

import org.apache.wicket.request.resource.AbstractResource; //导入依赖的package包/类
@Override
protected IModel<AbstractResource> getPhotoModel() {
	return new AbstractReadOnlyModel<AbstractResource>() {
		private static final long serialVersionUID = 1L;
		
		@Override
		public AbstractResource getObject() {
			byte[] jpegPhoto = null;
			O object = getModel().getObject();
			if (object instanceof FocusType) {
				jpegPhoto = ((FocusType) object).getJpegPhoto();
			}
			if (jpegPhoto == null) {
				return null;
			} else {
				return new ByteArrayResource("image/jpeg", jpegPhoto);
			}
		}
	};
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:21,代码来源:FocusSummaryPanel.java


示例2: getPhotoModel

import org.apache.wicket.request.resource.AbstractResource; //导入依赖的package包/类
@Override
protected IModel<AbstractResource> getPhotoModel() {
	return new AbstractReadOnlyModel<AbstractResource>() {
		private static final long serialVersionUID = 1L;

		@Override
		public AbstractResource getObject() {
			byte[] jpegPhoto = null;
			O object = getModel().getObject();
			if (object instanceof FocusType) {
				jpegPhoto = ((FocusType) object).getJpegPhoto();
			}
			if (jpegPhoto == null) {
				return null;
			} else {
				return new ByteArrayResource("image/jpeg", jpegPhoto);
			}
		}
	};
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:21,代码来源:FocusSummaryPanel.java


示例3: load

import org.apache.wicket.request.resource.AbstractResource; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void load() {
    resources = new ArrayList<>();

    ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
    scanner.addIncludeFilter(new AssignableTypeFilter(AbstractResource.class));

    for (BeanDefinition bd : scanner.findCandidateComponents(getBasePackage())) {
        try {
            Class<?> clazz = ClassUtils.resolveClassName(bd.getBeanClassName(), ClassUtils.getDefaultClassLoader());
            boolean isAbsractClazz = Modifier.isAbstract(clazz.getModifiers());

            if (!isAbsractClazz) {
                if (AbstractResource.class.isAssignableFrom(clazz)) {
                    if (clazz.isAnnotationPresent(Resource.class)) {
                        resources.add((Class<? extends AbstractResource>) clazz);
                    } else {
                        LOG.error("Could not find annotation {} in {}, ignoring",
                                Resource.class.getName(), clazz.getName());
                    }
                }
            }
        } catch (Throwable t) {
            LOG.warn("Could not inspect class {}", bd.getBeanClassName(), t);
        }
    }
    resources = Collections.unmodifiableList(resources);
}
 
开发者ID:apache,项目名称:syncope,代码行数:29,代码来源:ClassPathScanImplementationLookup.java


示例4: newResourceResponse

import org.apache.wicket.request.resource.AbstractResource; //导入依赖的package包/类
@Override
protected ResourceResponse newResourceResponse(final IResource.Attributes attributes) {
    ResourceResponse response = new AbstractResource.ResourceResponse();
    response.setContentType(MediaType.TEXT_PLAIN);
    try {
        HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();
        if (!xsrfCheck(request)) {
            LOG.error("XSRF TOKEN does not match");
            response.setError(Response.Status.BAD_REQUEST.getStatusCode(), "XSRF TOKEN does not match");
            return response;
        }

        Map<String, String[]> parameters = request.getParameterMap();
        String token;
        if (parameters.get("token") == null || parameters.get("token").length == 0) {
            throw new Exception("A valid token should be provided");
        } else {
            token = parameters.get("token")[0];
        }

        if (parameters.get("newPassword") == null || parameters.get("newPassword").length == 0) {
            throw new Exception("A new correct password should be provided");
        }
        SyncopeEnduserSession.get().getService(UserSelfService.class).
                confirmPasswordReset(token, parameters.get("newPassword")[0]);

        buildResponse(response, Response.Status.OK.getStatusCode(),
                "Password successfully updated");
    } catch (final Exception e) {
        LOG.error("Error while updating user", e);
        response.setError(Response.Status.BAD_REQUEST.getStatusCode(), new StringBuilder()
                .append("ErrorMessage{{ ")
                .append(e.getMessage())
                .append(" }}")
                .toString());
    }
    return response;
}
 
开发者ID:apache,项目名称:syncope,代码行数:39,代码来源:UserSelfConfirmPasswordReset.java


示例5: newWriteCallback

import org.apache.wicket.request.resource.AbstractResource; //导入依赖的package包/类
/**
 * creates a new empty write callback.
 *
 * @return noop {@link org.apache.wicket.request.resource.AbstractResource.WriteCallback}
 */
protected AbstractResource.WriteCallback newWriteCallback() {
    return new AbstractResource.WriteCallback() {
        @Override
        public void writeData(IResource.Attributes attributes) throws IOException {
        }
    };
}
 
开发者ID:l0rdn1kk0n,项目名称:wicket-clientside-logging,代码行数:13,代码来源:EmptyResourceResponse.java


示例6: getPhotoModel

import org.apache.wicket.request.resource.AbstractResource; //导入依赖的package包/类
protected IModel<AbstractResource> getPhotoModel() {
    return new Model<>(null);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:4,代码来源:AbstractSummaryPanel.java


示例7: getResources

import org.apache.wicket.request.resource.AbstractResource; //导入依赖的package包/类
public List<Class<? extends AbstractResource>> getResources() {
    return resources;
}
 
开发者ID:apache,项目名称:syncope,代码行数:4,代码来源:ClassPathScanImplementationLookup.java


示例8: newResourceResponse

import org.apache.wicket.request.resource.AbstractResource; //导入依赖的package包/类
@Override
protected ResourceResponse newResourceResponse(final IResource.Attributes attributes) {
    ResourceResponse response = new AbstractResource.ResourceResponse();
    response.setContentType(MediaType.TEXT_PLAIN);
    String[] usernameParam = { "<unknown>" };
    try {
        HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest();
        if (!xsrfCheck(request)) {
            LOG.error("XSRF TOKEN does not match");
            response.setError(Response.Status.BAD_REQUEST.getStatusCode(), "XSRF TOKEN does not match");
            return response;
        }

        Map<String, String[]> parameters = request.getParameterMap();
        usernameParam = parameters.get("username");
        if (ArrayUtils.isEmpty(usernameParam)) {
            throw new Exception("A valid username should be provided");
        }

        if (request.getHeader("captcha") == null
                || !captchaCheck(
                        request.getHeader("captcha"),
                        request.getSession().getAttribute(SyncopeEnduserConstants.CAPTCHA_SESSION_KEY))) {

            throw new IllegalArgumentException("Entered captcha is not matching");
        }

        if (SyncopeEnduserSession.get().getPlatformInfo().isPwdResetRequiringSecurityQuestions()) {
            String[] securityAnswerParam = parameters.get("securityAnswer");
            if (ArrayUtils.isEmpty(securityAnswerParam)) {
                throw new Exception("A correct security answer should be provided");
            }
            SyncopeEnduserSession.get().getService(UserSelfService.class).
                    requestPasswordReset(usernameParam[0], securityAnswerParam[0]);
        } else {
            SyncopeEnduserSession.get().getService(UserSelfService.class).
                    requestPasswordReset(usernameParam[0], null);
        }
    } catch (final Exception e) {
        LOG.error("Error while updating user", e);
    }

    buildResponse(response, Response.Status.OK.getStatusCode(),
            "Password reset request sent for user " + usernameParam[0]);
    return response;
}
 
开发者ID:apache,项目名称:syncope,代码行数:47,代码来源:UserSelfPasswordReset.java



注:本文中的org.apache.wicket.request.resource.AbstractResource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LineNumber类代码示例发布时间:2022-05-21
下一篇:
Java MockSpan类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap