07.01.2013 Views

David Defour - Université de Perpignan

David Defour - Université de Perpignan

David Defour - Université de Perpignan

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Servlet, Continued<br />

664<br />

jeudi 26 janvier 12<br />

@Overri<strong>de</strong><br />

public void doPost(HttpServletRequest request,<br />

HttpServletResponse response)<br />

throws ServletException, IOException {<br />

doGet(request, response);<br />

}<br />

Makes the most sense to send the data via POST. However, it also supports GET to simplify interactive testing by editing the browser line.<br />

This app is installed on apps.coreservlets.com, so URL is http://apps.coreservlets.com/NetworkingSupport/loan-calculator<br />

You can experiment interactively by calling<br />

http://apps.coreservlets.com/NetworkingSupport/loan-calculator?loanInputs={amount: 200000, rate: 6.5, months: 180}<br />

The tutorial Web site has the servlet co<strong>de</strong> as well as the Android co<strong>de</strong>, so you can install the servlet on a local Java server (requires Tomcat 7<br />

or equivalent). However, note that the Android emulator does not un<strong>de</strong>rstand localhost as a host name, since it acts like in<strong>de</strong>pen<strong>de</strong>nt <strong>de</strong>vice.<br />

So, you must use real domain name or IP address.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!