<form:form method="POST" action="/<projectname>/escSave.html"> - url-pattern

how action URL can be constructed dynamically. I have above URL in JSP and it is working fine in the local system.
http://localhost:8080/<projectname>/escSave.html
what needs to be added to work in all environment.
/server-dev.domain.com/<projectname>/escSave.html
Help me understand to fix.

if escSave.html is in the root directory of the webpage it should be
<form:form method=“POST” action=“/escSave.html”>
relative to the current script:
<form:form method=“POST” action=“escSave.html”>

Related

Joomla Multilanguage: Images not be load

I set up my Joomla 3.x on a apache2 server. The files are located in the root folder of the apache(/var/www). Everything works fine, but know since i set up it with multilanguage support some of the images can't be load.
An url example of my page: http://www.example.com/en/widgetkit/slideshow
For example the button.png from the Widgetkit Slideshow:
Some of the images are defined in the slideshow itself(something like images/widgetkit/..../img.png). Joomla loads the image only when i change it to /images/widgetkit/..../img.png. That is because i pointed to the root of my apache.
My question now, is there a better solution to solve this problem, then put in all imagelinks(maybe files too) the / before?
Note: Some few images were load, but some not.
try to use "base href" in the head section in the file index.php in the template directory
<base href="http://www.example.com">

Can't display a pdf file in my jsf2 application

I try to display a pdf file on my jsf2 application and the problem is in the path file.
My pdf file is inside a folder named FichesPratiques which is inside another folder named resources (folder resources is inside WebContent) and I use this to display it :
<p:media value="/resources/FichesPratiques/file.pdf" width="100%" height="300px">
but anything is displayed.
and more strange, when I use link below to download it, it doesn't work.
<h:outputLink value="/resources/FichesPratiques/file.pdf">click</h:outputLink> to download pdf instead.
Can someone help me ?
Look closer at the URL generated in the HTML output of those components (rightclick, View Source in webbrowser). In contrary to among others the <h:graphicImage value>, the <p:media value> and <h:outputLink value> do not prepend the web application context path in the URL. The leading / in the URL makes it relative to the domain root of the request URL (the one as you see in browser's address bar).
Imagine that the JSF page is been opened by
http://localhost:8080/somecontext/page.xhtml
Then those value="/resources/FichesPratiques/file.pdf" paths would expect the resource to be present in
http://localhost:8080/resources/FichesPratiques/file.pdf
However, you actually have it in
http://localhost:8080/somecontext/resources/FichesPratiques/file.pdf
You should either be using a valid URL relative to the current request URL,
<p:media value="resources/FichesPratiques/file.pdf" ... />
or explicitly specify the context path in the URL,
<p:media value="#{request.contextPath}/resources/FichesPratiques/file.pdf" ... />

URL Rewrite for relative URLs on localhost

I just moved my website to a folder (called test) inside the root of my Apache web server and now I am getting 404 errors while the page tries to fetch different resources.
When I looked at the urls - they seem to be pointing to the root of server as they are root relative URLs (as opposed to be pointing to the folder [test] inside the root).
For example: when the index page of my site has a reference to an image like
<img src="/images/img-1.jpg" alt="Image 1" />
The page when executed, tries to fetch the image from the following url
http://localhost/slider-images/img-1.jpg
instead of accessing the image from the url
http://localhost/slider-images/test/img-1.jpg
I have been trying various options like having a ReWriteBase etc, but that doesn't seem to be working!
What works instead is me changing the resource path to be an absolute one, but that is just too much of work for me to do for all the resources!
<img src="./images/img-1.jpg" alt="Image 1" />
Any help is much appreciated.
Thanks
Update
A similiar question has been posted earlier, but I don't a response that solved the issue
Converting relative URL requests to absolute URL request using mod_rewrite
After hours of troubleshooting, I did a workaround which can be used a temp fix.
Posting it here to help those who possibly could be having the same problem.
Simply changed the DocumentRoot in httpd.conf file to point to the sub-directory where I had moved my website files for testing.
Hope this helps those who can make use it this fix.
I would still be really interested to know of a way to address the root-relative URL rewrites via htaccess and hopefully someone here would be able to help.
Thanks!

WebLogic Virtual Directory Mapping Not Working

I am having a frustrating problem with virtual directory mapping in my very simple WebLogic 11g application. I installed WebLogic 11g OEPE, which installs WebLogic Server 10.35. I believe that this is installed correctly, because I am able to deploy a much more complicated application that is working fine...except for my issue with virtual directory mapping.
I want to access files from a directory outside of the web application, H:\Backup.
Here is my entire application, and these are my exact files.
wl_test/index.html
<html>
<head><title>WebLogic Test</title></head>
<body>
<h1>This is another new test<br>
</body>
</html>
wl_test/WEB-INF/web.xml
<web-app>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
wl_test/WEB-INF/weblogic.xml
<weblogic-web-app>
<virtual-directory-mapping>
<local-path>H:/Backup/</local-path>
<url-pattern>/files/*</url-pattern>
<url-pattern>*.txt</url-pattern>
</virtual-directory-mapping>
</weblogic-web-app>
When I access the HTML file, 'http://localhost:7002/wl_test/index.html', it loads perfectly fine.
However when I attempt to load either of the following two URLs, they both fail with a HTTP 404 error. And yes, both of those files, one.ini and asdf.txt exist in the H:\Backup directory.
'http://localhost:7002/wl_test/files/one.ini'
'http://localhost:7002/wl_test/asdf.txt'
What could be wrong with this trivial setup?
I'm beginning to think I don't understand how this is supposed to work.
I think I understand what has changed and how to fix everything.
There were two problems with the virtual directory mapping.
First, the local-path cannot be a MS-DOS SUBSTed drive. I don't understand why, but WebLogic doesn't like it.
Second, when the url-pattern contains a folder, like /files/*, that folder must exist in the local-path directory.
Both of these are allowed in the JRun server that this is being ported from.
Sigh,
Randy Stegbauer
I think there is something a little goofy about the combination of multiple url-pattern elements. Here's a sample showing the shared 404 file from my archives.
Part of the NotFoundWeb.war/WEB-INF/web.xml looks like this:
<error-page>
<error-code>404</error-code>
<location>/error/404.html</location>
</error-page>
Part of the NotFoundWeb.war/WEB-INF/weblogic.xml looks like this:
<wls:virtual-directory-mapping>
<wls:local-path>d:\temp\notfound</wls:local-path>
<wls:url-pattern>*.html</wls:url-pattern>
</wls:virtual-directory-mapping>
I have a file on the file system:
d:\temp\notfound\error\404.html
So at runtime when I type something like:
http://localhost:7001/NotFoundWeb/somebadurl
I get the error page from the file system.
The generatedReports and /app/reports are local folders in the file system. This way, you can put any type of files inside the generated Reports folder:
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
<weblogic-web-app>
<container-descriptor>
<index-directory-enabled>true</index-directory-enabled>
</container-descriptor>
<virtual-directory-mapping>
<local-path>/app/reports</local-path>
<url-pattern>/generatedReports/*</url-pattern>
</virtual-directory-mapping>
</weblogic-web-app>

How to use relative URL's in website with two base URL's

I have our basic corporate static html website installed in our web root directory and our billing software installed in /portal. I have integrated the websites to look like a single site by including the /menu.tpl smarty template file in the /portal/header.tpl file. However, if I use relative URL's, the menu sysem doesnt work as the base url for the billing script is /portal. i.e. if I create a link to faq.php in the menu.tpl and I load a page on the portal site, the link in the menu back to the faq page is now /portal/faq.php whereby if I load a page off the root site the link is just /faq.php as it should be.
The obvious answer is to just use absolute URL's, but I need the site to be portable as I have many developers who need to install and test it.
I cant find anyway to resolve this. Any ideas?
I ran into the same problem as you a while ago, and after trying a lot of dead ends, I finally ended up with the following solution:
For any URL you need to be a chamelion, i.e. change its path depending on the environment, insert a PHP function that writes out the correct URL.
If you include the PHP function from a single central file, then you can change all of the URL's in the entire site automatically, based on a setting, or some pre-detected switch such as the current domain name, etc.
Example:
<?php print_base_url_plus("/menu.php"); ?>
... where print_base_url_plus() is a function which appends the base URL onto the output.
You may find that you have to change some of the URL's to be php, so they are preprocessed by the PHP engine, or, you can alter the web settings so that standard .htm files are piped through the PHP engine, just like .php files.