Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0C8EE200B3E for ; Thu, 8 Sep 2016 00:01:47 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0B20F160ACF; Wed, 7 Sep 2016 22:01:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 51E56160AC1 for ; Thu, 8 Sep 2016 00:01:46 +0200 (CEST) Received: (qmail 4808 invoked by uid 500); 7 Sep 2016 22:01:45 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 4796 invoked by uid 99); 7 Sep 2016 22:01:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Sep 2016 22:01:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 8AD601A05C1 for ; Wed, 7 Sep 2016 22:01:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id t0Ld-OFsSWmi for ; Wed, 7 Sep 2016 22:01:42 +0000 (UTC) Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id D70085FBF8 for ; Wed, 7 Sep 2016 22:01:41 +0000 (UTC) Received: by mail-oi0-f50.google.com with SMTP id s131so45816458oie.2 for ; Wed, 07 Sep 2016 15:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=b34cxvoSLjwDXgZM4F6wnpf+bAwSR50vhrIDjp4AV0g=; b=q4caVwpoG1JeXly8r963yns2Uuw8SZpti16UrGwWqjXqkN3Ef44U7yqwNixOv47Xia gjZGcotRQRM98LDuX4g1qfZVCQqyxrFdpK4l7NGMH5oxpmC274+4NYNnR+I9dN1GpWT6 Pglfjjglhn0MFiE5Y7qvg80l0HP7RwVXZ5JfP79nwyeoQ4DR6lypX7zLMzmivTE6b1hN 65hNf22lhQ74qLHgApGz9pLaxY8GxrZO5MpI7yudFXYTKvwhOGHpVt/Yh/cATHs55qbH NDwJAuh28x/2oElw2oJU2SXmHO7zzuUlUfjUOWygvT1FRtf1+sXWdl2FNqwpuzk6FT5z CQLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=b34cxvoSLjwDXgZM4F6wnpf+bAwSR50vhrIDjp4AV0g=; b=NtaYldTqjHF4FiassbhovAJyhGENL8oP37NRdBHBiF8cYR6gt7HjYgwQAGDVhQXevT mpIZj5kYSZ2fxwWA8Npf8hNJYCFRaBwiGXO6PE9pawRrl1wf+oeMCulDOgaw9YuZeoRx sAA9tXiSUUkYLHzT8k/j4neb1ymtJe4h0PtXha4IIJ1i4HGCK6ipe/P8vioR2Wqh/eYs sb9YmtG4GGGKE+CgUD/Mu8oc0MSRUHwkq3g5PjDMeKdFCuwzDBXNOWnMsKAASsCngxUH 3Mc+LGUEnMp6zlMC5Ujq8c93xWKr5ifiYgpxBi6O2hEuRU+IjsSw4vkkQBNdU+PbCoen mxTw== X-Gm-Message-State: AE9vXwMUhkL7Rp0CvRXsOSMxr1u8rpPK4mkhWgSco85lbyW8Lzb3VGcSVIQ5xSXVRZBzh8P5nUCuwhtVwTHrPA== X-Received: by 10.202.172.17 with SMTP id v17mr1238333oie.206.1473285701023; Wed, 07 Sep 2016 15:01:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.16.82 with HTTP; Wed, 7 Sep 2016 15:01:40 -0700 (PDT) In-Reply-To: References: From: Ken McWilliams Date: Wed, 7 Sep 2016 16:01:40 -0600 Message-ID: Subject: Re: [Question] [struts2-rest-plugin] How shall I handle GET request /orders/{id}/items? To: Struts Users Mailing List Content-Type: multipart/alternative; boundary=001a113cf5fadcbe6e053bf20eac archived-at: Wed, 07 Sep 2016 22:01:47 -0000 --001a113cf5fadcbe6e053bf20eac Content-Type: text/plain; charset=UTF-8 There isn't a recommended way to handle deeply set lists as per your example... Or I missed it. I'm not a fan of that plugin. It is really trivial to do this without any plugins: https://struts.apache.org/docs/wildcard-mappings.html Wildcards or using the named-pattern matcher (although in the linked documentation the heading is "Parameters in namespaces"). It may be possible to use conventions, it might be nice to use annotations to specify the root and the child actions in the same class for grouping: http://stackoverflow.com/questions/6037820/is-it-possible-to-use-wildcard-method-invocation-in-struts2-with-conventions-plu Since you may need to resolve the child entity before fetching the child, it might be convenient to have them in the same class... save you from chaining. Create/Update/Delete using the struts2-rest-plugin are pretty straight forward but at only one level of access. On Wed, Sep 7, 2016 at 3:45 AM, Yong Kang Guo wrote: > Hi experts, > > I'm learning to use the struts2-rest-plugin. In the sample project > 'rest-showcase', I see a good example where I can GET /orders and > /orders/1. But how to implement navigation from one resource to another? > E.g., Let's say an Order has many Items. Then how to implement the proper > handler to request: > > GET /orders/{id}/items, and > > GET /orders/{id}/items/{item_id} ? > > > And how to handle Create/Update/Delete requests to the navigation path, > e.g. > > POST /orders/{id}/items > > to create a new item under the order? > > > Thanks and Best Regards, > > Guo > -- Sent from my C64 using a 300 baud modem --001a113cf5fadcbe6e053bf20eac--