Dojo File Caching in Worklight - caching

When using Dojo file caching with Worklight receiving a 404 Error when running in Simulator. It appears the file being loaded is not being copied from the common area to the device. Is there something else I need to define in my project to make that happen? There must be a convention and I wanted to follow it going forward as I expect to have more template files in the project.
My define statement in a .js file:
define(["dojo/_base/lang", "dijit/layout/ContentPane", "dojo/dom", "dojo/text!./templates/Order.html"], function(lang, ContentPane, dom, template){
...
var cp1 = new ContentPane({
title:"Order",
content: lang.replace(template, someJson)
}).placeAt("temp");
My folder structure:
In the common/js directory I have the above code in a .js file and I have a templates folder to keep the Order.html and I would expect to have other template files stored there in the future.
Error on the console:
GET http://localhost:10080/DojoProject/apps/services/preview/DojoApp/windowsphone8/1.0/default/layers/templates/Order.html 404 (Not Found)

It seems that the way you are specifying the path, browser tries to find the file in the "layers" folder which is sibling to "templates".
Have you tried to modify the "dojo/text!./templates/Order.html" to something like: "dojo/text!./../templates/Order.html" to navigate one level up, then go into the templates folder?
I'm not sure this will work, but I think it worths a try.

Related

Coldfusion 10 AJAX replace content in cfdiv

I have an href that throws an error when trying to replace the contents of its parent cfdiv.
In the efforts to keep this short, the link looks something like this:
<cfdiv id="managerDiv">
<a href="javascript:ColdFusion.navigate('theURL?theVariables','managerDiv');" >add a new thing</a>
</cfdiv>
The error that I'm getting is a dialog box that indicates the following:
Error retrieving markup for element managerDiv : /manager/CFIDE/administrator/templates/errors.jsp [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
A few things to note:
On my Coldfusion 10 development environment, I have no problems. This error only occurs on my hosting server.
The directory structure of both my hosting and development environments is EXACTLY the same
I do NOT have a pointer or mapping to "errors.jsp" anywhere in my source code or Coldfusion settings.
manager is a sub-directory at the root level
"theURL" is any coldfusion file, I have tried with a simple blank.cfm file, and it still passes the same error
Thoughts
Obviously, it seems like Coldfusion is looking for a file that doesn't exist to replace the contents of the cfdiv. However, I really have no idea why it is looking for something other than the contents of "theURL", and why it is looking for it in the directory specified in the error (manager/CFIDE/...)
I did some more testing.
It appears that the coldfusion.navigate URL parameter does not like the relative path (again, it works fine on my dev environment, but not on production).
For example, this works:
<a href='javascript.Coldfusion.navigate('test.cfm');'>
but this does NOT:
<a href='javascript.Coldfusion.navigate('folder/test.cfm');'>
thoughts?
All:
It appears that I should have been more specific, as this is a very targeted answer.
The file that I was attempting to load was coming from a directory that I had named "manager". After some testing, it appears that the name "manager" is the issue. We renamed the directory, and the problem was solved.
In other words, here was my link (I omitted the names, because I thought them irrelevant initially, but here is the actual link):
<a href='javascript.Coldfusion.navigate('manager/test.cfm');'>
I was forwarded this page by the support team, which seems to reinforce this point:
http://www.giancarlogomez.com/2012/06/directory-of-manager-in-webroot-not.html
Bottom line, don't name a directory in your root folder "manager". Coldfusion/TomCat reserves that name (at least at the root level).
I'm not sure why they did this (given the occassional use of the word "Manager" as an admin role, and therefore, a common trend to have a directory for this role), but oh well :)

Ajax request to xml file outside of TideSDK application

I have a TideSDK application that will be in the same folder as another folder with an xml file and some images and videos in it.
[my application]
-> application.app
-> [data]
-> data.xml
-> image.jpg
Now I need to get the data in the xml file and also urls/filepath to the images/videos
Is this possible?
The application is working online without TideSDK by getting the data with ajax, so I'm trying to do it the same way here, but just changing the filepath to the xml.
I have tried to do this by hardcoding it, and using Ti.Filesystem.getFile(), but the result is always the same: pathToTheApplication/application.app/Contents/Resources/pathToTheApplication/data/data.xml.
So as you can see the second part of the url is correct, but it always starts from the Resources folder.
Is there any way to solve this?
You should be able to use getFile(). Are you making sure you are passing an absolute path to the file as opposed to a relative path?

What is the best way to let access to physical files in ASP.NET MVC3

I did not find which is the best following to serve physical files to the users in a MVC3 app.
For example if I want to put my site in search engines, they ask me to place an xml file in the site root.
This file can not be accessed because I think the routing does not "catch" the url...
Thanks¡¡
You should be able to ignore route:
routes.IgnoreRoute("/filename.xml");
Or:
routes.IgnoreRoute("filename.xml");
And that should be done in Global.asax file and RegisterRoutes() function
did you try opening the file through your web browser?
if you tried and it didn't open then you can do the following
in global.asax
write the following
C#
routes.IgnoreRoute("{xml}", new { xml = #"(.)?abc.xml" }); where abc is the file name or you can but * instead of abc to ignore all xml files
You can just set the permissions on the file system with a chmod (700) or equivalent. Usually this is where the protections come in.

Changing static files directory in MVC3 causes 404

I'm attempting to set up my own directory structure for serving up static files:
\s (statics)
\c (css)
\j (js)
\i (images)
etc ...
The issue is that I'm seeing a 404 for this directory when referencing it. When I inspect the file path, it is pointing to the correct location localhost:port/s/c/style.css, but for some reason it can't find the file.
Is there a way that I can make this path available via my Web.config, or possibly through my Global.asax file via routes? I've heard there are performance penalties associated with using routes, so using the Web.config - or an alternative solution - is preferred.
http://localhost:port/s/c/style.css should work without any problems. It seems that you have specified a wrong filename which is the reason for the 404 error.

file/page not found when uploaded online

I am working on a new module of existing live project. It is a website developed in PHP Zend Framework. New module is on admin side. It runs properly on my localhost/virtualhost.
When I uploaded it online with correct directory path it is found that one file is not found.
It is called like
www.example.com/admin/controllerName/actionName
All the actions works except one action that doesn't display anything and returns exception error mentioning that page or file not found.
What could be the issue? I have checked folders. If one action for the same controller works than why doesn't other. Both have their .phtml files in View section.
Help would be appreciated.
Would I be right if I guessed your local development environment was Windows?
It's probably a filename case sensitivity issue.
Assuming your request looks like
www.example.com/admin/fusionmaps/newpage
I'm not sure how you've setup your modules but if it's reasonably standard, you should have something like this (note the upper and lowercase characters)
application/modules/admin/controllers/FusionmapsController.php
The controller classname should be Admin_FusionmapsController with action public function newpageAction()
The view script should be at
application/modules/admin/views/scripts/fusionmaps/newpage.phtml

Resources