I am a bit confused about how to deal with html and images on Google App Engine:
I am displaying a simple website on my naked domain (example.com), which is hosted on my Google App Engine directly in the war directory. This is working fine.
I have also built an API which I host on Google App Engine, and is available on example.com/api/v1/. Now, I am building a functionality in which a new user is being created and a registration confirmation mail is sent to the new user.
This email is a plain HTML page, which I load from war/WEB-INF/mail/register.html, because I do not seem to be able to get it from the war directory. In this HTML I just refer to an image with <img src="images/image.png" />, assuming GAE will search for it in /war/WEB-INF/mail/images/image.png, but this is not working. The image is never found.
I also looked at <static-files>, which needs to be placed in the app engine-web.xml, but I am a bit confused which home directory is used in this.
My question is: Can anyone explain how App Engine handles html and images in the war and WEB-INF directories?
Any help is greatly appreciated!
Note: My homepage is just working fine, so these images and css files work without any editing in the appengine-web.xml.
Note: I am using Java.
If this html is for an email, the image paths need to be the full url and not relative to the html file. For example, use:
<img src="http://example.com/images/image.png"/>
Also, images cannot be served if they are under the WEB-INF directory. Create a static directory to serve the images from.
Related
I have written a Windows Java app (using NetBeans) that (a) uploads pdf files using FTP to my WordPress website, and (b) generates emails with embedded links to the various pdf files. E.g., the email recipients might get a email containing:
"...Here are PDF files containing the Placards. There's a separate PDF file for each Division for convenient printing on paper of different colors.:
To view Championship and Special Click on View"
where View is a hyperlink to the pdf previously uploaded to the website.
The app worked perfectly for several years and then I changed my hosting service to SiteGround. Now the hyperlinks bring up Page not found (404), even though FileZilla shows the uploaded files exactly where the hyperlinks indicates they should be.
SiteGround tech support told me to put the files below public_html, e.g. /concoursbuilder.us/public_html/JOCLA/MovieStars/Placards
This did not help.
I figure it must be a Java programming error because obviously FileZilla knows how to do it. Naturally, SiteGround is reluctant (unwilling?) to get into my Java programming issues. I'm at my wits end.
Any suggestions?
The problem is solved, thanks to answers to basically the same question, https://stackoverflow.com/questions/46417961
In a nutshell, it's a matter of FTP uploading to public_html at the site so that it is at the same level as the site. See the FileZilla structure shown below. You FTP upload is uploaded to public_html. And here's the punchline: The URL for public access is the same as used for FTP upload* but with out public_html*.
How to make images slider (carousel) in Java Spring MVC.
I have admin panel which upload the images to local drive.
I would like to display images from local drive to JSP page in carousel.
Please guide.
Also I tried one example from the link https://blog.e-zest.com/dynamic-carousel-built-using-javascript/ but I am getting javascript error.
Thanks,
Bhavin
First you need to be able to serve your files to web browser. You can serve files from local drive using tomcat or web server (nginx, Apache httpd etc) built-in features without writing Java code or write a Spring controller to read files form drive and serve them if you need custom logic.
Then you could use one of javascript carousel plugins like Slick or another - there is a great choice of those.
Add needed scripts and css to your page and follow selected plugin instructions to create needed HTML with your JSP page.
I'm working with something called JasperReports, and in my servlet, there's this piece of code:
JasperExportManager.exportReportToHtmlFile(jasperprintobject,"C:\\Users\\user\\Desktop\\reports\\myreport.html");
This creates an html file called myreport.html in the reports folder on my desktop, and it also creates a folder called myreport.html_files containing images that myreport.html points to, also inside the reports folder.
I would like to serve this content to the user.
Unfortunately, it seems that the exportReportToHtmlFile method won't let me put the html file inside WEB-INF.
If I could, I would just do:
request.getRequestDispatcher("/WEB-INF/myreport.html").forward(request,response);
I'm thinking about creating a jsp page that can somehow include the html file inside it and forwarding the user to the jsp page, but I'm not sure how to do this.
This is a dynamic web project in eclipse and I'm using tomcat 8.5
Does anybody have any ideas?
Thanks.
I have developed a jsp page which is running perfectly in my system. But when I access this URL from another system in the same network some features are not available. Precisely, I have an SVG image which should be displayed and some other information along with it, which is coming from a hardware.
When I try to access from other systems this SVG is not displaying. But other information is correct. I cant find any error in my web console or eclipse console. What could be the reason?
Without seeing any of the code or your project structure. This sounds like a url problem. Sometimes relative urls to certain resources will not load if they are not in the correct directory. For example..
Imagine on your jsp page your svg image is at
/images/image.svg
Well this resource will not be accessible if the URL is pointing at /users/profiles/feed/
What you have to do in these cases is make sure that all your resources are absolute urls, or jump back directories like so:
../images/image.svg
or if you're up 2 directories
../../images/image.svg
I've downloaded the google plugin for eclipse, along with the necessary app engine stuff. Now the question is, is it possible to host a pre-made applet using google app engine, and if so, how?
An applet is just a jar or a series of jars that must be downloaded by the browser. Put the jar(s) in your web archive just as you would put a HTML, CSS, image or JS file, and include the markup for the applet in the appropriate page.
See http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/using_tags.html for details.