I want to display image stored in Openshift server using img tag. Now, I have created a folder in $OPENSHIFT_DATA_DIR in the server. After going into the directory, I pwd to get the complete path :
/var/lib/openshift/52002234335h7b0000163/app-root/data/pamphlets
So, I specified the path in img tag as
<img src="/var/lib/openshift/52002234335h7b0000163/approot/data/pamphlets/1.png" class="map" alt="Image Not Available"
I even tried out
file:///var/lib/openshift/52002234335h7b0000163/app-root/data/pamphlets/1.png
but nothing is working. Can anyone point me out what is the mistake I am making?
I asume you are developing a web application. In that case you are missing the fact that you should use the path defined on the web server's DocumentRoot. Then you should use that as the root for your web-accessible files. So, for instance /pamphlets/ will be the path if your webserver's documentRoot points to $OPENSHIFT_DATA_DIR. If you are using one of the preloaded cartridges make sure that happens first.
Replace your code:
<img src="/var/lib/openshift/52002234335h7b0000163/approot/data/pamphlets/1.png" class="map" alt="Image Not Available" />
To:
<img src="/pamphlets/1.png" class="map" alt="Image Not Available" />
You don't need $OPENSHIFT_DATA_DIR => /var/lib/openshift/52002234335h7b0000163/approot/data/
I have never used jboss before but the basic method is saving your files in your project folder and then symlink to the Openshift data directory.
Related
I'm new to alfresco and using Alfresco 6. I am trying to override colleagues.get.html.ftl file so I can change the display of Site members dashlet. Original ftl has the following code snippet:
<div class="person">
<#-- LIST - ITEM - PERSON -->
<#markup id="list-item-person">
<h3>${m.authority.firstName?html} <#if m.authority.lastName??>${m.authority.lastName?html}</#if>
</h3>
</#markup>
<#-- LIST - ITEM - ROLE -->
<#markup id="list-item-role">
<div>${msg("role." + m.role)}</div>
</#markup>
</div>
Instead of firstName and lastName I just want to display the userName.
Here's what I have done.
I have copied the original code to a file named colleagues.get.html.ftl
I have modified the html.
I was assuming this would override the original file. However my changes are not getting reflected when I restart server. How to correct this?
First, I'll assume you are using the Docker- and Maven-based Alfresco SDK 4.0.0. It makes doing this kind of customization much more productive.
The goal is to customize an out-of-the-box web script template and keep it in your own path to avoid problems when upgrading later. To do that, copy the colleagues.get.html.ftl into your project, in a path that you choose. For example, in my project I'll use alfresco-share-example-share/src/main/resources/alfresco/web-extension/site-webscripts/com/metaversant/alfresco/dashlets/colleagues.get.html.ftl.
Next, you need to tell Share that you are overriding the template and where to find yours. You do that by creating a Share extension file. I'll name mine colleague-example.xml and place it in alfresco-share-example-share/src/main/resources/alfresco/web-extension/site-data/extensions/colleague-example.xml with the following content:
<extension>
<modules>
<module>
<id>Colleague Example</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<customizations>
<customization>
<targetPackageRoot>org.alfresco.components.dashlets</targetPackageRoot>
<sourcePackageRoot>com.metaversant.alfresco.dashlets</sourcePackageRoot>
</customization>
</customizations>
</module>
</modules>
</extension>
Finally, edit your version of the template. We're going to tell Alfresco to replace the #markup with an id of "html" with ours. So change:
<#markup id="html">
to:
<#markup id="html" target="html" action="replace" scope="global">
Next, you want to replace first name and last name with just the username, so change:
<h3>${m.authority.firstName?html} <#if m.authority.lastName??>${m.authority.lastName?html}</#if></h3>
to:
<h3>${m.authority.userName?html}</h3>
Now run the project with ./run.sh build_start. Your Docker images will fire up and you'll see that the Site Members dashlet uses username instead of first name and last name.
If you need to tweak it, make a change, then run ./run.sh reload_share to build and restart just the Share container.
When you are ready to deploy, run mvn install to create a Share AMP you can deploy on your server.
I use Silex-Skeleton. Twig layout is present in templates directory (templates/layout.html). I store images in web/img directory (top.jpg). I also use built-in php5.4 server running:
php -S localhost:8000 web/index_dev.php
In templates/layout.html I'd like to use web/img/top.jpg picture. So I put there:
<img src="{{ app.request.basepath }}/img/top.jpg">
But image doesn't show.
I've also tried:
<img src="/img/top.jpg">
<img src="/web/img/top.jpg">
But with no success either.
My controller looks like (index.html extends layout.html):
$app->get('/', function () use ($app) {
return $app['twig']->render('index.html', array());
})->bind('homepage');
What should I do to get images to work?
Can you navigate to http://localhost:8000/web/img/top.jpg or http://localhost:8000/img/top.jpg directly? If you can't browse and see them directly they will not render as the browser will not be able to find them to display on your page either.
Are your images actually in or below the /web folder? (i.e. they should not be in your /templates folder)
Perhaps you could try to set the docroot explicitly sing the -t option when you launch the PHP webserver.
Otherwise I would suggest setting up a real web server like Apache. Your OS may already have this installed if you are running OS X or *nix.
Hi I am following a online class and trying to download the rda dataset provided by the prof.
I tried to run exactly the same command as provided in the class:
download.file("https://dl.dropbox.com/u/7710864/courseraPublic/samsungData.rda", destfile="./samsungData.rda", method="curl")
load('./samsungData.rda')
When I go to the download folder, open the rda file in vi, this is what I see:
<html>
<head><title>Found</title></head>
<body>
<h1>Found</h1>
<p>The resource was found at https://dl.dropboxusercontent.com/u/7710864/courseraPublic/samsungData.rda;
you should be redirected automatically.
<!-- --></p>
<hr noshade>
<div align="right">WSGI Server</div>
</body>
</html>
Clearly there is a redirect here and the download file command did not follow it smartly. When I open up that URL in the browser, it will be successfully redirected.
I took a look at the help manual of download.file there is no such thing as following redirect.
Can anyone show me how to follow the redirect?
Try specifying an extra argument, which will pass command-line arguments to curl:
download.file("https://dl.dropbox.com/u/7710864/courseraPublic/samsungData.rda",
destfile="./samsungData.rda",
method="curl",
extra='-L')
With OpenCms 7.5.3 fresh install:
I create an index.htm page, then export it via webdav to disk. It
creates index.html.xml and __properties/index.html.xml.properties.
Thats ok.
Delete index.html from OpenCms and publish.
Try to import previously exported files via webdav and...
Error 409 conflict when importing __properties/index.html.xml
I tried with 3 different webdav clients, including the Eclipse plugin for webdav.
Also tried with OpenCms 7.5.4 and 8.5.0
Any ideas? Thanks.
It seems to be a known problem by Alkacon (OpenCms developer):
Here is a possible cause:
https://github.com/alkacon/opencms-core/issues/73
("pbeltran" is me there.)
If it helps we did the following on OpenCms 8.5 in order to avoid the error, but sacrificing properties files :(
Just edit WEB-INF/config/opencms-importexport.xml and replace with this:
<repository name="standard" class="org.opencms.repository.CmsRepository">
<params>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperJsp</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperXmlContent</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperXmlPage</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceWrapperSystemFolder</param>
<!--param name="wrapper">org.opencms.file.wrapper.CmsResourceWrapperPropertyFile</param-->
</params>
<filter type="include">
<regex>/</regex>
<!--regex>/__properties/.*</regex-->
<regex>/sites/.*</regex>
<regex>/system/</regex>
<!--regex>/system/__properties/.*</regex-->
<regex>/system/galleries/.*</regex>
<regex>/system/modules/.*</regex>
<!--regex>/system/workplace/.*</regex-->
</filter>
</repository>
Afer that restart your server.
We do regular exports from OpenCms of the modules to keep the whole package (files and properties) in order to keep the solution under control version (SVN). You can create a module with a resource pointing to sites/default to do that. But it's critical to select root site before doing any import/export of that module (if you dont you can break your ocms installation).
Since some months, I'm using the Linux FUSE driver (gentoo's davfs 1.4.7) to mount OpenCms resources. I was quite irritated with the lot of LOG CmsVfsResourceNotFoundException errors, so I ended up removing the __properties dirs from the exported Repository.
If you don't need these __properties files, I'll recommend you to ignore that error and remove the files from the repository as per the instructions in the link.
The corresponding fstab entry:
# WebDAV (opencms)
# http://myserver:8080/opencms/webdav /home/alberto/mnt/myserver-opencms-dav davfs rw,user,noauto 0 0
I have never had Eclipse with webdav up and running, but I successfully use OpenCms 7.5 and 8 daily with webdav:// and webdavs:// from KDE's Kate editor. Maybe give it a try.
In case you want to try, here the URL you need to use to browse the VFS:
webdav(s)://server(:port)/webdav
I've got very simple .WAR containing example servlet. I'm able to deploy it in servicemix using the following command:
osgi:install file:///home/seiho/apache-servicemix-4.4.2/deploy/TestServlet.war?Bundle-SymbolicName=TestServlet&Webapp-Context=/TestServlet
And then see it in my browser. But only with full path to a file, e.g.: localhost:8080/TestServlet/index.html or localhost:8080/TestServlet/TestServlet (my servlet is TestServlet class).
I'd like to launch the index.html page automatically after entering: localhost:8080/TestServlet
how to do it?
MORE IMPORTANT
I need a way to convert the .WAR file or servlet project (I've got the sources) so that new .WAR file can be auto-deployed by copying it to $SERVICEMIX_HOME/deploy directory.
I've tried editing the MANIFEST.MF file, but with no success. Probably I'm doing something wrong.
Thanks for any advice/help.
To be recognised as a wab, you need to add a context path header to your manifest:
Web-ContextPath: TestServlet
It's working now! I was doing my MANIFEST.MF according to this page: http://team.ops4j.org/wiki/display/ops4j/Pax+Web+Extender+-+War+-+OSGi-fy
The problem was that for some reason "Bundle-Version: 1.0" line was required as opposed to optional as stated on that page.
Honestly, just adding the Bundle-Version fix-it.
I knew it was something wrong with the MANIFEST.MF and after Holly Cummins' question I played with it a bit more. Thanks Holly.
I still can't do anything with the manual site launching (have to manually enter the index.html).
http://localhost:8080/TestServlet/ gives me this:
HTTP ERROR 404
Problem accessing /TestServlet/. Reason:
Not Found
Powered by Jetty://
http://localhost:8080/TestServlet/index.html gives me proper site.