List of usage examples for org.apache.wicket.request.resource ResourceReference ResourceReference
public ResourceReference(String name)
From source file:org.apache.syncope.client.enduser.SyncopeEnduserApplication.java
License:Apache License
@Override protected void init() { super.init(); // read enduser.properties Properties props = new Properties(); try (InputStream is = getClass().getResourceAsStream("/" + ENDUSER_PROPERTIES)) { props.load(is);/*from w ww .j a v a 2 s . c o m*/ File enduserDir = new File(props.getProperty("enduser.directory")); if (enduserDir.exists() && enduserDir.canRead() && enduserDir.isDirectory()) { File enduserDirProps = FileUtils.getFile(enduserDir, ENDUSER_PROPERTIES); if (enduserDirProps.exists() && enduserDirProps.canRead() && enduserDirProps.isFile()) { props.clear(); props.load(FileUtils.openInputStream(enduserDirProps)); } } } catch (Exception e) { throw new WicketRuntimeException("Could not read " + ENDUSER_PROPERTIES, e); } version = props.getProperty("version"); Args.notNull(version, "<version> not set"); site = props.getProperty("site"); Args.notNull(site, "<site> not set"); license = props.getProperty("license"); Args.notNull(license, "<license> not set"); domain = props.getProperty("domain", SyncopeConstants.MASTER_DOMAIN); adminUser = props.getProperty("adminUser"); Args.notNull(adminUser, "<adminUser> not set"); anonymousUser = props.getProperty("anonymousUser"); Args.notNull(anonymousUser, "<anonymousUser> not set"); anonymousKey = props.getProperty("anonymousKey"); Args.notNull(anonymousKey, "<anonymousKey> not set"); captchaEnabled = Boolean.parseBoolean(props.getProperty("captcha")); Args.notNull(captchaEnabled, "<captcha> not set"); xsrfEnabled = Boolean.parseBoolean(props.getProperty("xsrf")); Args.notNull(xsrfEnabled, "<xsrf> not set"); String scheme = props.getProperty("scheme"); Args.notNull(scheme, "<scheme> not set"); String host = props.getProperty("host"); Args.notNull(host, "<host> not set"); String port = props.getProperty("port"); Args.notNull(port, "<port> not set"); String rootPath = props.getProperty("rootPath"); Args.notNull(rootPath, "<rootPath> not set"); String useGZIPCompression = props.getProperty("useGZIPCompression"); Args.notNull(rootPath, "<useGZIPCompression> not set"); clientFactory = new SyncopeClientFactoryBean() .setAddress(scheme + "://" + host + ":" + port + "/" + rootPath) .setContentType(SyncopeClientFactoryBean.ContentType.JSON) .setUseCompression(BooleanUtils.toBoolean(useGZIPCompression)); // resource to provide login functionality managed by wicket mountResource("/api/login", new ResourceReference("login") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new LoginResource(); } }); // resource to provide logout functionality managed by wicket mountResource("/api/logout", new ResourceReference("logout") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new LogoutResource(); } }); mountResource("/api/self/islogged", new ResourceReference("userSelfIsLogged") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new UserSelfIsLogged(); } }); // resource to retrieve info about logged user mountResource("/api/self/read", new ResourceReference("userSelfRead") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new UserSelfReadResource(); } }); // resource to provide user self create functionality managed by wicket mountResource("/api/self/create", new ResourceReference("userSelfCreate") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new UserSelfCreateResource(); } }); // resource to provide user self update functionality managed by wicket mountResource("/api/self/update", new ResourceReference("userSelfUpdate") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new UserSelfUpdateResource(); } }); mountResource("/api/self/requestPasswordReset", new ResourceReference("userSelfPasswordReset") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new UserSelfPasswordReset(); } }); mountResource("/api/self/confirmPasswordReset", new ResourceReference("userSelfConfirmPasswordReset") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new UserSelfConfirmPasswordReset(); } }); mountResource("/api/self/changePassword", new ResourceReference("userSelfChangePassword") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new UserSelfChangePassword(); } }); mountResource("/api/schemas", new ResourceReference("schemas") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new SchemaResource(); } }); mountResource("/api/resources", new ResourceReference("resources") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new ExternalResourceResource(); } }); mountResource("/api/securityQuestions", new ResourceReference("securityQuestions") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new SecurityQuestionResource(); } }); mountResource("/api/securityQuestions/byUser/${username}", new ResourceReference("securityQuestions") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new SecurityQuestionResource(); } }); mountResource("/api/info", new ResourceReference("info") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new InfoResource(); } }); // resource to get a fresh captcha image mountResource("/api/captcha", new ResourceReference("captcha") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new CaptchaResource(); } }); mountResource("/api/realms", new ResourceReference("realms") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new RealmResource(); } }); mountResource("/api/groups", new ResourceReference("groups") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new GroupResource(); } }); mountResource("/api/auxiliaryClasses", new ResourceReference("auxClasses") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new AnyTypeClassResource(); } }); mountResource("/api/anyTypes", new ResourceReference("anyType") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new AnyTypeResource(); } }); }
From source file:org.artifactory.webapp.wicket.application.ArtifactoryApplication.java
License:Open Source License
/** * Mount a resource.//from w ww . j ava2s . c o m * * @param path The path of the resource. * @param resource The resource itself */ private void mountResource(String path, final IResource resource) { mountResource(path, new ResourceReference(path) { @Override public IResource getResource() { return resource; } }); }
From source file:org.cdlflex.ui.util.ResourceReferencesTest.java
License:Apache License
@Test(expected = IllegalArgumentException.class) public void asHeaderItem_withUnknownHeaderItemType_throwsException() throws Exception { ResourceReferences.asHeaderItem(new ResourceReference("unknown") { private static final long serialVersionUID = 1L; @Override//from ww w . j a v a2 s .com public IResource getResource() { return null; } }); }
From source file:org.wicketstuff.rest.utils.mounting.PackageScanner.java
License:Apache License
private static void mountAnnotatedResource(WebApplication application, Class<?> clazz) throws InstantiationException, IllegalAccessException { ResourcePath mountAnnotation = clazz.getAnnotation(ResourcePath.class); if (mountAnnotation == null || !IResource.class.isAssignableFrom(clazz)) { return;//ww w .j ava 2 s .co m } String path = mountAnnotation.value(); final IResource resourceInstance = (IResource) clazz.newInstance(); application.mountResource(path, new ResourceReference(clazz.getSimpleName()) { /** * */ private static final long serialVersionUID = 1L; @Override public IResource getResource() { return resourceInstance; } }); log.info("Resource '" + clazz.getSimpleName() + "' has been mounted to path '" + path + "'"); }
From source file:org.wicketstuff.rest.WicketApplication.java
License:Apache License
@Override public void init() { super.init(); mountResource("/personsmanager", new ResourceReference("restReference") { PersonsRestResource resource = new PersonsRestResource(); @Override//from w w w. j a va2s . c o m public IResource getResource() { return resource; } }); }
From source file:org.wicketTutorial.resmounting.WicketApplication.java
License:Apache License
/** * @see org.apache.wicket.Application#init() */// w ww . j a v a 2 s . co m @Override public void init() { super.init(); ResourceReference resourceReference = new ResourceReference("rssProducer") { RSSProducerResource deviceMetaResource = new RSSProducerResource(); @Override public IResource getResource() { return deviceMetaResource; } }; mountResource("/foo/bar", resourceReference); mountResource("/bar/${baz}", resourceReference); getSharedResources().add("globalRSSProducer", resourceReference.getResource()); }
From source file:org.yes.cart.web.theme.impl.WicketResourceMounterImpl.java
License:Apache License
/** {@inheritDoc} */ @Override/* w ww . j a v a 2s . c o m*/ public void mountResources(final WebApplication webApplication) { webApplication.mountResource("/sitemap.xml", new ResourceReference("sitemap.xml") { @Override public IResource getResource() { return sitemapXml; } }); webApplication.mountResource("/orderreceipt.pdf", new ResourceReference("orderreceipt.pdf") { @Override public IResource getResource() { return orderPdf; } }); }