//# 0 errors, 129 messages
//#
/*
    //#PlanetRequest.java:1:1: class: org.apache.roller.weblogger.ui.rendering.util.PlanetRequest
 * 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.weblogger.ui.rendering.util;

import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


/**
 * Represents a request for a Planet Roller url.
 *
 * currently ... /planet.do and /planetrss
 */
public class PlanetRequest extends ParsedRequest {
    
    private static Log log = LogFactory.getLog(PlanetRequest.class);
    //#PlanetRequest.java:33: method: org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init
    //#PlanetRequest.java:33: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.PlanetRequest
    //#    method: org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/rendering/util/PlanetRequest]
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getAuthenticUser()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getContext()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getFlavor()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getGroup()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getLanguage()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getType()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getUser()Lorg/apache/roller/weblogger/pojos/User;
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.isExcerpts()Z
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.isLoggedIn()Z
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.setAuthenticUser(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.setLanguage(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.setUser(Lorg/apache/roller/weblogger/pojos/User;)V
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): log
    //#output(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.__Descendant_Table[org/apache/roller/weblogger/ui/rendering/util/PlanetRequest]
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/rendering/util/PlanetRequest] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.__Descendant_Table[org/apache/roller/weblogger/ui/rendering/util/PlanetRequest] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getAuthenticUser()Ljava/lang/String; == &org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.getAuthenticUser
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getContext()Ljava/lang/String; == &getContext
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getFlavor()Ljava/lang/String; == &getFlavor
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getGroup()Ljava/lang/String; == &getGroup
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getLanguage()Ljava/lang/String; == &getLanguage
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getType()Ljava/lang/String; == &getType
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.getUser()Lorg/apache/roller/weblogger/pojos/User; == &org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.getUser
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.isExcerpts()Z == &isExcerpts
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.isLoggedIn()Z == &org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.isLoggedIn
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.setAuthenticUser(Ljava/lang/String;)V == &org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.setAuthenticUser
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.setLanguage(Ljava/lang/String;)V == &setLanguage
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): __Dispatch_Table.setUser(Lorg/apache/roller/weblogger/pojos/User;)V == &org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.setUser
    //#post(org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init): init'ed(log)
    //#PlanetRequest.java:33: end of method: org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.org.apache.roller.weblogger.ui.rendering.util.PlanetRequest__static_init
    
    private String context = null;
    private String type = null;
    private String flavor = null;
    private boolean excerpts = false;
    private String language = null;
    private String group = null;
    
    
    /**
     * Construct the PlanetRequest by parsing the incoming url
     */
    public PlanetRequest(HttpServletRequest request) throws InvalidRequestException {
        
        super(request);
    //#PlanetRequest.java:48: method: void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)
    //#input(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): "not a planet request, "._tainted
    //#input(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): "parsing url "._tainted
    //#input(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): log
    //#input(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): request
    //#input(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.authenticUser
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.context
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.excerpts
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.flavor
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.group
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.language
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.request
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.type
    //#output(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.user
    //#pre[1] (void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): log != null
    //#pre[2] (void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): request != null
    //#presumption(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): java.lang.Boolean:valueOf(...)@85 != null
    //#presumption(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): java.lang.String:equals(...)@63 == 1
    //#presumption(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): javax.servlet.http.HttpServletRequest:getLocale(...)@94 != null
    //#presumption(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): javax.servlet.http.HttpServletRequest:getServletPath(...)@53 != null
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): init'ed(this.authenticUser)
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.context == &"planet"
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): init'ed(this.excerpts)
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.flavor in Addr_Set{null,&"rss"}
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): init'ed(this.group)
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): init'ed(this.language)
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.request == request
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.request != null
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.type in Addr_Set{&"feed",&"page"}
    //#post(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): this.user == null
    //#unanalyzed(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): Effects-of-calling:javax.servlet.http.HttpServletRequest:getUserPrincipal
    //#unanalyzed(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): Effects-of-calling:java.security.Principal:getName
    //#unanalyzed(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#test_vector(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): java.lang.String:equals(...)@60: {0}, {1}
    //#test_vector(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): javax.servlet.http.HttpServletRequest:getParameter(...)@84: Addr_Set{null}, Inverse{null}
    //#test_vector(void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)): javax.servlet.http.HttpServletRequest:getParameter(...)@88: Addr_Set{null}, Inverse{null}
        
        // parse the request object and figure out what we've got
        log.debug("parsing url "+request.getRequestURL());
    //#PlanetRequest.java:51: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.rendering.util.PlanetRequest
    //#    method: void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        
        String servlet = request.getServletPath();
        
        // what servlet is our destination?
        if(servlet != null) {
            // strip off the leading slash
            servlet = servlet.substring(1);
            
            if(servlet.equals("planet.do")) {
                this.context = "planet";
                this.type = "page";
            } else if(servlet.equals("planetrss")) {
                this.context = "planet";
                this.type = "feed";
                this.flavor = "rss";
            } else {
                // not a request to a feed servlet
                throw new InvalidRequestException("not a planet request, "+request.getRequestURL());
            }
            
        } else {
            throw new InvalidRequestException("not a planet request, "+request.getRequestURL());
        }
        
        
        /*
         * parse request parameters
         *
         * the only params we currently care about are:
         *   excerpts - specifies the feed should only include excerpts
         *   group - specifies the aggregation group to include
         */
        if (request.getParameter("excerpts") != null) {
            this.excerpts = Boolean.valueOf(request.getParameter("excerpts")).booleanValue();
        }
        
        if (request.getParameter("group") != null) {
            this.group = request.getParameter("group");
        }
        
        
        // language is always from the browser
        language = request.getLocale().getLanguage();
    }
    //#PlanetRequest.java:95: end of method: void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.org.apache.roller.weblogger.ui.rendering.util.PlanetRequest(HttpServletRequest)
    
    
    public String getContext() {
        return context;
    //#PlanetRequest.java:99: method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getContext()
    //#input(String getContext()): this
    //#input(String getContext()): this.context
    //#output(String getContext()): return_value
    //#pre[2] (String getContext()): init'ed(this.context)
    //#post(String getContext()): return_value == this.context
    //#post(String getContext()): init'ed(return_value)
    //#PlanetRequest.java:99: end of method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getContext()
    }
    
    public String getType() {
        return type;
    //#PlanetRequest.java:103: method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getType()
    //#input(String getType()): this
    //#input(String getType()): this.type
    //#output(String getType()): return_value
    //#pre[2] (String getType()): init'ed(this.type)
    //#post(String getType()): return_value == this.type
    //#post(String getType()): init'ed(return_value)
    //#PlanetRequest.java:103: end of method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getType()
    }
    
    public String getFlavor() {
        return flavor;
    //#PlanetRequest.java:107: method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getFlavor()
    //#input(String getFlavor()): this
    //#input(String getFlavor()): this.flavor
    //#output(String getFlavor()): return_value
    //#pre[2] (String getFlavor()): init'ed(this.flavor)
    //#post(String getFlavor()): return_value == this.flavor
    //#post(String getFlavor()): init'ed(return_value)
    //#PlanetRequest.java:107: end of method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getFlavor()
    }
    
    public boolean isExcerpts() {
        return excerpts;
    //#PlanetRequest.java:111: method: bool org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.isExcerpts()
    //#input(bool isExcerpts()): this
    //#input(bool isExcerpts()): this.excerpts
    //#output(bool isExcerpts()): return_value
    //#pre[2] (bool isExcerpts()): init'ed(this.excerpts)
    //#post(bool isExcerpts()): return_value == this.excerpts
    //#post(bool isExcerpts()): init'ed(return_value)
    //#PlanetRequest.java:111: end of method: bool org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.isExcerpts()
    }

    public String getLanguage() {
        return language;
    //#PlanetRequest.java:115: method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getLanguage()
    //#input(String getLanguage()): this
    //#input(String getLanguage()): this.language
    //#output(String getLanguage()): return_value
    //#pre[2] (String getLanguage()): init'ed(this.language)
    //#post(String getLanguage()): return_value == this.language
    //#post(String getLanguage()): init'ed(return_value)
    //#PlanetRequest.java:115: end of method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getLanguage()
    }

    public void setLanguage(String language) {
        this.language = language;
    //#PlanetRequest.java:119: method: void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.setLanguage(String)
    //#input(void setLanguage(String)): language
    //#input(void setLanguage(String)): this
    //#output(void setLanguage(String)): this.language
    //#post(void setLanguage(String)): this.language == language
    //#post(void setLanguage(String)): init'ed(this.language)
    }
    //#PlanetRequest.java:120: end of method: void org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.setLanguage(String)
    
    public String getGroup() {
        return group;
    //#PlanetRequest.java:123: method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getGroup()
    //#input(String getGroup()): this
    //#input(String getGroup()): this.group
    //#output(String getGroup()): return_value
    //#pre[2] (String getGroup()): init'ed(this.group)
    //#post(String getGroup()): return_value == this.group
    //#post(String getGroup()): init'ed(return_value)
    //#PlanetRequest.java:123: end of method: String org.apache.roller.weblogger.ui.rendering.util.PlanetRequest.getGroup()
    }    
}
    //#PlanetRequest.java:: end of class: org.apache.roller.weblogger.ui.rendering.util.PlanetRequest
