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


Java Request类代码示例

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


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

示例1: RestServlet

import ro.pippo.core.Request; //导入依赖的package包/类
@Inject
public RestServlet(Application application) {
    this.application = application;
    this.routeDispatcher = new RouteDispatcher(application) {
        protected RouteContextFactory<?> getRouteContextFactory() {
            return new RouteContextFactory<Context>() {
                @Override
                public Context createRouteContext(Application application, Request request, Response response, List<RouteMatch> list) {
                    return new Context(application, request, response, list);
                }

                @Override
                public void init(Application application) {
                }

                @Override
                public void destroy(Application application) {
                }
            };
        }
    };
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:23,代码来源:RestServlet.java

示例2: handle

import ro.pippo.core.Request; //导入依赖的package包/类
@Override
public void handle(RouteContext routeContext) {
    // get request path
    Request request = routeContext.getRequest();
    String path = request.getPath();

    // add or remove trailing slash
    if (path.length() > 1) {
        if (addSlash) {
            path = StringUtils.addEnd(path, "/");
        } else {
            path = StringUtils.removeEnd(path, "/");
        }
    }

    if (!path.equals(request.getPath())) {
        // redirect
        routeContext.redirect(path);
    } else {
        // continue with the next handler
        routeContext.next();
    }
}
 
开发者ID:decebals,项目名称:pippo,代码行数:24,代码来源:TrailingSlashHandler.java

示例3: processWebSocketRequest

import ro.pippo.core.Request; //导入依赖的package包/类
private void processWebSocketRequest(Request request, Response response) {
        HttpServletRequest servletRequest = request.getHttpServletRequest();
        HttpServletResponse servletResponse = response.getHttpServletResponse();

        WebSocketHttpExchange exchange = new ServletWebSocketHttpExchange(servletRequest, servletResponse, peerConnections);
//        exchange.putAttachment(HandshakeUtil.PATH_PARAMS, Collections.<String, String>emptyMap());

        Handshake handshake = getHandshake(exchange);

        exchange.upgradeChannel((connection, serverExchange) -> {
            WebSocketChannel channel = handshake.createChannel(exchange, connection, exchange.getBufferPool());
            peerConnections.add(channel);
            createWebSocketAdapter(request).onConnect(exchange, channel);
        });

        handshake.handshake(exchange);
    }
 
开发者ID:decebals,项目名称:pippo,代码行数:18,代码来源:UndertowWebSocketFilter.java

示例4: makePippoWebContext

import ro.pippo.core.Request; //导入依赖的package包/类
private PippoWebContext makePippoWebContext() {
    Request request = makeRequest();
    response = makeResponse();

    when(mockRouteContext.getRequest()).thenReturn(request);
    when(mockRouteContext.getResponse()).thenReturn(response);

    return new PippoWebContext(mockRouteContext, null);
}
 
开发者ID:codematix,项目名称:pippo-pac4j,代码行数:10,代码来源:PippoWebContextTests.java

示例5: doFilterInternal

import ro.pippo.core.Request; //导入依赖的package包/类
protected void doFilterInternal(ServletRequest servletRequest, ServletResponse servletResponse, final FilterChain chain)
        throws ServletException, IOException {
    try {
        super.doFilterInternal(servletRequest, servletResponse, chain);
    } catch (Exception exception) {
        Exception root = (Exception) Throwables.getRootCause(exception);
        Request request = new Request((HttpServletRequest) servletRequest, application);
        Response response = new Response((HttpServletResponse) servletResponse, application);
        Context routeContext = new Context(application, request, response, Collections.emptyList());
        errorHandler.handle(root, routeContext);
    }
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:13,代码来源:ShiroFilter.java

示例6: getAcceptTypes

import ro.pippo.core.Request; //导入依赖的package包/类
private Set<String> getAcceptTypes(Request request) {
    Set<String> types = new LinkedHashSet<>();
    types.addAll(getContentTypes(request.getAcceptType()));
    types.addAll(getContentTypes(request.getHttpServletRequest().getHeader(HttpConstants.Header.ACCEPT)));

    return types;
}
 
开发者ID:decebals,项目名称:pippo,代码行数:8,代码来源:ControllerRouteHandler.java

示例7: getContentTypes

import ro.pippo.core.Request; //导入依赖的package包/类
private Set<String> getContentTypes(Request request) {
    Set<String> types = new LinkedHashSet<>();
    types.addAll(getContentTypes(request.getContentType()));
    types.addAll(getContentTypes(request.getHttpServletRequest().getContentType()));

    return types;
}
 
开发者ID:decebals,项目名称:pippo,代码行数:8,代码来源:ControllerRouteHandler.java

示例8: headerContainsToken

import ro.pippo.core.Request; //导入依赖的package包/类
private boolean headerContainsToken(Request request, String headerName, String target) {
    Enumeration<String> headers = request.getHeaders(headerName);
    while (headers.hasMoreElements()) {
        String header = headers.nextElement();
        String[] tokens = header.split(",");
        for (String token : tokens) {
            if (target.equalsIgnoreCase(token.trim())) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:decebals,项目名称:pippo,代码行数:15,代码来源:AbstractWebSocketFilter.java

示例9: getTokensFromHeader

import ro.pippo.core.Request; //导入依赖的package包/类
protected List<String> getTokensFromHeader(Request request, String headerName) {
    List<String> result = new ArrayList<>();

    Enumeration<String> headers = request.getHeaders(headerName);
    while (headers.hasMoreElements()) {
        String header = headers.nextElement();
        String[] tokens = header.split(",");
        for (String token : tokens) {
            result.add(token.trim());
        }
    }

    return result;
}
 
开发者ID:decebals,项目名称:pippo,代码行数:15,代码来源:AbstractWebSocketFilter.java

示例10: createRouteContext

import ro.pippo.core.Request; //导入依赖的package包/类
@Override
public DefaultRouteContext createRouteContext(Application application,
                                              Request request,
                                              Response response,
                                              List<RouteMatch> routeMatches) {

    return new DefaultRouteContext(application, request, response, routeMatches);
}
 
开发者ID:decebals,项目名称:pippo,代码行数:9,代码来源:DefaultRouteContextFactory.java

示例11: createRequestResponse

import ro.pippo.core.Request; //导入依赖的package包/类
@Override
public RequestResponse createRequestResponse(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
    SessionHttpServletRequest sessionHttpServletRequest = new SessionHttpServletRequest(httpServletRequest, sessionManager);
    Request request = new Request(sessionHttpServletRequest, application);
    Response response = new Response(httpServletResponse, application);
    response.getFinalizeListeners().add(r -> sessionHttpServletRequest.commitSession(httpServletResponse));

    return new RequestResponse(request, response);
}
 
开发者ID:decebals,项目名称:pippo,代码行数:10,代码来源:SessionRequestResponseFactory.java

示例12: processRequest

import ro.pippo.core.Request; //导入依赖的package包/类
@Override
protected void processRequest(Request request, Response response) throws IOException, ServletException {
    if (!acceptWebSocket(request, response)) {
        super.processRequest(request, response);
    } else {
        processWebSocketRequest(request, response);
    }
}
 
开发者ID:decebals,项目名称:pippo,代码行数:9,代码来源:UndertowWebSocketFilter.java

示例13: makeRequest

import ro.pippo.core.Request; //导入依赖的package包/类
private Request makeRequest() {
    return new Request(mockHttpRequest, mockApplication);
}
 
开发者ID:codematix,项目名称:pippo-pac4j,代码行数:4,代码来源:PippoWebContextTests.java

示例14: Context

import ro.pippo.core.Request; //导入依赖的package包/类
public Context(Application application, Request request, Response response, List<RouteMatch> routeMatches) {
    super(application, request, response, routeMatches);
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:4,代码来源:Context.java

示例15: getRequest

import ro.pippo.core.Request; //导入依赖的package包/类
public final Request getRequest() {
    return context.getRequest();
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:4,代码来源:Controller.java


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