uploading files to the folder located outside tomcat server - java

I am developing an application in android which communicates with tomcat to make use of rest api.
I also need to donwload some files to the android application (client) from server. These files are stored in a folder located outside tomcat directory on the server.To dowload the files I'm configuring my tomcat simply using :
<Context docBase="C:\Images" path="/Images" />
I don't think I can make use of servlets to upload download files since my front-end is the android application. Please let me know if anyone has any suggestions.

Related

Url to access azure webservice after deployment

When I access my web service running on tomcat on my local mahine, I can accesss it,say,
http://localhost:8080/UserManagement/something/users
But after I have deployed it to Azure, I am not able to access it if I do,
http://example.azurewebsites.net/UserManagement/something/users
I get resource not found !! Am I making a mistake?
Edit: I created my web service on Eclipse as a dynamic web project and ran it on tomcat. Then I uploaded it successfully on Azure as a web app using Azure plugin for Eclipse.
#Rorschach, According to your web service url, I think you have refered to the article Create a Hello World Web App for Azure in Eclipse deployed your dynamic web project on Azure via publish as Azure Web App in Azure plugin for Eclipse.
To troubleshoot for the webapp, please check whether your project deployment named UserManagement had been deployed at the path site\wwwroot\webapps via Kudu console which can be access via url https://example.scm.azurewebsites.net/DebugConsole.
If the directory UserManagement doesn't exist at the path wwwroot\webapps, I suggest that you can export the project as a war file and deploy it via drag into the webapps path using Kudu console or upload with ftp, then restart the webapp and try to access again.
If the directory webapps doesn't exist at the path wwwroot, I suggest that you can configure the Java web container at the Application Settings tab on Azure portal and re-deploy it.
Hope it helps. Any concern, please feel free to let me know.

Uploading java website made in struts2 using war file

I have made a website in java and struts2 ,now I want to host it live but I am unable to host it. I tried by uploading WAR file and extracting it in cpanel but still not working. I have account on hostbudget.com and I have bought their server.
Can anyone help me how can I upload my Java project since its my first time, I took suggestions from many friends of mine but none of them has clear idea of this.
cpanel doesn't support java by default. It only supports PHP by default.
See this link. How to deploy java web application (WAR) through my GoDaddy's cPanel?
WHM cpanel https://documentation.cpanel.net/display/EA/Introduction+to+Tomcat
Steps to deploy java web application in cpanel:
Select your public_html directory.
Click Upload.
Click Choose File
Browse your WAR file.
Change the file extension from .war to .zip
Select the .zip file and click Extract.
Before that you must install servlets in WHM cpanel. If you need any help to install then the server vendors will guide you.
Some of them told me that enter the following text in .htaccess file inside your public_html directory
SetHandler jakarta-servlet
SetEnv JK_WORKER_NAME ajp13
It's not needed. Since without this my app working.

How to upload a eclipse dynamic web project to a live server?

I have developed a dynamic web project using eclipse and i am having a domain name and a web hoster. all i want to do is to upload my eclipse project to my web hosting site. Currently i am using html 5 template on my website but i want to upload my own project on it. I have heard that we can do it by using war file but i am not sure how to do it as my html 5 template contains many html page like index.html and it is more in size as compare to war file which i have exported. Please tell me i am totally clueless about it
Your web host needs to support Java and some Servlet container. If they don't already have those two things installed, you'll need to install them yourself. Once that is done, in Eclipse, you will need to export your project in the form of a .war file and place it in the appropriate folder of your Servlet Container. For example, with Tomcat, you would place it in its /webapps directory. You then start your Servlet Container. Your web application will be up and running.
If your web project includes Java web technologies such as Servlets and JSP, you will need to
Build your war file first either with Ant, or Maven.
Then you can upload the war file to your web server using some type of deployment tool that is usually available on the hosting web server. For Apache Tomcat for example, you can use the Tomcat Manager tool to deploy your war file.

how to host java website which is developed in red hat 5 using notepad and not using Eclipse or any IDE

During my college time i have developed a java website in red hat 5 ,
On tomcat server with mysql as DB.
I havent use any IDE (Eclipse,NetBeans etc) for it.
I have developed it using notepad.
I have no clue of deploying any java website.
I tried importing my java website in the eclipse but it was giving lots of errors.
If anyone can help me that will be great !!
Please get my project folder on below link:
https://jumpshare.com/b/ppGP9oibkrTvVLtw9YxW
I had this directory in my Tomcat folder.
Please help.
If you just want to run the web app on your local server :
Install Tomacat.
Copy the ty154 folder to the web app folder
Start tomcat. If your code was working, then it will show up at something like the following url
http://localhost:8080/ty154/
If you just want to run the web app on a tomcat hosted server by uploading your web app folder :
Copy the ty154 folder to the web app folder.
Assuming that your hosting url is
http://neer.hosting.com/
then goto the following url
http://neer.hosting.com/ty154/
For some of the hostings you might have to restart your tomcat server.
Deploying using war files :
Also some of the hostings have some special ways to deploy. They might ask you to upload your WAR file. Here are the commands for generating the WAR file.
cd /to/your/folder/location
jar -cvf my_web_app.war *
Mostly uploading the WAR file to the web app folder on the remote hosting should suffice. Only thing is that you might have to restart your tomcat server.
NOTE : Some of the free hosting have their own steps for deployment. Refer to their deployment help documents. It will help you better.

GWT Upload file

I use this http://code.google.com/p/gwtupload/ to upload files to my app. But I have problem when I want save file out of my app in other folder in Tomcat. (for example my app's name is MyApp but I want save files in folder Data on the same Tomcat server). Can someone know why I can't do that ?
Is it what you are looking for ??
Tomcat home directory or Catalina directory is stored at the Java System Property environment. If the Java web application is deployed into Tomcat web server, we can get the Tomcat directory with the following command
System.getProperty("catalina.base");

Categories