Examples of RestController


Examples of net.csdn.modules.http.RestController

                    if (!isController) return;
                    Method[] methods = clzz.getDeclaredMethods();

                    for (Method method : methods) {
                        if (method.getModifiers() == Modifier.PRIVATE) continue;
                        RestController restController = ServiceFramwork.injector.getInstance(RestController.class);
                        API api = ServiceFramwork.injector.getInstance(API.class);
                        NoAction noAction = method.getAnnotation(NoAction.class);
                        if (noAction != null) {
                            restController.setDefaultHandlerKey(new Tuple<Class<ApplicationController>, Method>(clzz, method));
                        }

                        ErrorAction errorAction = method.getAnnotation(ErrorAction.class);
                        if (errorAction != null) {
                            restController.setErrorHandlerKey(new Tuple<Class<ApplicationController>, Method>(clzz, method));
                        }

                        At at = method.getAnnotation(At.class);
                        if (at == null) continue;
                        String url = at.path()[0];
                        RestRequest.Method[] httpMethods = at.types();

                        for (RestRequest.Method httpMethod : httpMethods) {
                            Tuple<Class<ApplicationController>, Method> tuple = new Tuple<Class<ApplicationController>, Method>(clzz, method);
                            restController.registerHandler(httpMethod, url, tuple);
                            api.addPath(tuple.v2());
                        }
                        bind(clzz);
                    }
                } catch (Exception e) {
View Full Code Here

Examples of net.csdn.modules.http.RestController

        Map newParams = new HashMap();
        for (Object key : params.keySet()) {
            newParams.put(key, params.get(key).toString());
        }

        RestController controller = injector.getInstance(RestController.class);
        try {
            RestRequest restRequest = new MockRestRequest(path, newParams, method, null);
            HttpServer.setHttpHolder(new HttpHolder(restRequest, response));
            controller.dispatchRequest(restRequest, response);
        } catch (Exception e) {
            catchRenderFinish(e);
        }
        return response;
    }
View Full Code Here

Examples of net.csdn.modules.http.RestController

            for (Object key : params.keySet()) {
                newParams.put(key, params.get(key).toString());
            }
        }

        RestController controller = injector.getInstance(RestController.class);
        try {
            controller.dispatchRequest(new MockRestRequest(path, newParams, method, rawParamsStr), response);
        } catch (Exception e) {
            catchRenderFinish(e);
        }
        return response;
    }
View Full Code Here

Examples of org.elasticsearch.rest.RestController

    }

    @BeforeMethod public void setUp() {
        client.admin().indices().delete(new DeleteIndexRequest("_all")).actionGet();
        Settings emptySettings = ImmutableSettings.settingsBuilder().build();
        action = new ReIndexAction(emptySettings, client, new RestController(emptySettings));
    }
View Full Code Here

Examples of org.elasticsearch.rest.RestController

                .put("cluster.name", cluster).build();
        Client client = new TransportClient(settings).
                addTransportAddress(new InetSocketTransportAddress(searchHost, searchPort));

        Settings emptySettings = ImmutableSettings.settingsBuilder().build();
        RestController contrl = new RestController(emptySettings);
        ReIndexAction action = new ReIndexAction(emptySettings, client, contrl) {
            @Override protected MySearchHits callback(MySearchHits hits) {
                SimpleList res = new SimpleList(hitsPerPage, hits.totalHits());
                for (MySearchHit h : hits.getHits()) {
                    try {
View Full Code Here

Examples of org.elasticsearch.rest.RestController

   */
  public SourceClientESClient(Client client) {
    this.client = client;
    Settings settings = ImmutableSettings.Builder.EMPTY_SETTINGS;
    SettingsFilter settingsFilter = new SettingsFilter(settings);
    RestController controller = new RestController(settings);
    healthAction = new RestClusterHealthAction(settings, client, controller);
    stateAction = new RestClusterStateAction(settings, client, controller, settingsFilter);
    nodesInfoAction = new RestNodesInfoAction(settings, client, controller, settingsFilter);
    nodesStatsAction = new RestNodesStatsAction(settings, client, controller);
    indicesStatusAction = new RestIndicesStatusAction(settings, client, controller, settingsFilter);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.