You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/06/23 02:25:34 UTC

svn commit: r416524 - in /incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util: WeblogPageRequest.java WeblogRequest.java WeblogSearchRequest.java

Author: agilliland
Date: Thu Jun 22 17:25:34 2006
New Revision: 416524

URL: http://svn.apache.org/viewvc?rev=416524&view=rev
Log:

- added default constructors and mutator methods to some parsed request objects so that they can be used to represent a request without actually having to parse a real request object.

- added new parsed search request object


Added:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java
Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java?rev=416524&r1=416523&r2=416524&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogPageRequest.java Thu Jun 22 17:25:34 2006
@@ -52,6 +52,9 @@
     private String weblogDate = null;
     
     
+    public WeblogPageRequest() {}
+    
+    
     /**
      * Construct the WeblogPageRequest by parsing the incoming url
      */
@@ -208,6 +211,34 @@
     
     public String getPageType() {
         return pageType;
+    }
+
+    public void setContext(String context) {
+        this.context = context;
+    }
+
+    public void setPageType(String pageType) {
+        this.pageType = pageType;
+    }
+
+    public void setWeblogHandle(String weblogHandle) {
+        this.weblogHandle = weblogHandle;
+    }
+
+    public void setWeblogAnchor(String weblogAnchor) {
+        this.weblogAnchor = weblogAnchor;
+    }
+
+    public void setWeblogPage(String weblogPage) {
+        this.weblogPage = weblogPage;
+    }
+
+    public void setWeblogCategory(String weblogCategory) {
+        this.weblogCategory = weblogCategory;
+    }
+
+    public void setWeblogDate(String weblogDate) {
+        this.weblogDate = weblogDate;
     }
     
 }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java?rev=416524&r1=416523&r2=416524&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogRequest.java Thu Jun 22 17:25:34 2006
@@ -32,6 +32,9 @@
     private String weblogHandle = null;
     
     
+    public WeblogRequest() {}
+    
+    
     public WeblogRequest(HttpServletRequest request) throws InvalidRequestException {
         
         // let our parent take care of their business first
@@ -61,6 +64,10 @@
     
     public String getWeblogHandle() {
         return weblogHandle;
+    }
+
+    public void setWeblogHandle(String weblogHandle) {
+        this.weblogHandle = weblogHandle;
     }
     
 }

Added: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java?rev=416524&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java (added)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/util/WeblogSearchRequest.java Thu Jun 22 17:25:34 2006
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.ui.rendering.util;
+
+import javax.servlet.http.HttpServletRequest;
+
+
+/**
+ * Represents a request for a weblog preview.
+ */
+public class WeblogSearchRequest extends WeblogRequest {
+    
+    private String query = null;
+    private int pageNum = 0;
+    private String weblogCategory = null;
+    
+    
+    public WeblogSearchRequest(HttpServletRequest request) 
+            throws InvalidRequestException {
+        
+        // our parent will determine the weblog handle for us
+        super(request);
+        
+        /*
+         * parse request parameters
+         *
+         * the only params we currently care about are:
+         *   q - specifies the search query
+         *   pageNum - specifies what pageNum # to display
+         *   cat - limit results to a certain weblogCategory
+         */
+        if(request.getParameter("q") != null) {
+            this.query = request.getParameter("q");
+        }
+        
+        if(request.getParameter("page") != null) {
+            String pageInt = request.getParameter("page");
+            try {
+                this.pageNum = Integer.parseInt(pageInt);
+            } catch(NumberFormatException e) {
+                // ignored, bad input
+            }
+        }
+        
+        if(request.getParameter("cat") != null) {
+            this.weblogCategory = request.getParameter("cat");
+        }
+    }
+
+    
+    public String getQuery() {
+        return query;
+    }
+
+    public int getPageNum() {
+        return pageNum;
+    }
+
+    public String getWeblogCategory() {
+        return weblogCategory;
+    }
+    
+}