當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。