From: Julien V. <ju...@jb...> - 2005-09-13 21:40:50
|
User: julien Date: 05/09/13 17:40:48 Modified: server/src/main/org/jboss/portal/server/util URLInfo.java Log: various cleanup Revision Changes Path 1.2 +27 -8 jboss-portal/server/src/main/org/jboss/portal/server/util/URLInfo.java (In the diff below, changes in quantity of whitespace are not shown.) Index: URLInfo.java =================================================================== RCS file: /cvsroot/jboss/jboss-portal/server/src/main/org/jboss/portal/server/util/URLInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- URLInfo.java 10 Sep 2005 09:36:16 -0000 1.1 +++ URLInfo.java 13 Sep 2005 21:40:47 -0000 1.2 @@ -15,7 +15,7 @@ * URL information that does not belong to the url value itself. * * @author <a href="mailto:ju...@jb...">Julien Viet</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class URLInfo { @@ -53,14 +53,38 @@ return relative; } - public StringBuffer encode(ServerInvocation invocation) + /** + * @throws IllegalArgumentException if any argument is null + */ + public StringBuffer encode(ServerInvocation invocation) throws IllegalArgumentException { if (invocation == null) { throw new IllegalArgumentException("No null invocation accepted"); } + StringBuffer buffer = new StringBuffer(); + internalEncode(invocation, buffer); + return buffer; + } - // + /** + * @throws IllegalArgumentException if any argument is null + */ + public void encode(ServerInvocation invocation, StringBuffer buffer) throws IllegalArgumentException + { + if (invocation == null) + { + throw new IllegalArgumentException("No null invocation accepted"); + } + if (buffer == null) + { + throw new IllegalArgumentException("No null buffer accepted"); + } + internalEncode(invocation, buffer); + } + + private void internalEncode(ServerInvocation invocation, StringBuffer buffer) + { ServerRequest req = invocation.getRequest(); // Are we authenticated or not @@ -85,9 +109,6 @@ secure = req.getContext().getHTTPRequest().isSecure(); } - // The URL - StringBuffer buffer = new StringBuffer(); - // boolean relative = getRelative() == null || getRelative().booleanValue(); if (!relative) @@ -135,7 +156,5 @@ buffer.append(""); } } - - return buffer; } } |