[
http://jira.jboss.com/jira/browse/JBSEAM-2775?page=comments#action_12409459 ]
Norman Richards commented on JBSEAM-2775:
-----------------------------------------
We can worry about docs once the functionality is settled.
I'm happy to support default mappings for HTTP URLs, but I think the key here really
is to be clear about why the functionality is being introduced. Again, it's not
important that we provide mappings for many different kinds of URLs. It's only
important that a Seam user can construct a URL that maps clearly to a Java package and
that the user would be happy with that URL.
I didn't mean to remove the ability to strip WWW from the code. I haven't
checked, but I thought that was still there. But, to consider whether this is wise, I am
drawn back to considering that a namespace URL should generally be a canonical simple URL.
Take "http://jboss.com/products/seam/core" for instance. There really should
not be a www in there, even if we might generally consider
http://www.jboss.com/ to be the
"correct" URL in a web browser. Putting the www in a namespace creates an
entirely new namespace, potentially causing problems with XML tools. (the XML namespaces
must match EXACTLY) It seems quite reasonable, to me, to instruct users to construct a
reasonable URL without the www. Nonetheless, I intended to leave the www stripping in
there because in general I don't think it's going to harm anything. I think
it's fine for us to have a user use
http://company.com/dept/product if they wish. I
would prefer they use java:com.company.dept.product, but I can see enough value in the
HTTP version that supporting it is reasonable. Trying to do anything fancier than that
seems like a waste of time. If you want something fancier that isn't mapped
automatically, use @Namespace.
Finally, I got rid of some of the validating because it didn't seem to serve a useful
purpose. Someone uses an invalid namespace, they'll get warnings and failures either
way. Why should we trouble ourselves with a static list of java keywords? I did like the
"_" for "-" replacement, as that seems quite reasonable, as do most of
the mapping recommendations from sun. (But, if you were
class.com, would you really be
likely to use
_class.com as your java package?)
Feel free to continue to submit improvements here. I'm not against further changes,
but we do need to justify the features in terms of what we really want users to do with
it.
package-info.java should be optional:"convention over
configuration"
--------------------------------------------------------------------
Key: JBSEAM-2775
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2775
Project: Seam
Issue Type: Feature Request
Reporter: Eric Jung
Assigned To: Norman Richards
Fix For: 2.1.0.BETA1
Attachments: JBSEAM-2775-v3.diff, JBSEAM-2775.diff, JBSEAM-2775.diff
Currently, package-info.java is required when referring to custom Seam components in
components.xml. However, to further align Seam with the "convention over
configuration" philosophy, this file can be optional by making some assumptions:
1. In the absence of package-info.java , the XML namespace in components.xml for custom
components has a well-defined mapping to a Java package
2. This mapping can be defined as:
a. The XML namespace must be parsable by java.net.URI otherwise automatic mapping is
aborted
a. Protocol (scheme), the www/ subdomain, port, query parameters, anchors (references),
and userInfo are ignored, if present.
b. The top-level domain becomes the root Java package
c. Subdomains become Java packages under the root package, applied in right-to-left
order as specified in the URI.
d. The path, as returned by URI.getPath(), is mapped to further Java packages such that
each path element becomes another Java package appended in left-to-right order
Examples:
http://www.company.com/department/product ==> com.company.department.product
https://company.com/department/product ==> com.company.department.product
ftp://www.company.org/department/product ==> org.company.department.product
abc://company.org/department/product ==> org.company.department.product
company.net/foo/bar/baz ==> net.company.foo.bar.baz
JIRA isn't displaying my last example correctly. See
http://pastebin.mozilla.org/375878 for the last example.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira