Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum
In directory
james.mmbase.org:/tmp/cvs-serv23342/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum
Modified Files:
ServletOutputStreamWrapper.java HttpSessionWrapper.java
PortalAutoConnectUserManager.java
HttpServletResponseWrapper.java JForumJahiaWebAppBridge.java
ServletConfigWrapper.java HttpServletRequestWrapper.java
Log Message:
CMSC-1091 improve code of JForum.
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum
See also: http://www.mmbase.org/jira/browse/CMSC-1091
Index: ServletOutputStreamWrapper.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum/ServletOutputStreamWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ServletOutputStreamWrapper.java 17 Jan 2008 08:04:51 -0000 1.1
+++ ServletOutputStreamWrapper.java 15 Oct 2008 11:43:54 -0000 1.2
@@ -2,12 +2,13 @@
import javax.servlet.ServletOutputStream;
import java.util.*;
+
import org.apache.log4j.Logger;
/**
* Outputstream Wrapper
*
- [EMAIL PROTECTED] Tlili Khaled
+ * @author Tlili Khaled
*/
public class ServletOutputStreamWrapper extends ServletOutputStream {
private ArrayList byteList = new ArrayList();
@@ -17,7 +18,7 @@
/**
* Gets the AsByteArray attribute of the ServletOutputStreamWrapper
object
*
- [EMAIL PROTECTED] The AsByteArray value
+ * @return The AsByteArray value
*/
public byte[] getAsByteArray() {
byte[] bb = new byte[byteList.size()];
@@ -32,12 +33,12 @@
/**
* Writes the specified byte to this output stream.
*
- [EMAIL PROTECTED] b the <code>byte</code>.
- [EMAIL PROTECTED] java.io.IOException Description of Exception
- [EMAIL PROTECTED] IOException if an I/O error occurs. In
particular, an
+ * @param b the <code>byte</code>.
+ * @throws java.io.IOException Description of Exception
+ * @throws IOException if an I/O error occurs. In particular, an
* <code>IOException</code> may be thrown if the output stream has
been
* closed.
- [EMAIL PROTECTED] Implement this
java.io.OutputStream method
+ * @todo Implement this java.io.OutputStream method
*/
public void write(int b) throws java.io.IOException {
Byte bb = new Byte(String.valueOf(b));
@@ -52,8 +53,8 @@
/**
* Writes the specified byte array to this output stream.
*
- [EMAIL PROTECTED] bytes Description of Parameter
- [EMAIL PROTECTED] java.io.IOException Description of Exception
+ * @param bytes Description of Parameter
+ * @throws java.io.IOException Description of Exception
*/
public void write(byte[] bytes) throws java.io.IOException {
for (int i = 0; i < bytes.length; i++) {
@@ -70,10 +71,10 @@
/**
* Writes the specified byte array to this output stream.
*
- [EMAIL PROTECTED] bytes Description of Parameter
- [EMAIL PROTECTED] off Description of Parameter
- [EMAIL PROTECTED] length Description of Parameter
- [EMAIL PROTECTED] java.io.IOException Description of Exception
+ * @param bytes Description of Parameter
+ * @param off Description of Parameter
+ * @param length Description of Parameter
+ * @throws java.io.IOException Description of Exception
*/
public void write(byte[] bytes, int off, int length) throws
java.io.IOException {
for (int i = off; i < (off + length); i++) {
@@ -87,11 +88,10 @@
}
-
/**
* flush
*
- [EMAIL PROTECTED] java.io.IOException Description of Exception
+ * @throws java.io.IOException Description of Exception
*/
public void flush() throws java.io.IOException {
logger.debug("Call flush method");
Index: HttpSessionWrapper.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum/HttpSessionWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- HttpSessionWrapper.java 17 Jan 2008 08:04:51 -0000 1.1
+++ HttpSessionWrapper.java 15 Oct 2008 11:43:54 -0000 1.2
@@ -9,7 +9,7 @@
/**
* Http sesson Wrapper in order to be compatible whith jahia session
*
- [EMAIL PROTECTED] Khaled TLILI
+ * @author Khaled TLILI
*/
public class HttpSessionWrapper implements HttpSession {
private HttpSession session;
@@ -18,7 +18,7 @@
/**
* Constructor for the HttpSessionWrapper object
*
- [EMAIL PROTECTED] session Description of Parameter
+ * @param session Description of Parameter
*/
public HttpSessionWrapper(HttpSession session) {
this.session = session;
@@ -28,15 +28,14 @@
/**
* setAttribute
*
- [EMAIL PROTECTED] name The new Attribute value
- [EMAIL PROTECTED] value The new Attribute value
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpSession method
+ * @param name The new Attribute value
+ * @param value The new Attribute value
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public void setAttribute(String name, Object value) {
if (value == null) {
session.removeAttribute(name);
- }
- else {
+ } else {
session.setAttribute(name, value);
}
}
@@ -45,8 +44,8 @@
/**
* setMaxInactiveInterval
*
- [EMAIL PROTECTED] mii The new MaxInactiveInterval value
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpSession method
+ * @param mii The new MaxInactiveInterval value
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public void setMaxInactiveInterval(int mii) {
session.setMaxInactiveInterval(mii);
@@ -56,9 +55,9 @@
/**
* getAttribute
*
- [EMAIL PROTECTED] name Description of Parameter
- [EMAIL PROTECTED] Object
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpSession method
+ * @param name Description of Parameter
+ * @return Object
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public Object getAttribute(String name) {
return session.getAttribute(name);
@@ -68,8 +67,8 @@
/**
* getAttributeNames
*
- [EMAIL PROTECTED] Enumeration
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return Enumeration
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public Enumeration getAttributeNames() {
return session.getAttributeNames();
@@ -79,8 +78,8 @@
/**
* getCreationTime
*
- [EMAIL PROTECTED] long
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return long
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public long getCreationTime() {
return session.getCreationTime();
@@ -90,8 +89,8 @@
/**
* getId
*
- [EMAIL PROTECTED] String
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return String
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public String getId() {
return session.getId();
@@ -101,8 +100,8 @@
/**
* getLastAccessedTime
*
- [EMAIL PROTECTED] long
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return long
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public long getLastAccessedTime() {
return session.getLastAccessedTime();
@@ -112,8 +111,8 @@
/**
* getMaxInactiveInterval
*
- [EMAIL PROTECTED] int
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return int
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public int getMaxInactiveInterval() {
return session.getMaxInactiveInterval();
@@ -123,8 +122,8 @@
/**
* getServletContext
*
- [EMAIL PROTECTED] ServletContext
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return ServletContext
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public ServletContext getServletContext() {
return session.getServletContext();
@@ -134,8 +133,8 @@
/**
* getSessionContext
*
- [EMAIL PROTECTED] HttpSessionContext
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return HttpSessionContext
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public HttpSessionContext getSessionContext() {
return null;
@@ -145,9 +144,9 @@
/**
* getValue
*
- [EMAIL PROTECTED] name Description of Parameter
- [EMAIL PROTECTED] Object
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpSession method
+ * @param name Description of Parameter
+ * @return Object
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public Object getValue(String name) {
return session.getValue(name);
@@ -157,8 +156,8 @@
/**
* getValueNames
*
- [EMAIL PROTECTED] String[]
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return String[]
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public String[] getValueNames() {
return session.getValueNames();
@@ -168,8 +167,8 @@
/**
* isNew
*
- [EMAIL PROTECTED] boolean
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @return boolean
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public boolean isNew() {
return session.isNew();
@@ -179,7 +178,7 @@
/**
* invalidate
*
- [EMAIL PROTECTED] Implement this javax.servlet.http.HttpSession
method
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public void invalidate() {
session.invalidate();
@@ -189,9 +188,9 @@
/**
* putValue
*
- [EMAIL PROTECTED] name Description of Parameter
- [EMAIL PROTECTED] value Description of Parameter
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpSession method
+ * @param name Description of Parameter
+ * @param value Description of Parameter
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public void putValue(String name, Object value) {
session.putValue(name, value);
@@ -201,8 +200,8 @@
/**
* removeAttribute
*
- [EMAIL PROTECTED] name Description of Parameter
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpSession method
+ * @param name Description of Parameter
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public void removeAttribute(String name) {
session.removeAttribute(name);
@@ -212,8 +211,8 @@
/**
* removeValue
*
- [EMAIL PROTECTED] value Description of Parameter
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpSession method
+ * @param value Description of Parameter
+ * @todo Implement this javax.servlet.http.HttpSession method
*/
public void removeValue(String value) {
session.removeValue(value);
Index: PortalAutoConnectUserManager.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum/PortalAutoConnectUserManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- PortalAutoConnectUserManager.java 3 Jul 2008 11:34:58 -0000 1.2
+++ PortalAutoConnectUserManager.java 15 Oct 2008 11:43:54 -0000 1.3
@@ -2,6 +2,7 @@
import javax.servlet.http.*;
import java.io.IOException;
+
import net.jforum.dao.DataAccessDriver;
import net.jforum.dao.UserDAO;
import net.jforum.util.MD5;
@@ -13,7 +14,7 @@
/**
* Manage Auto portal connect user to JForum
*
- [EMAIL PROTECTED] Khaled TLILI
+ * @author Khaled TLILI
*/
public class PortalAutoConnectUserManager {
private final String GUEST = "guest";
@@ -24,13 +25,11 @@
private static Logger logger =
Logger.getLogger(PortalAutoConnectUserManager.class);
-
-
/**
* Constructor for the PortalAutoConnectUserManager object
*
- [EMAIL PROTECTED] request Description of Parameter
- [EMAIL PROTECTED] response Description of Parameter
+ * @param request Description of Parameter
+ * @param response Description of Parameter
*/
public PortalAutoConnectUserManager(HttpServletRequest request,
HttpServletResponse response) {
this.request = request;
@@ -42,7 +41,7 @@
/**
* Gets the Registred attribute of the PortalAutoConnectUserManager
class
*
- [EMAIL PROTECTED] The Registred value
+ * @return The Registred value
*/
public boolean isRegistred() {
try {
@@ -61,7 +60,7 @@
* Gets the Administrator attribute of the PortalAutoConnectUserManager
* object
*
- [EMAIL PROTECTED] The Administrator value
+ * @return The Administrator value
*/
public boolean isAdministrator() {
return request.isUserInRole(ADMINISTRATOR_ROLE);
@@ -71,7 +70,7 @@
/**
* Description of the Method
*
- [EMAIL PROTECTED] Description of the Returned Value
+ * @return Description of the Returned Value
*/
public boolean processSSO() {
// set pass to be used by sso
@@ -87,12 +86,10 @@
}
-
-
/**
* process auto actions (register, connect)
*
- [EMAIL PROTECTED] True if an auto action was performed
+ * @return True if an auto action was performed
*/
public boolean process() {
if (isPortlatUser()) {
@@ -104,27 +101,23 @@
logger.debug("Process: do register");
doAutoRegisteUser();
return true;
- }
- else {
+ } else {
return false;
}
- }
- else {
+ } else {
// is already registred
if (hasToMakeLogin()) {
logger.debug("Process: do connect");
doAutoConnectUser();
return true;
- }
- else {
+ } else {
//already connected
logger.debug("Process: already
connected");
return false;
}
}
- }
- else {
+ } else {
logger.debug("AutoConnect: do nothing");
// not a portal user --> do nothink
return false;
@@ -136,7 +129,7 @@
* Gets the PortalUserPassword attribute of the
PortalAutoConnectUserManager
* object
*
- [EMAIL PROTECTED] The PortalUserPassword value
+ * @return The PortalUserPassword value
*/
private String getPortalUserPassword() {
String username = request.getRemoteUser();
@@ -147,7 +140,7 @@
/**
* Gets the PortlatUser attribute of the PortalAutoConnectUserManager
object
*
- [EMAIL PROTECTED] The PortlatUser value
+ * @return The PortlatUser value
*/
private boolean isPortlatUser() {
String user = request.getRemoteUser();
@@ -189,7 +182,7 @@
/**
* Do a ajavascript redirection
*
- [EMAIL PROTECTED] redirectUrl Description of Parameter
+ * @param redirectUrl Description of Parameter
*/
private void doRedirection(String redirectUrl) {
String script = "<script> document.location='" +
response.encodeURL(redirectUrl) + "'; </script>";
@@ -202,7 +195,6 @@
}
-
/**
* Auto register user
*/
@@ -232,7 +224,6 @@
}
-
/**
* Validate auto login
*/
@@ -249,19 +240,17 @@
}
-
/**
* True if autologin has to be performed
*
- [EMAIL PROTECTED] Description of the Returned Value
+ * @return Description of the Returned Value
*/
private boolean hasToMakeLogin() {
HttpSession session = request.getSession();
Object o = session.getAttribute("autologin");
if (o == null) {
return true;
- }
- else {
+ } else {
return false;
}
}
@@ -270,7 +259,7 @@
/**
* True if autoregistering has to be performed
*
- [EMAIL PROTECTED] Description of the Returned Value
+ * @return Description of the Returned Value
*/
private boolean hasToMakeRegister() {
HttpSession session = request.getSession();
Index: HttpServletResponseWrapper.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum/HttpServletResponseWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- HttpServletResponseWrapper.java 17 Jan 2008 08:04:51 -0000 1.1
+++ HttpServletResponseWrapper.java 15 Oct 2008 11:43:54 -0000 1.2
@@ -5,18 +5,21 @@
import javax.servlet.ServletOutputStream;
import java.util.StringTokenizer;
import java.util.Enumeration;
+
import org.jahia.portlet.util.StringUtil;
+
import java.net.URL;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.HashMap;
+
import org.apache.log4j.Logger;
/**
* HttpServletResponseWrapper that emulates a "jforum-servlet" response from
* a RenderResponse
*
- [EMAIL PROTECTED] Khaled TLILI
+ * @author Khaled TLILI
*/
public class HttpServletResponseWrapper extends
javax.servlet.http.HttpServletResponseWrapper {
private String redirect = null;
@@ -24,12 +27,10 @@
private static Logger logger =
Logger.getLogger(HttpServletRequestWrapper.class);
-
-
/**
* Constructor for the HttpServletResponseWrapper object
*
- [EMAIL PROTECTED] response Description of Parameter
+ * @param response Description of Parameter
*/
public HttpServletResponseWrapper(HttpServletResponse response) {
super(response);
@@ -41,7 +42,7 @@
/**
* Gets the Redirect attribute of the HttpServletResponseWrapper object
*
- [EMAIL PROTECTED] The Redirect value
+ * @return The Redirect value
*/
public boolean isRedirect() {
return redirect != null;
@@ -52,7 +53,7 @@
* Gets the EncodedRedirect attribute of the HttpServletResponseWrapper
* object
*
- [EMAIL PROTECTED] The EncodedRedirect value
+ * @return The EncodedRedirect value
*/
public String getEncodedRedirect() {
return encodeURL(redirect);
@@ -62,8 +63,8 @@
/**
* Gets the OutputStream attribute of the HttpServletResponseWrapper
object
*
- [EMAIL PROTECTED] The OutputStream value
- [EMAIL PROTECTED] IOException Description of Exception
+ * @return The OutputStream value
+ * @throws IOException Description of Exception
*/
public ServletOutputStream getOutputStream() throws IOException {
return servletOutputStream;
@@ -73,19 +74,18 @@
/**
* Description of the Method
*
- [EMAIL PROTECTED] urlValue Description of Parameter
- [EMAIL PROTECTED] Description of the Returned Value
+ * @param urlValue Description of Parameter
+ * @return Description of the Returned Value
*/
public String encodeURL(String urlValue) {
return super.encodeURL(StringUtil.replaceSpecialGraphics(urlValue));
}
-
/**
* Override send redirect
*
- [EMAIL PROTECTED] url Description of Parameter
+ * @param url Description of Parameter
*/
public void sendRedirect(String url) {
logger.debug("call redirect, new url is: " + url);
@@ -97,10 +97,10 @@
* Encodes the specified URL for use in the <code>sendRedirect</code>
method
* or, if encoding is not needed, returns the URL unchanged.
*
- [EMAIL PROTECTED] url the url to be encoded.
- [EMAIL PROTECTED] the encoded URL if encoding is needed; the
unchanged URL
+ * @param url the url to be encoded.
+ * @return the encoded URL if encoding is needed; the unchanged URL
* otherwise.
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpServletResponse method
+ * @todo Implement this javax.servlet.http.HttpServletResponse method
*/
public String encodeRedirectURL(String url) {
return url;
@@ -108,10 +108,10 @@
/**
- [EMAIL PROTECTED] url the url to be encoded.
- [EMAIL PROTECTED] the encoded URL if encoding is needed; the
unchanged URL
+ * @param url the url to be encoded.
+ * @return the encoded URL if encoding is needed; the unchanged URL
* otherwise.
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpServletResponse method
+ * @todo Implement this javax.servlet.http.HttpServletResponse method
*/
public String encodeRedirectUrl(String url) {
return url;
@@ -119,10 +119,10 @@
/**
- [EMAIL PROTECTED] url the url to be encoded.
- [EMAIL PROTECTED] the encoded URL if encoding is needed; the
unchanged URL
+ * @param url the url to be encoded.
+ * @return the encoded URL if encoding is needed; the unchanged URL
* otherwise.
- [EMAIL PROTECTED] Implement this
javax.servlet.http.HttpServletResponse method
+ * @todo Implement this javax.servlet.http.HttpServletResponse method
*/
public String encodeUrl(String url) {
return encodeURL(url);
Index: JForumJahiaWebAppBridge.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum/JForumJahiaWebAppBridge.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- JForumJahiaWebAppBridge.java 3 Jul 2008 11:34:58 -0000 1.2
+++ JForumJahiaWebAppBridge.java 15 Oct 2008 11:43:54 -0000 1.3
@@ -132,7 +132,6 @@
printResultFromSession(request.getSession(), response);
-
}
catch (Exception ex) {
ex.printStackTrace();
Index: ServletConfigWrapper.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum/ServletConfigWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ServletConfigWrapper.java 17 Jan 2008 08:04:51 -0000 1.1
+++ ServletConfigWrapper.java 15 Oct 2008 11:43:54 -0000 1.2
@@ -4,10 +4,12 @@
import javax.servlet.*;
import javax.portlet.PortletConfig;
+
import portlet.wrappers.ServletContextWrapper;
public class ServletConfigWrapper implements ServletConfig {
private PortletConfig config;
+
public ServletConfigWrapper(PortletConfig config) {
this.config = config;
}
Index: HttpServletRequestWrapper.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-jforum/src/java/org/jahia/jahiawebapps/jforum/HttpServletRequestWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs