android


RESTful Spring for Android POST request


I'm sending a GET request to a server.
private class DTOTask extends AsyncTask<Void, Void, DTO> {
#Override
protected DTO doInBackground(Void... params) {
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
return template.getForObject(Constants.URL.GET_URL, DTO.class);
}
#Override
protected void onPostExecute(DTO dto) {
List<DTO> data = new ArrayList<>();
data.add(dto);
adapter.setData(data);
}
}
It works.
How to send POST request?
use any of this methods instead of getForObject
public <T> T postForObject(String url, Object request, Class<T> responseType, Object... uriVariables);
public <T> T postForObject(String url, Object request, Class<T> responseType, Map<String, ?> uriVariables);
public <T> T postForObject(URI url, Object request, Class<T> responseType) throws RestClientException;

Related Links

Newbie: Use Android intents privately?
get currently displayed fragment
android to receive a string from java server after successful connection and sending of message
Android App/AVD problems
Android + App Engine: Unable to create media player
TabHost with Multiple ViewFlippers - GestureListener
Filter ListView when tab changed
tablet size qualifiers not being used
Preferences & CheckBoxes
Debugger not stopping at breakpoints for developing android application using eclipse
Custom adapter: get item number of clicked item in inflated listview
LinearLayout won't display everything
Android Setting->Display… What type of menu is that?
How to use an Android stock app as a library in another custom Android app?
Flex Builder dateFormatter timezone offset
Android CustomListView overlapping other components

Categories

HOME
redux-form
themes
jelastic
square
maxscript
jquery-ui
p2p
emoji
magnetic-cards
android-intent
linear-algebra
mathprog
html5-appcache
google-picker
charles
imagemap
href
question2answer
gulp-watch
pagespeed
angular-routing
pchart
dynamically-generated
dapper-extensions
windows-server-2003
syntax-highlighting
ceylon
cppreference
anki
memory-address
google-earth-engine
tex
p4merge
levenshtein-distance
glm-math
print-css
bindingnavigator
importerror
oim
optimizely
servermanager
robomongo
dotnet-httpclient
yii2-api
geotiff
rserve
trojan
arq
cup
gameplay-kit
docpad
myspace
nikeplus-api
beamer
x-tag
delta
lean
cda
uiactionsheet
toast
android-launcher
dulwich
bcache
dbaccess
showdialog
webmatrix-3
iiop
deform
post-commit-hook
contrast
spy++
entry-point
encryption-asymmetric
personalization
ios8-extension
draw2d-js
buffering
extjs2
twitter-bootstrap-rails
windows-phone-8-sdk
time.h
jquery-1.9
android-sdk-2.3
qtconcurrent
wiimote
stress
convention
promotion-code
cloudfiles
objective-j
cruisecontrol.rb
isapi-extension
wordprocessingml
linfu-dynamicproxy
pbcopy

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App