Author: ktlili
Date: Thu Jul 26 11:32:36 2007
New Revision: 47

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D47&repname=3D=
jforum_portlet
Log:
- commit sanitas fix (jforum + oracle)

Modified:
    trunk/WEB-INF/config/database/oracle/oracle.sql
    trunk/WEB-INF/log4j.xml
    trunk/src/net/jforum/Command.java
    trunk/src/net/jforum/dao/generic/GenericAttachmentDAO.java
    trunk/src/net/jforum/entities/AttachmentExtensionGroup.java
    trunk/src/net/jforum/util/mail/EmailException.java
    trunk/src/net/jforum/view/forum/PrivateMessageAction.java
    trunk/src/org/jahia/jahiawebapps/jforum/HttpServletRequestWrapper.java
    trunk/src/org/jahia/portlet/jforum/HttpServletRequestWrapper.java

Modified: trunk/WEB-INF/config/database/oracle/oracle.sql
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/WEB-INF/config/=
database/oracle/oracle.sql&rev=3D47&repname=3Djforum_portlet
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/WEB-INF/config/database/oracle/oracle.sql (original)
+++ trunk/WEB-INF/config/database/oracle/oracle.sql Thu Jul 26 11:32:36 2007
@@ -265,8 +265,9 @@
 AttachmentModel.addQuotaLimit =3D INSERT INTO jforum_quota_limit (quota_li=
mit_id, quota_desc, quota_limit, quota_type) VALUES (jforum_quota_limit_seq=
.nextval, ?, ?, ?)
 AttachmentModel.lastGeneratedAttachmentId =3D SELECT jforum_attach_seq.cur=
rval FROM dual
 =

+# fork jahia #
 AttachmentModel.addExtensionGroup =3D INSERT INTO jforum_extension_groups =
(extension_group_id, name, allow, upload_icon, download_mode) \
-       VALUES (jforum_extension_group_seq.nextval, ?, ?, ?, ?)
+       VALUES (jforum_extension_groups_seq.nextval, ?, ?, ?, ?)
 =

 AttachmentModel.addExtension =3D INSERT INTO jforum_extensions (extension_=
id, extension_group_id, description, upload_icon, extension, allow) \
        VALUES (jforum_extensions_seq.nextval, ?, ?, ?, ?, ?)

Modified: trunk/WEB-INF/log4j.xml
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/WEB-INF/log4j.x=
ml&rev=3D47&repname=3Djforum_portlet
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/WEB-INF/log4j.xml (original)
+++ trunk/WEB-INF/log4j.xml Thu Jul 26 11:32:36 2007
@@ -34,7 +34,7 @@
   </category>
 =

   <category name=3D"org.jahia">
-    <priority value=3D"debug"/>
+    <priority value=3D"error"/>
     <appender-ref ref=3D"error"/>
   </category>
 =


Modified: trunk/src/net/jforum/Command.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/net/jforum/=
Command.java&rev=3D47&repname=3Djforum_portlet
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/net/jforum/Command.java (original)
+++ trunk/src/net/jforum/Command.java Thu Jul 26 11:32:36 2007
@@ -61,91 +61,87 @@
  * @author Rafael Steil
  * @version $Id: Command.java,v 1.19 2006/01/29 15:06:59 rafaelsteil Exp $
  */
-public abstract class Command
-{
-       private static Class[] NO_ARGS_CLASS =3D new Class[0];
-       private static Object[] NO_ARGS_OBJECT =3D new Object[0];
-
-       private boolean ignoreAction;
-
-       protected String templateName;
-       protected ActionServletRequest request;
-       protected HttpServletResponse response;
-       protected SimpleHash context;
-
-       protected void setTemplateName(String templateName)
-       {
-               this.templateName =3D Tpl.name(templateName);
-       }
-
-       protected void ignoreAction()
-       {
-               this.ignoreAction =3D true;
-       }
-
-       /**
-        * Base method for listings.
-        * May be used as general listing or as helper
-        * to another specialized type of listing. Subclasses
-        * must implement it to the cases where some invalid
-        * action is called ( which means that the exception will
-        * be caught and the general listing will be used )
-        *
-        * @throws Exception
-        */
-       public abstract void list() throws Exception;
-
-       /**
-        * Process and manipulate a requisition.
-        * @param context TODO
-        * @throws Exception
-        * @return <code>Template</code> reference
-        */
-       public Template process(ActionServletRequest request,
-                       HttpServletResponse response,
-                       SimpleHash context) throws Exception
-       {
-               this.request =3D request;
-               this.response =3D response;
-               this.context =3D context;
-
-               String action =3D this.request.getAction();
-
-               if (!this.ignoreAction) {
-                       try {
-                               this.getClass().getMethod(action, 
NO_ARGS_CLASS).invoke(this, NO_ARGS_=
OBJECT);
-                       }
-                       catch (NoSuchMethodException e) {
-                               this.list();
-                       }
-                        catch(java.lang.reflect.InvocationTargetException =
e){
-                            e.getTargetException().printStackTrace();
-                        }
-                       catch (Exception e) {
-
-
-                               throw e;
-
-                       }
-               }
-
-               if (JForumExecutionContext.getRedirectTo() !=3D null) {
-                       this.setTemplateName(TemplateKeys.EMPTY);
-               }
-               else if (request.getAttribute("template") !=3D null) {
-                       
this.setTemplateName((String)request.getAttribute("template"));
-               }
-
-               if (JForumExecutionContext.isCustomContent()) {
-                       return null;
-               }
-
-               if (this.templateName =3D=3D null) {
-                       throw new TemplateNotFoundException("Template for 
action " + action + "=
 is not defined");
-               }
-
-               return JForumExecutionContext.templateConfig().getTemplate(
-                               new 
StringBuffer(SystemGlobals.getValue(ConfigKeys.TEMPLATE_DIR)).
-                               
append('/').append(this.templateName).toString());
+public abstract class Command {
+    private static Class[] NO_ARGS_CLASS =3D new Class[0];
+    private static Object[] NO_ARGS_OBJECT =3D new Object[0];
+
+    private boolean ignoreAction;
+
+    protected String templateName;
+    protected ActionServletRequest request;
+    protected HttpServletResponse response;
+    protected SimpleHash context;
+
+    protected void setTemplateName(String templateName) {
+        this.templateName =3D Tpl.name(templateName);
+    }
+
+    protected void ignoreAction() {
+        this.ignoreAction =3D true;
+    }
+
+    /**
+     * Base method for listings.
+     * May be used as general listing or as helper
+     * to another specialized type of listing. Subclasses
+     * must implement it to the cases where some invalid
+     * action is called ( which means that the exception will
+     * be caught and the general listing will be used )
+     *
+     * @throws Exception
+     */
+    public abstract void list() throws Exception;
+
+    /**
+     * Process and manipulate a requisition.
+     *
+     * @param context TODO
+     * @return <code>Template</code> reference
+     * @throws Exception
+     */
+    public Template process(ActionServletRequest request,
+                            HttpServletResponse response,
+                            SimpleHash context) throws Exception {
+        this.request =3D request;
+        this.response =3D response;
+        this.context =3D context;
+
+        String action =3D this.request.getAction();
+
+        if (!this.ignoreAction) {
+            try {
+                this.getClass().getMethod(action, NO_ARGS_CLASS).invoke(th=
is, NO_ARGS_OBJECT);
+            }
+            catch (NoSuchMethodException e) {
+                this.list();
+            }
+            catch (java.lang.reflect.InvocationTargetException e) {
+                e.getTargetException().printStackTrace();
+            }
+            catch (Exception e) {
+
+
+                throw e;
+
+            }
+        }
+
+        if (JForumExecutionContext.getRedirectTo() !=3D null) {
+            this.setTemplateName(TemplateKeys.EMPTY);
+        } else if (request.getAttribute("template") !=3D null) {
+            this.setTemplateName((String) request.getAttribute("template")=
);
+        }
+
+        if (JForumExecutionContext.isCustomContent()) {
+            return null;
+        }
+
+        if (this.templateName =3D=3D null) {
+            throw new TemplateNotFoundException("Template for action " + a=
ction + " is not defined");
+        }
+
+        return JForumExecutionContext.templateConfig().getTemplate(
+                new StringBuffer(SystemGlobals.getValue(ConfigKeys.TEMPLAT=
E_DIR)).
+                        append('/').append(this.templateName).toString());
        }
 }

Modified: trunk/src/net/jforum/dao/generic/GenericAttachmentDAO.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/net/jforum/=
dao/generic/GenericAttachmentDAO.java&rev=3D47&repname=3Djforum_portlet
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/net/jforum/dao/generic/GenericAttachmentDAO.java (original)
+++ trunk/src/net/jforum/dao/generic/GenericAttachmentDAO.java Thu Jul 26 1=
1:32:36 2007
@@ -223,8 +223,8 @@
                p.setInt(2, g.isAllow() ? 1 : 0);
                p.setString(3, g.getUploadIcon());
                p.setInt(4, g.getDownloadMode());
-               p.executeUpdate();
-               p.close();
+        p.executeUpdate();
+        p.close();
        }
        =

        /**

Modified: trunk/src/net/jforum/entities/AttachmentExtensionGroup.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/net/jforum/=
entities/AttachmentExtensionGroup.java&rev=3D47&repname=3Djforum_portlet
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/net/jforum/entities/AttachmentExtensionGroup.java (original)
+++ trunk/src/net/jforum/entities/AttachmentExtensionGroup.java Thu Jul 26 =
11:32:36 2007
@@ -52,9 +52,9 @@
        public static final int DOWNLOAD_PHYSICAL =3D 2;
        =

        private int id;
-       private String name;
+       private String name =3D "unknown";
        private boolean allow;
-       private String uploadIcon;
+       private String uploadIcon =3D "unknown";
        private int downloadMode;
        =

        /**

Modified: trunk/src/net/jforum/util/mail/EmailException.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/net/jforum/=
util/mail/EmailException.java&rev=3D47&repname=3Djforum_portlet
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/net/jforum/util/mail/EmailException.java (original)
+++ trunk/src/net/jforum/util/mail/EmailException.java Thu Jul 26 11:32:36 =
2007
@@ -52,11 +52,13 @@
        {
                super(e);
                this.setStackTrace(e.getStackTrace());
-       }
+        e.printStackTrace();
+    }
        =

        public EmailException(String message, Exception e)
        {
                super(message, e);
                this.setStackTrace(e.getStackTrace());
-       }
+         e.printStackTrace();
+    }
 }
\ No newline at end of file

Modified: trunk/src/net/jforum/view/forum/PrivateMessageAction.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/net/jforum/=
view/forum/PrivateMessageAction.java&rev=3D47&repname=3Djforum_portlet
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/net/jforum/view/forum/PrivateMessageAction.java (original)
+++ trunk/src/net/jforum/view/forum/PrivateMessageAction.java Thu Jul 26 11=
:32:36 2007
@@ -46,6 +46,7 @@
 =

 import net.jforum.Command;
 import net.jforum.SessionFacade;
+import net.jforum.JForumContext;
 import net.jforum.dao.DataAccessDriver;
 import net.jforum.dao.UserDAO;
 import net.jforum.entities.Post;
@@ -226,10 +227,12 @@
                        
DataAccessDriver.getInstance().newPrivateMessageDAO().send(pm);
                        =

                        this.setTemplateName(TemplateKeys.PM_SENDSAVE);
-                       this.context.put("message", 
I18n.getMessage("PrivateMessage.messageSent=
", =

+                       /*this.context.put("message", 
I18n.getMessage("PrivateMessage.messageSe=
nt",
                                                        new String[] { 
this.request.getContextPath() +"/pm/inbox"
-                                                                               
        + SystemGlobals.getValue(ConfigKeys.SERVLET_EXTENSION)}));
-                       =

+                                                                               
        + SystemGlobals.getValue(ConfigKeys.SERVLET_EXTENSION)}));*/
+            this.context.put("message", I18n.getMessage("PrivateMessage.me=
ssageSent",
+                                                       new String[] { 
request.getJForumContext().encodeURL("/pm/inbox")}));
+
                        // If the target user if in the forum, then increments 
its =

                        // private messate count
                        String sid =3D SessionFacade.isUserInSession(toUserId);

Modified: trunk/src/org/jahia/jahiawebapps/jforum/HttpServletRequestWrapper=
.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/org/jahia/j=
ahiawebapps/jforum/HttpServletRequestWrapper.java&rev=3D47&repname=3Djforum=
_portlet
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/org/jahia/jahiawebapps/jforum/HttpServletRequestWrapper.java =
(original)
+++ trunk/src/org/jahia/jahiawebapps/jforum/HttpServletRequestWrapper.java =
Thu Jul 26 11:32:36 2007
@@ -3,192 +3,193 @@
 import javax.servlet.http.*;
 import javax.servlet.http.*;
 import java.util.*;
+
 import net.jforum.util.preferences.SystemGlobals;
 import net.jforum.util.preferences.ConfigKeys;
 import org.jahia.portlet.util.StringUtil;
 import org.apache.log4j.Logger;
 =

 /**
- *  HttpServletWrapper that emulates a "jforum-servlet" request from a real
- *  HttpServletRequest
+ * HttpServletWrapper that emulates a "jforum-servlet" request from a real
+ * HttpServletRequest
  *
- [EMAIL PROTECTED]    Khaled TLILI
+ * @author Khaled TLILI
  */
 public class HttpServletRequestWrapper extends javax.servlet.http.HttpServ=
letRequestWrapper {
-       private String defaultRequestUri;
-       private String defaultModule;
-       private String defaultAction;
-       private HttpSessionWrapper session;
-        private static Logger logger =3D Logger.getLogger(HttpServletReque=
stWrapper.class);
-
-
-
-       /**
-        *  Constructor for the HttpServletRequestWrapper object
-        *
-        [EMAIL PROTECTED]  request            render request object
-        [EMAIL PROTECTED]  defaultRequestUri  defaut query string if no uri 
found
-        [EMAIL PROTECTED]  defaultModule      Description of Parameter
-        [EMAIL PROTECTED]  defaultAction      Description of Parameter
-        */
-       public HttpServletRequestWrapper(HttpServletRequest request, String 
defau=
ltRequestUri, String defaultModule, String defaultAction) {
-               super(request);
-               this.defaultRequestUri =3D defaultRequestUri;
-               this.defaultModule =3D defaultModule;
-               this.defaultAction =3D defaultAction;
-               session =3D new HttpSessionWrapper(super.getSession());
-
-       }
-
-
-       /**
-        *  Gets the ParameterNames attribute of the HttpServletRequestWrapper 
ob=
ject
-        *
-        [EMAIL PROTECTED]    The ParameterNames value
-        */
-       public Enumeration getParameterNames() {
-               Enumeration superParamNames =3D super.getParameterNames();
-               if (isFirstAction()) {
-                       // at least module and action param name exist
-                       String strgToken =3D "module&action";
-
-                       // add others name parameters
-                       if (superParamNames !=3D null) {
-                               while (superParamNames.hasMoreElements()) {
-                                       String name =3D (String) 
superParamNames.nextElement();
-                                       if (!name.equalsIgnoreCase("module") &&
-                                                       
!name.equalsIgnoreCase("action")) {
-                                               strgToken =3D strgToken + "&" + 
name;
-                                       }
-                               }
-                       }
-
-                       // build enumearaiton objct
-                       Enumeration finalParamNames =3D new 
StringTokenizer(strgToken, "&");
-                       return finalParamNames;
-               }
-               else {
-                       return super.getParameterNames();
-               }
-       }
-
-
-       /**
-        *  Gets the QueryString attribute of the HttpServletRequestWrapper 
object
-        *
-        [EMAIL PROTECTED]    The QueryString value
-        */
-       public String getQueryString() {
-               String s =3D super.getQueryString();
-               if (isFirstAction()) {
-                       s =3D "module=3D" + defaultModule + "&action=3D" + 
defaultAction;
-               }
-
-               return StringUtil.replaceSpecialGraphics(s);
-       }
-
-
-       /**
-        *  Gets the RequestURI attribute of the HttpServletRequestWrapper 
object
-        *
-        [EMAIL PROTECTED]    The RequestURI value
-        */
-       public String getRequestURI() {
-               String requestURI =3D super.getRequestURI();
-               if (isFirstAction()) {
-                       logger.debug("Real requestURI is: " + requestURI + ". 
replaced whith: "=
 + defaultRequestUri);
-                       return defaultRequestUri;
-               }
-               else {
-                    // e.g.: jforum.page#3 --> jforum.page
-                       StringTokenizer st =3D new StringTokenizer(requestURI, 
"#");
-                       requestURI =3D (String) st.nextToken();
-                       return requestURI;
-               }
-       }
-
-
-
-       /**
-        *  Gets the Method attribute of the HttpServletRequestWrapper object
-        */
-       /*
-        *  public String getMethod() {
-        *  String s =3D getParameter("httpMethod");
-        *  if (s =3D=3D null) {
-        *  s =3D "GET";
-        *  }
-        *  return s;
-        *  }
-        */
-       /**
-        *  Gets the Parameter attribute of the HttpServletRequestWrapper object
-        *
-        [EMAIL PROTECTED]  name  Description of Parameter
-        [EMAIL PROTECTED]       The Parameter value
-        */
-       public String getParameter(String name) {
-               String value =3D super.getParameter(name);
-               if (isFirstAction()) {
-                       logger.debug("value is null!! for param: " + name);
-                       if (name.equalsIgnoreCase("module")) {
-                               logger.debug("Use default value for param: " + 
name + "," + defaultMod=
ule);
-                               return defaultModule;
-                       }
-                       else if (name.equalsIgnoreCase("action")) {
-                               logger.debug("Use default value for param: " + 
name + "," + defaultAct=
ion);
-                               return defaultAction;
-                       }
-                       else {
-                               logger.debug("No default value for param: " + 
name);
-                       }
-               }
-               else {
-                       logger.debug(" Found param: " + name + "," + value);
-               }
-
-                // fix bug: remove .page extension
-                if(value.endsWith(SystemGlobals.getValue(ConfigKeys.SERVLE=
T_EXTENSION))){
-                    value =3D value.replaceAll(SystemGlobals.getValue(Conf=
igKeys.SERVLET_EXTENSION),"");
+    private String defaultRequestUri;
+    private String defaultModule;
+    private String defaultAction;
+    private HttpSessionWrapper session;
+    private static Logger logger =3D Logger.getLogger(HttpServletRequestWr=
apper.class);
+
+
+    /**
+     * Constructor for the HttpServletRequestWrapper object
+     *
+     * @param request           render request object
+     * @param defaultRequestUri defaut query string if no uri found
+     * @param defaultModule     Description of Parameter
+     * @param defaultAction     Description of Parameter
+     */
+    public HttpServletRequestWrapper(HttpServletRequest request, String de=
faultRequestUri, String defaultModule, String defaultAction) {
+        super(request);
+        this.defaultRequestUri =3D defaultRequestUri;
+        this.defaultModule =3D defaultModule;
+        this.defaultAction =3D defaultAction;
+        session =3D new HttpSessionWrapper(super.getSession());
+
+    }
+
+
+    /**
+     * Gets the ParameterNames attribute of the HttpServletRequestWrapper =
object
+     *
+     * @return The ParameterNames value
+     */
+    public Enumeration getParameterNames() {
+        Enumeration superParamNames =3D super.getParameterNames();
+        if (isFirstAction()) {
+            // at least module and action param name exist
+            String strgToken =3D "module&action";
+
+            // add others name parameters
+            if (superParamNames !=3D null) {
+                while (superParamNames.hasMoreElements()) {
+                    String name =3D (String) superParamNames.nextElement();
+                    if (!name.equalsIgnoreCase("module") &&
+                            !name.equalsIgnoreCase("action")) {
+                        strgToken =3D strgToken + "&" + name;
+                    }
                 }
+            }
 =

-               return value;
-       }
-
-
-       /**
-        *  Gets the Session attribute of the HttpServletRequestWrapper object
-        *
-        [EMAIL PROTECTED]    The Session value
-        */
-       public HttpSession getSession() {
-               return session;
-       }
-
-
-       /**
-        *  Gets the Session attribute of the HttpServletRequestWrapper object
-        *
-        [EMAIL PROTECTED]  newSession  Description of Parameter
-        [EMAIL PROTECTED]             The Session value
-        */
-       public HttpSession getSession(boolean newSession) {
-               return new HttpSessionWrapper(super.getSession(newSession));
-       }
-
-
-
-       /**
-        *  Gets the FirstAction attribute of the HttpServletRequestWrapper 
object
-        *
-        [EMAIL PROTECTED]    The FirstAction value
-        */
-       private boolean isFirstAction() {
-               String requestUri =3D super.getRequestURI();
-               // jforum.page#3 --> jforum.page
-               StringTokenizer st =3D new StringTokenizer(requestUri, "#");
-               requestUri =3D (String) st.nextToken();
-               return 
!requestUri.endsWith(SystemGlobals.getValue(ConfigKeys.SERVLET_EX=
TENSION));
-       }
+            // build enumearaiton objct
+            Enumeration finalParamNames =3D new StringTokenizer(strgToken,=
 "&");
+            return finalParamNames;
+        } else {
+            return super.getParameterNames();
+        }
+    }
+
+
+    /**
+     * Gets the QueryString attribute of the HttpServletRequestWrapper obj=
ect
+     *
+     * @return The QueryString value
+     */
+    public String getQueryString() {
+        String s =3D super.getQueryString();
+        if (isFirstAction()) {
+            s =3D "module=3D" + defaultModule + "&action=3D" + defaultActi=
on;
+        }
+
+        return StringUtil.replaceSpecialGraphics(s);
+    }
+
+
+    /**
+     * Gets the RequestURI attribute of the HttpServletRequestWrapper obje=
ct
+     *
+     * @return The RequestURI value
+     */
+    public String getRequestURI() {
+        String requestURI =3D super.getRequestURI();
+        if (isFirstAction()) {
+            logger.debug("Real requestURI is: " + requestURI + ". replaced=
 whith: " + defaultRequestUri);
+            return defaultRequestUri;
+        } else {
+            // e.g.: jforum.page#3 --> jforum.page
+            StringTokenizer st =3D new StringTokenizer(requestURI, "#");
+            requestURI =3D (String) st.nextToken();
+            return requestURI;
+        }
+    }
+
+    /**
+     *  Gets the Method attribute of the HttpServletRequestWrapper object
+     */
+    /*
+      *  public String getMethod() {
+      *  String s =3D getParameter("httpMethod");
+      *  if (s =3D=3D null) {
+      *  s =3D "GET";
+      *  }
+      *  return s;
+      *  }
+      */
+    /**
+     * Gets the Parameter attribute of the HttpServletRequestWrapper object
+     *
+     * @param name Description of Parameter
+     * @return The Parameter value
+     */
+    public String getParameter(String name) {
+        String value =3D super.getParameter(name);
+        if (isFirstAction()) {
+            logger.debug("value is null!! for param: " + name);
+            if (name.equalsIgnoreCase("module")) {
+                logger.debug("Use default value for param: " + name + "," =
+ defaultModule);
+                return defaultModule;
+            } else if (name.equalsIgnoreCase("action")) {
+                logger.debug("Use default value for param: " + name + "," =
+ defaultAction);
+                return defaultAction;
+            } else {
+                logger.debug("No default value for param: " + name);
+            }
+        } else {
+            logger.debug(" Found param: " + name + "," + value);
+        }
+
+        // fix bug: remove .page extension
+        if (value.endsWith(SystemGlobals.getValue(ConfigKeys.SERVLET_EXTEN=
SION))) {
+            value =3D value.replaceAll(SystemGlobals.getValue(ConfigKeys.S=
ERVLET_EXTENSION), "");
+        }
+
+        return value;
+    }
+
+
+    /**
+     * Gets the Session attribute of the HttpServletRequestWrapper object
+     *
+     * @return The Session value
+     */
+    public HttpSession getSession() {
+        return session;
+    }
+
+
+    /**
+     * Gets the Session attribute of the HttpServletRequestWrapper object
+     *
+     * @param newSession Description of Parameter
+     * @return The Session value
+     */
+    public HttpSession getSession(boolean newSession) {
+        return new HttpSessionWrapper(super.getSession(newSession));
+    }
+
+
+    /**
+     * Gets the FirstAction attribute of the HttpServletRequestWrapper obj=
ect
+     *
+     * @return The FirstAction value
+     */
+    private boolean isFirstAction() {
+        String requestUri =3D super.getRequestURI();
+        // jforum.page#3 --> jforum.page
+        StringTokenizer st =3D new StringTokenizer(requestUri, "#");
+        requestUri =3D (String) st.nextToken();
+        return !requestUri.endsWith(SystemGlobals.getValue(ConfigKeys.SERV=
LET_EXTENSION));
+    }
+
+
+    public String getRemoteAddr() {
+        String remoteAddr =3D  super.getRemoteAddr();
+        if (remoteAddr =3D=3D null) {
+            return "unknown";
+        }
 =

+        return remoteAddr;
+    }
 }

Modified: trunk/src/org/jahia/portlet/jforum/HttpServletRequestWrapper.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/src/org/jahia/p=
ortlet/jforum/HttpServletRequestWrapper.java&rev=3D47&repname=3Djforum_port=
let
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/src/org/jahia/portlet/jforum/HttpServletRequestWrapper.java (orig=
inal)
+++ trunk/src/org/jahia/portlet/jforum/HttpServletRequestWrapper.java Thu J=
ul 26 11:32:36 2007
@@ -72,7 +72,7 @@
      */
     public String getRemoteAddr() {
         logger.debug(" cannot getRemoteAddr on a PortletRequest!");
-        return "";
+        return "unknown";
     }
 =

 =


_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to