Virtual Directories not working in ColdFusion Builder 2016 - apache

I'm trying to set up virtual directories through the built-in Apache Tomcat 8 server using the ColdFusion Builder 2016 interface, however to my surprise this simply does not work, yet according to the documentation it should.
The only thing that I've modified was the web root directly in the server.xml file.
That said the website runs correctly, except when trying to reference a resource from a virtual directory which simply returns HTTP Status 404.
Web Structure
ColdFusion Builder Interface
The process when using the interface is as simple as:
Creating a virtual host;
Clicking the "Virtual Directory" button and setting up the directories; and
Applying the changes and restart the local server.
Ultimately this should allow me to navigate to the files (CSS, JS, Images) directly through the web browser.
Could I be missing a specific setting in a configuration file due to manually changing the web root? If not what am I missing?

Related

Virtual Directory to navigate to http://localhost/MyWebsite instead of http://localhost:8080

I have deployed an ASP.NET MVC 4 application to a new site I have created in IIS 7.5, which I have bound to port 8080. I can reach it by navigating to http://localhost:8080, but I want to reach it via http://localhost/MyWebsite.
I have added a Virtual Directory under my website, which points to "C:\inetput\wwwroot\MyWebsite\". However, when I navigate to http://localhost/MyWebsite, I am presented with a configuration error:
"It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS."
Here is what my IIS hierarchy looks like (this is a demo since I have no internet access on the server I am working on).
I have two questions:
Why am I getting this error?
Is this the best way to go about achieving what I want? It seems messy to have the list of files and folders underneath the website and then again underneath the Virtual Directory. If there is better practice then please tell!
Virtual Directories cannot execute scripts, reason why you are getting that error. You need to make your MyWebsite folder an Application. Also, you don't necessarily have to create a separate website for your website, you can use the Default Web Site and create an application MyWebsite in there (it might be less confusing maybe?).

Intellij idea opens static pages in browser with different url formats

Intellij idea has a nice "open in browser feature" that I use quite often for my static html files. Any html file can be opened in browser in two ways: 1. Idea has an internal web server that serves static content at http://localhost:63342/<relative path to content> . 2. Via file:///<absolute path> url.
After a recent update (14.0.2) the browser started to open pages as file:///<absolute path> although the internal web server is still present and all I need to do is edit the url. Very annoying. I searched a lot but still can't figure out how can I influence this behaviour so all my static pages would open in browser as http://localhost:63342/<relative path to content>
Specify the server connection settings:
In the Host text box, type localhost.
Use the Port spin box to specify the number of the port where the built-in web server runs. The port number should be set to 1024 or higher. By default this port is set to the default IntelliJ IDEA port through which IntelliJ IDEA accepts connections from services (63342).
Specify the folder that will be considered server document root. The folders that are under this document root in the project tree will be submitted to the PHP interpreter. The server document root folder will be accessed through HTTP at the above specified host:port.
In the Document root text box, specify the path to the relevant folder. This can be the project root or any other folder under it.
References
Idea Docs: Built-in Web Server

Accessing Local Media File to Play in FlowPLayer

I want to access local media file say .mp4 file to play in FlowPLayer on Firefox browser..
My application is based on JSF and RF3.3 with JBoss server.
Problem is in my backing bean say I have written a file name as test.mp4 and the same is being present in WEB-INF folder..FlowPlayer will access this file using:-
http://IP/ContextPath/WEB-INF/test.mp4
But now say suppose I have a file placed in my D: drive on my system. The local server is running on my system.I want to access the file kept in D: drive and play it in flowplayer...
FlowPlayer always append http://IP/ to the file name and as such it won't play the media file..
Is there any way out to allow flow player to access local file on the system...
I figured that it can be done using Apache...But how/??...
The component accepts a URL that must be accessible from the client browser, thus a url like file:///C:/resources/foo.mp4 would not work. The resource file you are trying to reference must be accessible from a web context. That is not to say that you can't store the file resources on the D: of your machine, but you would need a web server like Apache to access that folder location as a web context folder. It can be configured to do this, but I will not go into the details of how to do this, if you have trouble with that then you should post a question to the ServerFault StackExchange site for help with this.
One thing to keep in mind is that your web application is likely configured that any resources within the WEB-INF folder of your project is likely set to be the context path of your application. Thus if you you were to place your MP4 file in your web app (i advice against it, those files are enormous), then it would be accessible from http://site:port/applicationcontext/resources/foo.mp4 but on disk it is WEB-INF/resources/foo.mp4.
The best way that I set this up is to set up an Apache front end that is listening for web traffic on the specific port, then using the mod_jk module you can have Apache forward requests for resources at http://site:port/applicationcontext/ to your application server on the AJP port. I like this setup because I can keep large static resources at the ROOT context of the web server, as well as protect my application server by keeping it completely behind a firewall and inaccessible from the outside. The application server can only be accessed through the Apache web server meaning increased security. For more information on this type of setup, see this example guide on how to setup Apache Web Connector with Tomcat. http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html

Need to access remote files from Apache server

I am new to Apache.
I am running apache tomcat in windows and using JSP as the server side language.
I have a page containing links to the files (different machine) as below:
TheButterflyEffec(2004).avi
Superbad.avi
Why OnClick, saveAs is not working?
It is working if i save the page locally.
Do I need to configure anything in server.xml?
If the files are loaded on the machine running the apache then you need to look of two thinghs...
Put the files in a directory inside the apache root directory
In the <a href specify the file location with the ip address of it
(i.e. if your apache is on a machine with IP 192.XXX.XXX.XX then give the a href as follows
<
a
href='http://192.XXX.XXX.XX/folderWherefilesare/filename'>
filename < / a>
It's not working because the browser look for those files on the local visitor machine, not on the server.
You have to build "proxy" code with server side language like PHP that will get file name as parameter, e.g. Download.php?file=TheButterflyEffec(2004).avi then read the file from the server disk and send the file contents to the browser.
If you're using PHP indeed, here is an article describing what you can do:
http://www.boutell.com/newfaq/creating/forcedownload.html
Otherwise let us know what server side language you can use and retag your question according to this.

Link to file outside context root of weblogic

If I want to display an image in my webpage and its src is a file outside context root.
At the IDE, the image is shown to be loaded.
But when I test the web page, nothing displayed.
How can I config weblogic server to allow the image to be displayed. If not is there anyway to run around this problem.
Thanks a lot.
You can use the Virtual Directory Mapping feature (that you declare in the weblogic.xml):
Using the virtual directory mapping
feature, you can create one directory
to serve static files such as images
for multiple Web Applications. For
example, you would create a mapping
similar to the folowing:
<virtual-directory-mapping>
<local-path>c:/usr/gifs</local-path>
<url-pattern>/images/*</url-pattern>
</virtual-directory-mapping>
A request to
http://localhost:7001/mywebapp/images/test.gif
will cause your WebLogic Server
implementation to look for the
requested image at:
c:/usr/gifs/images/*.
This directory must be located in the
relative uri, such as
"/images/test.gif".