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


Java Restlet.handle方法代码示例

本文整理汇总了Java中org.restlet.Restlet.handle方法的典型用法代码示例。如果您正苦于以下问题:Java Restlet.handle方法的具体用法?Java Restlet.handle怎么用?Java Restlet.handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.restlet.Restlet的用法示例。


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

示例1: handle

import org.restlet.Restlet; //导入方法依赖的package包/类
@Override
public void handle(Request request, Response response) {
    super.handle(request, response);

    if (getFirstInboundFilter() != null) {
        getFirstInboundFilter().handle(request, response);
    } else {
        final Restlet next = this.inboundNext;
        if (next != null) {
            next.handle(request, response);
        } else {
            response.setStatus(Status.SERVER_ERROR_INTERNAL);
            getHelped()
                    .getLogger()
                    .error("The "
                                    + getHelped().getClass().getName()
                                    + " class has no Restlet defined to process calls. Maybe it wasn't properly started.");
        }
    }
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:21,代码来源:CompositeHelper.java

示例2: serverRedirect

import org.restlet.Restlet; //导入方法依赖的package包/类
/**
 * Redirects a given call on the server-side to a next Restlet with a given
 * target reference. In the default implementation, the request HTTP
 * headers, stored in the request's attributes, are removed before
 * dispatching. After dispatching, the response HTTP headers are also
 * removed to prevent conflicts with the main call.
 * 
 * @param next
 *            The next Restlet to forward the call to.
 * @param targetRef
 *            The target reference with URI variables resolved.
 * @param request
 *            The request to handle.
 * @param response
 *            The response to update.
 */
protected void serverRedirect(Restlet next, Reference targetRef,
        Request request, Response response) {
    if (next == null) {
        getLogger().warn(
                "No next Restlet provided for server redirection to "
                        + targetRef);
    } else {
        // Save the base URI if it exists as we might need it for
        // redirections
        Reference resourceRef = request.getResourceRef();

        // Reset the protocol and let the dispatcher handle the protocol
        request.setProtocol(null);

        // Update the request to cleanly go to the target URI
        request.setResourceRef(targetRef);
        rewrite(request);
        next.handle(request, response);

        request.setResourceRef(resourceRef);
        // Allow for response rewriting and clean the headers
        response.setEntity(rewrite(response.getEntity()));
        rewrite(response);

        // In case of redirection, we may have to rewrite the redirect URI
        rewriteLocation(request, response);
    }
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:45,代码来源:Redirector.java

示例3: handle

import org.restlet.Restlet; //导入方法依赖的package包/类
@Override
public void handle(Request request, Response response) {
    Method method = request.getMethod();
    LOG.debug("MethodRouter ({}) received request method: {}", uriPattern, method);
    
    Restlet target = routes.get(method);
    if (target != null) {
        target.handle(request, response);
    } else {
        LOG.debug("MethodRouter ({}) method not allowed: {}", uriPattern, method);
        response.setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
        // must include list of allowed methods
        response.setAllowedMethods(routes.keySet());
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:MethodBasedRouter.java

示例4: doHandle

import org.restlet.Restlet; //导入方法依赖的package包/类
/**
 * Effectively handles the call using the selected next {@link Restlet},
 * typically the selected {@link Route}. By default, it just invokes the
 * next Restlet.
 * 
 * @param next
 *            The next Restlet to invoke.
 * @param request
 *            The request.
 * @param response
 *            The response.
 */
protected void doHandle(Restlet next, Request request, Response response) {
    next.handle(request, response);
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:16,代码来源:Router.java


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