Examples of WhenHttpRequest


Examples of restx.specs.WhenHttpRequest

        Iterator<WhenHttpRequest> iterator = spec.iterator();
        if (!iterator.hasNext()) {
            return Optional.absent();
        }

        final WhenHttpRequest whenHttpRequest = iterator.next();
        return Optional.of(new RestxHandlerMatch(
                new StdRestxRequestMatch(req.getRestxPath()),
                new RestxHandler() {
                    @Override
                    public void handle(RestxRequestMatch match, RestxRequest req, RestxResponse resp,
                                       RestxContext ctx) throws IOException {
                        resp.setStatus(HttpStatus.havingCode(whenHttpRequest.getThen().getExpectedCode()));
                        if (whenHttpRequest.getThen().getExpectedCode() == HttpStatus.OK.getCode()) {
                            resp.setContentType("application/json");
                        }
                        resp.getWriter().print(whenHttpRequest.getThen().getExpected());
                    }
                }
        ));
    }
View Full Code Here

Examples of restx.specs.WhenHttpRequest

        sb.append("-- routes defined by specs:\n");
        for (String spec : specRepository.findAll()){
            Optional<RestxSpec> s = specRepository.findSpecById(spec);
            for (When when : s.get().getWhens()) {
                if (when instanceof WhenHttpRequest) {
                    WhenHttpRequest httpRequest = (WhenHttpRequest) when;
                    sb.append(httpRequest.getMethod()).append(" ").append(httpRequest.getPath())
                            .append(" (").append(spec).append(")\n");
                }
            }
        }
        sb.append("--");
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.