[PORTLETSPEC3-21] Add a method for writing a BaseURL to a java.lang.Appendable Created: 10/May/13  Updated: 23/Aug/13  Resolved: 23/Aug/13

Status: Resolved
Project: portletspec3
Component/s: Ideas for JSR 362 Extensions
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: julien_viet Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


The current BaseURL interface provides capability to write to a java.io.Writer .

It would be a good thing to add the same method for a java.lang.Appendable as the appendable is an abstraction implemented by java.io.Writer but also by many other objects such as java.lang.StringBuilder.

Comment by Neil Griffin [ 14/May/13 ]

I suppose that the standard approach would be to @Deprecate the java.io.Writer methods, but since java.io.Writer implements java.lang.Appendable, the method signatures could simply be changed to:

BaseURL.write(java.lang.Appendable out);
BaseURL.write(java.lang.Appendable out, boolean escapeXML);

All existing code would still compile...

Comment by julien_viet [ 14/May/13 ]

We need to keep the existing method otherwise it will create binary incompatible classes for classes compiled with JSR 286 jar and executed with this API change by throwing a NoSuchMethodError on write(Ljava/io/Writer

Comment by Neil Griffin [ 14/May/13 ]

@julien_viet: You're right – I was thinking of source-compatible and not binary-compatible. Need to keep things binary compatible.

Comment by msnicklous [ 23/Aug/13 ]

Added the proposed BaseURL.write(Appendable) methods.

I did not deprecate the write(Writer) methods due to feedback that we should make it obvious to people that a method accepting a Writer exists and should be used when possible to avoid overhead associated with String / CharSequence processing.

Generated at Sat Jul 04 11:31:13 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.