Java, Android - Start a python flask server on localhost - java

I was looking at the possible ways to use my python function on android. And now saw this-- https://blog.pythonanywhere.com/169/ . It explains how I can 'turn my python script into a website' . This method is useful-- people will run it on their browser. But it's not useful for me. My project needs web scraping and the site(s) I scrape can block my server's IP if I post too many requests. Now, this is my idea-- I will write a java android program to start the flask webapp on localhost when my app starts and integrate a web viewer into the app to view the webapp on localhost. The only thing that I want to know is, starting the server on localhost is possible with java or not.

I think it is not possible. Instead, you can have it as an API and then make requests whenever you need it.

Related

Using EasyPHP Webserver

I'm not sure how one goes about using EasyPHP Webserver. Looking around the internet there doesn't seem to be a lot of materials on the matter. Whenever I try to run a php file from the www folder, a new blank tab appears without output from script code (Simple hello world echo). I'm not sure what the problem could be. My Http server and db server is running.
I'm also not sure if EasyPHP devserver is capable of going online. I'm currently in the middle of building an application that requires information to be sent to the server. My android application has been having trouble connecting to the EasyPHP devserver. Will I have more success with EasyPHP Webserver than I will with Devserver?
If you can make a success request using browser, then I think there will be no problem in Android.
Try to debug your webservice using tools like RestClient or PostManager.
Also, when connecting to webservice from Android application, I suggest using third party library like retrofit2. It's quite simple and we will never bothering with parsing json anymore.
In order to get the devserver running, you simply have to right click on the tray icon and select "Open Dashboard". There you can enable and set up all the services such as modules that you need. Please note that EasyPHP devserver is not designed to be used for a production server!
For performance and security reasons, I do strongly recommend to use Apache or nginx with the current stables of PHP 7.0.x and MySQL. If you need some help with that, feel free to ask me in a comment.
EasyPHP Webserver or Devserver are not a web server. It is a manager that installs Apache, PHP, MySQL, and other utilities, just like WAMP or XAMPP.
Just be sure to start the application that loads the Apache server before doing anything.
about your Android device connecting with the server, I'm not sure how that could be done, I have been more lucky using node, gulp and some scripts to generate a web server that is accessible to my devices in my local network.

how to setup web service server with MySql for java developer

Hello Folks I am new to webservice I googled a lot I couldn't come to conclusion so I am seeking help here.
I am developing simple Android app for education purpose I know Java programming.
Please any one give me the steps to adopt in development to consume API signature from the webservice backend. If possible Local setup steps. I am using FrontEnd: Android widgets with http. I need backend setup information JAVA restful + MySql + Application server ?
Advance thanks
I personally run a server from home on a Raspberry Pi for my pet projects. It uses a LAMP setup, which stands for Linux+Apache+MySQL+PHP. Linux is the OS it runs on, Apache is the main webserver, and PHP is for dynamic webpage creation. I would recommend using something similar; packages like WAMP (replacing Linux with Windows) bundle all four of these services together for easy installation and setup. I believe there are also a number of free MySQL server hosts which you could use, if you don't want to deal with port-fowarding/handling traffic.

Java program to a web service\servlet

I've written a java program that handles certain http requests.
Now I'm asked to run this as a web service in IIS.
I've tried to export it as a jar and maybe run it like that...but I didn't succeed.
As far as I understood, I need to re-write the program as a web service or servlet and upload it this way to IIS.
My question is, how to do it (I'm using eclipse)? So far I managed to run a server but I never couldn't make my program to work. Can I have guidance please?
This is pretty old article but you can take a look here
For new IIS I'm not sure you can because Microsoft has it's own tech called .NET so I suppose it's better to use other server or use .NET
Also you can use Tomcat connector for IIS which is filter with redirect

Creating a simple web page using Java without using Servlet and Tomcat

I want to create a simple server application which runs on the desktop, and when I type my ip and port on the web browser, it connects to the server client which then opens a webpage with appropriate displays coded on the server application.
I read online that I need to use servlet and Apache Tomcat to make a webpage using Java.
I am wondering if there are any easier way to make a simple webpage which can contain buttons without using servlet and Apache Tomcat?
For example, I can use sockets to communicate between server and client applications. Could I change this client into typing the ip address and port on the web browser which will display a webpage created and contained in the server application and remove the need for servlet and tomcat? If so, how do I create a button on the server application so that web browser can see the button when connecting to the server application?
Thank you very much.
If I understand you correctly, you want to have a web page, but you don't want to use Tomcat (or any other servlet engine).
Although it is technically possible to write your own little web server (using server sockets etc), but what you're basically doing then is rewriting Tomcat. Writing a good web server is a daunting job, and should not be taken lightly. I think you are underestimating that. Instead, use what is already there. Tomcat is really quite easy get running.
Creating the server piece could be done with raw sockets, but I would look at at an embedded server like Jetty. I think it will save you a lot of time and headache.
http://docs.codehaus.org/display/JETTY/Embedding+Jetty
You should look into Play Framework. It will be easier then implementing Tomcat or Apache.
Version 1.2.4 is stable and feature-complete for Java, version 2.x is focused on Scala and doesn't have all the features of 1.2.4 yet.
You don't have to create a servlet. But, you need something that can parse a jsp page - it could be tomcat or some other server which has the same capabilities as tomcat. Though I am not sure if I understood your question correctly.

Looking to integrate/embed a chat client in a java webapp

Requirements:
Should be open source.
Don't necessarily need to connect to an existing IM server, and can run my own so long as it can run in a Linux OS.
Needs to support SSO with the app deployed in JBoss.
Should be able to either skin the chat client to look the same as the app or better still, embed it without any borders or decorators.
Thoughts?
There is a sample chat client with the Jetty webserver you can adapt.

Categories

Resources