source: java/main/src/main/java/com/framsticks/communication/ClientSideResponseFuture.java @ 193

Last change on this file since 193 was 193, checked in by Maciej Komosinski, 10 years ago

Set svn:eol-style native for all textual files

  • Property svn:eol-style set to native
File size: 887 bytes
Line 
1package com.framsticks.communication;
2
3import com.framsticks.util.ExceptionHandler;
4import com.framsticks.util.FramsticksException;
5import com.framsticks.util.dispatching.Future;
6
7public abstract class ClientSideResponseFuture extends Future<Response> {
8
9        public ClientSideResponseFuture(ExceptionHandler handler) {
10                super(handler);
11        }
12
13        protected Request request;
14
15        protected abstract void processOk(Response response);
16
17        @Override
18        protected final void result(Response response) {
19                if (response.getOk()) {
20                        processOk(response);
21                } else {
22                        handle(new FramsticksException().msg("invalid response").arg("comment", response.getComment()).arg("request", request));
23                }
24        }
25
26        /**
27         * @return the request
28         */
29        public Request getRequest() {
30                return request;
31        }
32
33        /**
34         * @param request the request to set
35         */
36        public void setRequest(Request request) {
37                this.request = request;
38        }
39
40}
Note: See TracBrowser for help on using the repository browser.