[
https://issues.apache.org/jira/browse/WW-3524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maurizio Cucchiara updated WW-3524:
-----------------------------------
Attachment: WW-3524-2.patch
Matthew,
the attached patch introduces a new *field bridge* concept.
@JSONFieldBridge(
impl = StringBridge.class,
params = {
@JSONParameter(name = "name1", value = "value1"),
@JSONParameter(name = "name2", value = "value2")
}
)
public URL getUrl() {
return url;
}
JSONFieldBridge allow you to specify a field bridge implementation. The
implementation class would implements at least FieldBridge interface,
optionally could implement ParameterizedBridge interface (in the case of you
need to parameterize field bridge).
The patch doesn't alter the current behavior.
> When bean contains a property of type URL the json writer is trying to
> connect to the URL and retreive the contents rather than returning just the
> URL as a string
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3524
> URL: https://issues.apache.org/jira/browse/WW-3524
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - JSON
> Affects Versions: 2.1.6
> Environment: java 1.6 running under windows or linux
> Reporter: matthew cooper
> Attachments: WW-3524-2.patch, WW-3524.patch
>
>
> When a bean being serialized into a JSON string contains a member of type URL
> the JSONWriter identifys the URL itself as a bean type, this recusrivly looks
> at all the properties of the URL object and reteives the reader methods for
> each one which it invokes and repeats the process based on the returned
> object.
> The URL class contains a bunch of properties including content which has the
> getContent method as the reader.
> when this method is invoked the URL class will make the HTTP request and
> return the html content, if the URL is not valid it will thrown an exception.
> THe following is a list of the properties and the associated reader methods
> from the URL class
> Property name authority
> Accessor method is public java.lang.String java.net.URL.getAuthority()
>
> Property name content
> Accessor method is public final java.lang.Object java.net.URL.getContent()
> throws java.io.IOException
>
> Property name defaultPort
> Accessor method is public int java.net.URL.getDefaultPort()
>
> Property name file
> Accessor method is public java.lang.String java.net.URL.getFile()
>
> Property name host
> Accessor method is public java.lang.String java.net.URL.getHost()
>
> Property name path
> Accessor method is public java.lang.String java.net.URL.getPath()
>
> Property name port
> Accessor method is public int java.net.URL.getPort()
>
> Property name protocol
> Accessor method is public java.lang.String java.net.URL.getProtocol()
>
> Property name query
> Accessor method is public java.lang.String java.net.URL.getQuery()
>
> Property name ref
> Accessor method is public java.lang.String java.net.URL.getRef()
>
> Property name userInfo
> Accessor method is public java.lang.String java.net.URL.getUserInfo()
> i think the JSONWriter needs a special case for the URL object as you would
> not want the getContent method being invoked.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.