当前位置: 首页>>代码示例>>Java>>正文


Java RequestMapping类代码示例

本文整理汇总了Java中io.advantageous.qbit.annotation.RequestMapping的典型用法代码示例。如果您正苦于以下问题:Java RequestMapping类的具体用法?Java RequestMapping怎么用?Java RequestMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RequestMapping类属于io.advantageous.qbit.annotation包,在下文中一共展示了RequestMapping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: submit

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.POST)
public void submit(final Callback<HttpResponse<String>> callback) {
    final HttpContext httpContext = new HttpContext();
    final Optional<HttpRequest> httpRequest = httpContext.getHttpRequest();


    final StringBuilder sb = new StringBuilder(128);

    if (httpRequest.isPresent()) {
        sb.append("Content Type :" ).append(httpRequest.get().getContentType()).append("\n");
        sb.append(" Method :").append(httpRequest.get().getMethod()).append("\n");
        sb.append(" Form Body Length ").append(httpRequest.get().getBody().length).append("\n");
        sb.append(" Params ").append(httpRequest.get().getParams().toString()).append("\n");
        sb.append(" Form Params ").append(httpRequest.get().getFormParams().toString()).append("\n");

        HttpTextResponse textResponse = HttpResponseBuilder.httpResponseBuilder()

                .setJsonBodyCodeOk(sb.toString())
                .buildTextResponse();

        callback.accept(textResponse);
    }
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:24,代码来源:FormSubmit.java

示例2: findEmployee

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/find")
public void findEmployee(final Callback<Employee> employeeCallback,
                         @RequestParam("name") final String name) {

    final long startTime = super.time;

    final CallbackBuilder callbackBuilder = super.reactor.callbackBuilder();
    callbackBuilder.delegateWithLogging(employeeCallback, logger, "employeeMap3");
    callbackBuilder.withOptionalCallback(Employee.class, employeeOptional -> {


        /** Record timing. */
        super.recordTiming("findEmployee", time - startTime);

        if (employeeOptional.isPresent()) {
            /* Increment count of employees found. */
            super.incrementCount("employeeFound");
            employeeCallback.returnThis(employeeOptional.get());
        } else {
            /* Increment count of employees not found. */
            super.incrementCount("employeeNotFound");
            employeeCallback.onError(new Exception("Employee not found"));
        }
    });
    employeeService.findEmployeeByName(callbackBuilder.build(), name);
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:27,代码来源:CompanyRestServiceUsingReactor.java

示例3: findEmployee

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/find")
public void findEmployee(final Callback<Employee> employeeCallback,
                         @RequestParam("name") final String name) {

    final CallbackBuilder callbackBuilder = CallbackBuilder.newCallbackBuilder();
    // Forward to error handling and timeout defined in empMapCallback, but install some additional logging for
    // timeout and error handling that associates the error and timeout handling with this call.
    callbackBuilder.delegateWithLogging(employeeCallback, logger, "employeeMap3");
    callbackBuilder.withOptionalCallback(Employee.class, employeeOptional -> {


        if (employeeOptional.isPresent()) {
            employeeCallback.returnThis(employeeOptional.get());
        } else {
            employeeCallback.onError(new Exception("Employee not found"));
        }
    });
    employeeService.findEmployeeByName(callbackBuilder.build(), name);
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:20,代码来源:CompanyRestService.java

示例4: httpInfo

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping ("http-info")
public String httpInfo() {

    final StringBuilder builder = new StringBuilder();
    final HttpContext httpContext = new HttpContext();
    final Optional<HttpRequest> httpRequest = httpContext.getHttpRequest();
    if (httpRequest.isPresent()) {
        builder.append("URI = ").append(httpRequest.get().getUri()).append("\n");
        builder.append("HTTP Method = ").append(httpRequest.get().getMethod()).append("\n");
        builder.append("USER AGENT = ").append(
                httpRequest.get().getHeaders().getFirst(HttpHeaders.USER_AGENT)).append("\n");
    } else {
        builder.append("request not found");
    }


    final RequestContext requestContext = new RequestContext();

    if (requestContext.getMethodCall().isPresent()) {
        final MethodCall<Object> methodCall = requestContext.getMethodCall().get();
        builder.append("Object Name = ").append(methodCall.objectName()).append("\n");
        builder.append("Method Name = ").append(methodCall.name()).append("\n");
    }
    return builder.toString();
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:26,代码来源:RestService.java

示例5: hello8

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping(value = "/hello8", contentType = "application/xml", code = HttpStatus.CREATED)
public void hello8(final Callback<HttpTextResponse> callback) {

    final HttpTextResponse response = HttpResponseBuilder
            .httpResponseBuilder()
            .setBody("<xml><hi>hello world</hi></xml>")
            .setCode(201).buildTextResponse();
    callback.returnThis(response);
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:10,代码来源:HelloWorldJSend.java

示例6: employeeMap

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/emap")
public void employeeMap(final Callback<Map<String, Employee>> empMapCallback) {

    final CallbackBuilder callbackBuilder =  super.reactor.callbackBuilder();
    callbackBuilder.wrap(empMapCallback); //Forward to error handling, timeout, and callback defined in empMapCallback
    employeeService.getEmployeesAsMap(callbackBuilder.build());

}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:9,代码来源:CompanyRestServiceUsingReactor.java

示例7: employeeMap2

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/emap2")
public void employeeMap2(final Callback<Map<String, Employee>> empMapCallback) {

    final CallbackBuilder callbackBuilder = super.reactor.callbackBuilder();
    callbackBuilder.delegate(empMapCallback); //Forward to error handling and timeout defined in empMapCallback

    callbackBuilder.withMapCallback(String.class, Employee.class, employeeMap -> {
        logger.info("GET MAP {}", employeeMap);
        empMapCallback.returnThis(employeeMap);
    });
    employeeService.getEmployeesAsMap(callbackBuilder.build());

}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:14,代码来源:CompanyRestServiceUsingReactor.java

示例8: employeeMap3

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/emap3")
public void employeeMap3(final Callback<Map<String, Employee>> empMapCallback) {

    final CallbackBuilder callbackBuilder = super.reactor.callbackBuilder();
    // Forward to error handling and timeout defined in empMapCallback, but install some additional logging for
    // timeout and error handling that associates the error and timeout handling with this call.
    callbackBuilder.delegateWithLogging(empMapCallback, logger, "employeeMap3");
    callbackBuilder.withMapCallback(String.class, Employee.class, employeeMap -> {
        logger.info("GET MAP {}", employeeMap);
        empMapCallback.returnThis(employeeMap);
    });
    employeeService.getEmployeesAsMap(callbackBuilder.build());
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:14,代码来源:CompanyRestServiceUsingReactor.java

示例9: employeeList

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/elist")
public void employeeList(final Callback<List<Employee>> empListCallback) {

    final CallbackBuilder callbackBuilder = super.reactor.callbackBuilder();
    // Forward to error handling and timeout defined in empMapCallback, but install some additional logging for
    // timeout and error handling that associates the error and timeout handling with this call.
    callbackBuilder.delegateWithLogging(empListCallback, logger, "employeeList");
    callbackBuilder.withListCallback(Employee.class, employeeList -> {
        logger.info("GET List {}", employeeList);
        empListCallback.returnThis(employeeList);
    });
    employeeService.getEmployeesAsList(callbackBuilder.build());
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:14,代码来源:CompanyRestServiceUsingReactor.java

示例10: employeeMap

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/emap")
public void employeeMap(final Callback<Map<String, Employee>> empMapCallback) {

    final CallbackBuilder callbackBuilder = CallbackBuilder.newCallbackBuilder();
    callbackBuilder.wrap(empMapCallback); //Forward to error handling, timeout, and callback defined in empMapCallback
    employeeService.getEmployeesAsMap(callbackBuilder.build());

}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:9,代码来源:CompanyRestService.java

示例11: employeeMap2

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/emap2")
public void employeeMap2(final Callback<Map<String, Employee>> empMapCallback) {

    final CallbackBuilder callbackBuilder = CallbackBuilder.newCallbackBuilder();
    callbackBuilder.delegate(empMapCallback); //Forward to error handling and timeout defined in empMapCallback

    callbackBuilder.withMapCallback(String.class, Employee.class, employeeMap -> {
        logger.info("GET MAP {}", employeeMap);
        empMapCallback.returnThis(employeeMap);
    });
    employeeService.getEmployeesAsMap(callbackBuilder.build());

}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:14,代码来源:CompanyRestService.java

示例12: employeeMap3

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/emap3")
public void employeeMap3(final Callback<Map<String, Employee>> empMapCallback) {

    final CallbackBuilder callbackBuilder = CallbackBuilder.newCallbackBuilder();
    // Forward to error handling and timeout defined in empMapCallback, but install some additional logging for
    // timeout and error handling that associates the error and timeout handling with this call.
    callbackBuilder.delegateWithLogging(empMapCallback, logger, "employeeMap3");
    callbackBuilder.withMapCallback(String.class, Employee.class, employeeMap -> {
        logger.info("GET MAP {}", employeeMap);
        empMapCallback.returnThis(employeeMap);
    });
    employeeService.getEmployeesAsMap(callbackBuilder.build());
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:14,代码来源:CompanyRestService.java

示例13: employeeList

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/elist")
public void employeeList(final Callback<List<Employee>> empListCallback) {

    final CallbackBuilder callbackBuilder = CallbackBuilder.newCallbackBuilder();
    // Forward to error handling and timeout defined in empMapCallback, but install some additional logging for
    // timeout and error handling that associates the error and timeout handling with this call.
    callbackBuilder.delegateWithLogging(empListCallback, logger, "employeeList");
    callbackBuilder.withListCallback(Employee.class, employeeList -> {
        logger.info("GET List {}", employeeList);
        empListCallback.returnThis(employeeList);
    });
    employeeService.getEmployeesAsList(callbackBuilder.build());
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:14,代码来源:CompanyRestService.java

示例14: register

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/register")
@Auth
public SessionModel register(
        @RequestParam("email") String email,
        @RequestParam("password") String password
) {
    return new SessionModel("SESSION_ID");
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:9,代码来源:UserEndpoint.java

示例15: add

import io.advantageous.qbit.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping(value = "/todo", method = RequestMethod.POST,
        description = "add a todo item to the list", summary = "adds todo",
        returnDescription = "returns true if successful")
public boolean add(final Todo todo) {

    todoMap.put(todo.getId(), todo);
    return true;
}
 
开发者ID:MammatusTech,项目名称:qbit-microservices-examples,代码行数:9,代码来源:TodoService.java


注:本文中的io.advantageous.qbit.annotation.RequestMapping类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。