Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public AndroidWebServer(int port) {
- super(port);
- }
- public AndroidWebServer(String hostname, int port) {
- super(hostname, port);
- }
- @Override
- public Response serve(IHTTPSession session) {
- String msg = "<html><body><h1>Hello server</h1>n";
- Map<String, String> parms = session.getParms();
- if (parms.get("username") == null) {
- msg += "<form action='?' method='get'>n <p>Your name: <input type='text' name='username'></p>n" + "</form>n";
- } else {
- msg += "<p>Olรก, " + parms.get("username") + "!</p>";
- }
- return newFixedLengthResponse( msg + "</body></html>n" );
- }
Add Comment
Please, Sign In to add comment