Return-Path: Delivered-To: apmail-incubator-roller-commits-archive@www.apache.org Received: (qmail 2871 invoked from network); 16 Dec 2005 05:51:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Dec 2005 05:51:55 -0000 Received: (qmail 45825 invoked by uid 500); 16 Dec 2005 05:51:54 -0000 Delivered-To: apmail-incubator-roller-commits-archive@incubator.apache.org Received: (qmail 45794 invoked by uid 500); 16 Dec 2005 05:51:54 -0000 Mailing-List: contact roller-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: roller-dev@incubator.apache.org Delivered-To: mailing list roller-commits@incubator.apache.org Received: (qmail 45783 invoked by uid 99); 16 Dec 2005 05:51:54 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Dec 2005 21:51:54 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 15 Dec 2005 21:51:53 -0800 Received: (qmail 2541 invoked by uid 65534); 16 Dec 2005 05:51:33 -0000 Message-ID: <20051216055133.2540.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r357128 - /incubator/roller/trunk/src/org/roller/presentation/WeblogRequest.java Date: Fri, 16 Dec 2005 05:51:33 -0000 To: roller-commits@incubator.apache.org From: agilliland@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: agilliland Date: Thu Dec 15 21:51:28 2005 New Revision: 357128 URL: http://svn.apache.org/viewcvs?rev=357128&view=rev Log: simple weblog request object. Added: incubator/roller/trunk/src/org/roller/presentation/WeblogRequest.java Added: incubator/roller/trunk/src/org/roller/presentation/WeblogRequest.java URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/WeblogRequest.java?rev=357128&view=auto ============================================================================== --- incubator/roller/trunk/src/org/roller/presentation/WeblogRequest.java (added) +++ incubator/roller/trunk/src/org/roller/presentation/WeblogRequest.java Thu Dec 15 21:51:28 2005 @@ -0,0 +1,56 @@ +/* + * WeblogRequest.java + * + * Created on December 14, 2005, 6:14 PM + */ + +package org.roller.presentation; + +import javax.servlet.http.HttpServletRequest; + + +/** + * Represents a request to single weblog. + * + * This is a fairly generic parsed request which is only trying to figure out + * the weblog handle that this request is destined for. + * + * @author Allen Gilliland + */ +public class WeblogRequest extends ParsedRequest { + + private String weblogHandle = null; + + + public WeblogRequest(HttpServletRequest request) throws InvalidRequestException { + + // let our parent take care of their business first + super(request); + + String pathInfo = request.getPathInfo(); + + // we expect a path info of / 1) { + // strip off the leading slash + pathInfo = pathInfo.substring(1); + String[] pathElements = pathInfo.split("/"); + + if(pathElements[0] != null && pathElements[0].trim().length() > 1) { + this.weblogHandle = pathElements[0]; + } else { + // no handle in path info + throw new InvalidRequestException("not a weblog request, "+request.getRequestURL()); + } + + } else { + // invalid request ... path info is empty + throw new InvalidRequestException("not a weblog request, "+request.getRequestURL()); + } + } + + + public String getWeblogHandle() { + return weblogHandle; + } + +}