Struts2 - Upload photo from Android to Server via Restful - android

I would like to upload photo from Android client to Web Server via Restful like this:
URL:
http://domain.com/users/{user_id}/list
Method: POST
Content-type Image/JPEG
Server receive photo. But I don't know how to receive and save to folder.

Related

How do I use androidHttp to upload multipart video to server

According to the android documentations, I should be using AndroidHttp.HttpTransport instead of Apache as Apache may not be supported in the future, etc. etc. Does anyone know how to use AndroidHttp for sending multipart data to server? I need to upload a video to server along with title, username, timestamp, etc. Thanks for any help.
With apache, the following code works well for uploading multipart video: Android upload video to remote server using HTTP multipart form data

How can I connect to my Amazon EC2 server with android application

I am new to amazon EC2 web server. My client has given the URL like this http://ec2-00-00-000-000.ap-southeast-1.compute.amazonaws.com:3000. I want to use this url for fetching data from server or sending data to the server.
For example i have a login module. I want to sent username and password through this url over internet. How can i do this? Anyone can provide me the code. It will be helpful for me
thanks in advance.

Android upload image via HTTP PUT

I'm trying to upload a jpeg image to my web server via an HTTP PUT method.
With Fiddler, I'm able to compose an HTTP PUT request, upload the image and execute the request successfully.
However, on Android, I can't get it to work. I've read many solutions about using MultipartEntity. When I try that, the image received on the server is corrupted. I compared the content of the original image with the one received by the server and I see that some HTTP headers are added at the beginning of the file and that the multipart boundary is added at the end, therefore corrupting it.
I've set up Fiddler on the web server as a reverse proxy to capture the incoming HTTP traffic:
here's the result
On the top, the HTTP PUT request sent with Fiddler that works.
At the bottom, the one sent by my Android application that sends a corrupted image.
How can I send an HTTP PUT request on Android that will produce a similar request than the one sent with Fiddler?

Android: How to periodically send location to a django server with csrf verification

I want my android app to periodically send location information to my django server.
Based on my research, android client should write the location in JSON, payload JSON in http post, and send http post request to django server periodically. and the http post request is created by the client directly, not from a post form by django. Is it a normal way?
If posting data without form is a general way, then to stop csrf verification, according to the answer of Android sending post requests to django server csrf failing, the android client should
"getting the token from the server and sending that along with the POST data "
(suppose I do not use solution of #csrf_exempt)
My question is where to get the csrftoken cookie?
I do see csrftoken cookie if I send a GET request to a post form, but if posting data directly (without asking for the post form), where does a client get the csrftoken cookie?
You could use an API like tastypie or rest-framework. The only way to get the token is by accessing the page that gives it.

android - build application to authenticate with web server

I'm trying to make an application that needs authentication :- when user type username and pw in the text boxes it should check with the DB in the server and authenticate.
how can i do this in the android?
can please any one help me??
thank you,
If you are a web developer you can do this authentication very easily. You can follow the following steps,
First, get the username and password from the user and put in the variables.
Create the HTTP connection to the web server (Your data posting URL).
Post the data to the URL with specified data using HTTP Get or Post method(Post is preferable for authentication)
Get the posted value using server side script and do the authentication.
send the response status to the client by using JSON encoding or some other format whether the authentication is succeeded of failure.
Get the response in android and create the InputStream and decode the JSON or some specified encoding format which you done in the server side and shown the response in mobile.
Thats it.

Categories

Resources