List of usage examples for org.apache.wicket.request.resource ResourceReference ResourceReference
public ResourceReference(String name)
From source file:com.userweave.application.UserWeaveApplication.java
License:Open Source License
private void mountImageResource() { ResourceReference imgRef = new ResourceReference(ImageResource.IMAGE_RESOURCE) { private static final long serialVersionUID = 1L; ImageResource resource = new ImageResource(); @Override/* w w w . j ava 2 s . c o m*/ public IResource getResource() { return resource; } }; mountResource("images", imgRef); // getSharedResources().add(ImageResource.IMAGE_RESOURCE, new ImageResource()); // // final String key = ImageResource.getResourceReference().getSharedResourceKey(); // mount(new IndexedSharedResourceCodingStrategy("images", key)); }
From source file:de.inren.frontend.health.backup.BackupRestorePanel.java
License:Apache License
private Component getMyBackupLink(String id) { Calendar cal = Calendar.getInstance(); final String key = "HealthBackup_" + getUser().getUsername() + "_" + cal.getTime().toString() + ".xml"; ResourceReference rr = new ResourceReference(key) { @Override/*ww w.j a va 2s .c o m*/ public IResource getResource() { return new ByteArrayResource("text/xml") { @Override protected byte[] getData(Attributes attributes) { try { String xml = healthXmlBackupRestoreService.dumpDbToXml(getUser().getUsername()); return xml.getBytes("UTF-8"); } catch (Exception e) { log.error(e.getMessage(), e); throw new RuntimeException(e.getMessage()); } } }; } }; return new ResourceLink(id, rr); }
From source file:de.inren.frontend.health.backup.BackupRestorePanel.java
License:Apache License
private Component getAllBackupLink(String id) { Calendar cal = Calendar.getInstance(); final String key = "HealthBackup_AllUser" + "_" + cal.getTime().toString() + ".xml"; ResourceReference rr = new ResourceReference(key) { @Override/*www . java 2 s.co m*/ public IResource getResource() { return new ByteArrayResource("text/xml") { @Override protected byte[] getData(Attributes attributes) { try { String xml = healthXmlBackupRestoreService.dumpDbToXml(); return xml.getBytes("UTF-8"); } catch (Exception e) { log.error(e.getMessage(), e); throw new RuntimeException(e.getMessage()); } } }; } }; return new ResourceLink(id, rr); }
From source file:de.inren.frontend.storehouse.picture.PictureResource.java
License:Apache License
public static ResourceReference asReference() { return new ResourceReference("pictureResource") { @Override/*ww w . j a v a 2s .co m*/ public IResource getResource() { return new PictureResource(); } }; }
From source file:drat.proteus.WicketApplication.java
License:Apache License
/** * @see org.apache.wicket.Application#init() *//*from w w w . j av a 2s . c om*/ @Override public void init() { super.init(); mountResource("/drat", new ResourceReference("restReference") { DratRestResource resource = new DratRestResource(); @Override public IResource getResource() { return resource; } }); mountResource("/service", new ResourceReference("restReference") { ServicesRestResource resource = new ServicesRestResource(); @Override public IResource getResource() { return resource; } }); mountPage("/workflow", DratWorkflow.class); doImageMounts(getImageFiles(WicketApplication.class.getPackage().getName()), (Class<?>) HomePage.class); }
From source file:eu.uqasar.web.components.resources.UserPictureResource.java
License:Apache License
public static ResourceReference asReference() { return new ResourceReference(UserPictureResource.class.getCanonicalName()) { @Override/*from w w w .ja v a 2s. c om*/ public IResource getResource() { return new UserPictureResource(); } }; }
From source file:net.rrm.ehour.ui.EhourWebApplication.java
License:Open Source License
private void mountResources() { mountResource("/rest/report/detailed", new ResourceReference("restReference") { DetailedReportRESTResource resource = DetailedReportRESTResource$.MODULE$.apply(); @Override/*from w w w . j a v a 2 s . co m*/ public IResource getResource() { return resource; } }); }
From source file:org.apache.isis.extensions.wicket.view.gmap2.collection.locatable.CollectionOfEntitiesAsLocatables.java
License:Apache License
private GMarkerOptions buildMarkerOptions(ObjectAdapter adapter) { final PackageResource imageResource = determineImageResource(adapter); final ResourceReference resourceReference = new ResourceReference(adapter.titleString()) { private static final long serialVersionUID = 1L; // protected PackageResource newResource() { // return imageResource; // } @Override/* www . j av a2 s . c om*/ public IResource getResource() { return imageResource; // throw new UnsupportedOperationException("Not supported yet."); } }; final String urlFor = (String) urlFor(resourceReference); GMarkerOptions notDraggable = new GMarkerOptions(adapter.titleString(), new GIcon(urlFor)).draggable(false); return notDraggable; }
From source file:org.apache.syncope.client.console.SyncopeApplication.java
License:Apache License
@Override protected void init() { super.init(); getComponentInstantiationListeners().add(new SpringComponentInjector(this)); getResourceSettings().setThrowExceptionOnMissingResource(true); getSecuritySettings().setAuthorizationStrategy(new RoleAuthorizationStrategy(this)); getSecuritySettings().setUnauthorizedComponentInstantiationListener(this); getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setCompressWhitespace(true); getRequestCycleListeners().add(new SyncopeRequestCycleListener()); final String activitiModelerDirectory = WebApplicationContextUtils .getWebApplicationContext(WebApplication.get().getServletContext()) .getBean("activitiModelerDirectory", String.class); mountResource("/" + ACTIVITI_MODELER_CONTEXT, new ResourceReference(ACTIVITI_MODELER_CONTEXT) { private static final long serialVersionUID = -128426276529456602L; @Override// ww w . j a va 2 s. c om public IResource getResource() { return new FilesystemResource(ACTIVITI_MODELER_CONTEXT, activitiModelerDirectory); } }); mountResource("/workflowDefGET", new ResourceReference("workflowDefGET") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new WorkflowDefGETResource(); } }); mountResource("/workflowDefPUT", new ResourceReference("workflowDefPUT") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new WorkflowDefPUTResource(); } }); }
From source file:org.apache.syncope.client.console.SyncopeConsoleApplication.java
License:Apache License
@Override protected void init() { super.init(); // read console.properties Properties props = new Properties(); try (InputStream is = getClass().getResourceAsStream("/" + CONSOLE_PROPERTIES)) { props.load(is);/*from ww w . j a v a 2 s .c o m*/ File consoleDir = new File(props.getProperty("console.directory")); if (consoleDir.exists() && consoleDir.canRead() && consoleDir.isDirectory()) { File consoleDirProps = FileUtils.getFile(consoleDir, CONSOLE_PROPERTIES); if (consoleDirProps.exists() && consoleDirProps.canRead() && consoleDirProps.isFile()) { props.clear(); props.load(FileUtils.openInputStream(consoleDirProps)); } } } catch (Exception e) { throw new WicketRuntimeException("Could not read " + CONSOLE_PROPERTIES, e); } version = props.getProperty("version"); Args.notNull(version, "<version> not set"); site = props.getProperty("site"); Args.notNull(site, "<site> not set"); anonymousUser = props.getProperty("anonymousUser"); Args.notNull(anonymousUser, "<anonymousUser> not set"); anonymousKey = props.getProperty("anonymousKey"); Args.notNull(anonymousKey, "<anonymousKey> 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) .setUseCompression(BooleanUtils.toBoolean(useGZIPCompression)); // process page properties pageClasses = new HashMap<>(); populatePageClasses(props); pageClasses = Collections.unmodifiableMap(pageClasses); // Application settings IBootstrapSettings settings = new BootstrapSettings(); // set theme provider settings.setThemeProvider(new SingleThemeProvider(new AdminLTE())); // install application settings Bootstrap.install(this, settings); getResourceSettings().setUseMinifiedResources(true); getResourceSettings().setThrowExceptionOnMissingResource(true); getJavaScriptLibrarySettings().setJQueryReference(new DynamicJQueryResourceReference()); getSecuritySettings().setAuthorizationStrategy(new MetaDataRoleAuthorizationStrategy(this)); ClassPathScanImplementationLookup lookup = (ClassPathScanImplementationLookup) getServletContext() .getAttribute(ConsoleInitializer.CLASSPATH_LOOKUP); for (Class<? extends BasePage> clazz : lookup.getPageClasses()) { MetaDataRoleAuthorizationStrategy.authorize(clazz, SyncopeConsoleSession.AUTHENTICATED); } getMarkupSettings().setStripWicketTags(true); getMarkupSettings().setCompressWhitespace(true); getRequestCycleListeners().add(new SyncopeConsoleRequestCycleListener()); mountPage("/login", getSignInPageClass()); activitiModelerDirectory = props.getProperty("activitiModelerDirectory"); Args.notNull(activitiModelerDirectory, "<activitiModelerDirectory> not set"); try { reconciliationReportKey = props.getProperty("reconciliationReportKey"); } catch (NumberFormatException e) { LOG.error("While parsing reconciliationReportKey", e); } Args.notNull(reconciliationReportKey, "<reconciliationReportKey> not set"); mountResource("/" + ACTIVITI_MODELER_CONTEXT, new ResourceReference(ACTIVITI_MODELER_CONTEXT) { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new FilesystemResource(ACTIVITI_MODELER_CONTEXT, activitiModelerDirectory); } }); mountResource("/workflowDefGET", new ResourceReference("workflowDefGET") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new WorkflowDefGETResource(); } }); mountResource("/workflowDefPUT", new ResourceReference("workflowDefPUT") { private static final long serialVersionUID = -128426276529456602L; @Override public IResource getResource() { return new WorkflowDefPUTResource(); } }); // enable component path if (getDebugSettings().isAjaxDebugModeEnabled()) { getDebugSettings().setComponentPathAttributeName("syncope-path"); } }