
news aggregator
Febrero 10, 2010
18:00
prourl writes "The Linux Foundation (LF), the nonprofit organization dedicated to accelerating the growth of Linux, today announced the 2010 'We're Linux' video contest. The contest seeks to find the best user-generated videos that demonstrate what Linux means to those who use it and inspire others to try it." Sadly, the winner will almost certainly be edited in Final Cut Pro on a Mac ;)Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
17:47
Somehow, in my meanderings yesterday, I came upon Darryl K. Taft's presentation on eWeek, titled Application Development: 15 Ways Oracle Can Make Java Better (and Improve Its Stance with Developers). The first slide from this presentation that came up on my browser was the last, Slide 16, which is titled "Really Treat Java as 'One of the Crown Jewels'." When I went back and reviewed the entire presentation, I saw a lot very good points. The question I have is: do we really want the solutions to Java's problems to come directly from Oracle? Or, would we prefer Oracle to take a more hands-off approach than Sun did, and instead stimulate change through supporting a vibrant community?
Of course, on can ask: can an independent community really address big issues? Isn't a benevolent dictatorship much more efficient? I'd say that Linux is evidence that you don't need a benevolent dictatorship in order to advance an open source technology.
It's very early on in the history of the merged Sun-Oracle. So, it's not clear what direction Oracle will ultimately take. Overall, it seems to me that Darryl advocates the benevolent dictatorship approach. But I think in this case that approach has a risk of backfiring, because many in the Java community distrust the slick and powerful corporate giant. So, the arguments that impeded Java's progress today (what should and shouldn't be in Java 7, etc.) -- if Oracle simply dictates the decisions, even if the decisions are well thought out and make perfect sense for Java's future -- that's going to turn off a lot of the Java community. So, largely for this reason, I don't know if the overall approach Darryl advocates is the right one, for Oracle or for Java -- despite the seriousness of some of the issues Darryl documents in the first 15 slides of his presentation.
Getting back to the concluding Slide 16 ("Really Treat Java as 'One of the Crown Jewels'") -- here's the opening statement to Oracle:
Overall, make up your mind and communicate clearly about your strategy for Java's future.
OK, yes, that's a good thing. But, isn't the essence of openness to say "nothing changes immediately, we want the Java community to continue to be the primary force behind the future of Java"? Thus far, Oracle has taken great care to not step into Java with a corporate-centric vision. Is this not a good thing?
The next statement in the slide confirms that Oracle has indeed been quite "hands-off" thus far:
For good or bad, Oracle did not do much to prune anything significant from Sun's many software strategies (some of which were flawed).
Again, my question is: who do we want to do the pruning? Who's to decide what should be pruned? Clearly, the author believes he knows which software strategies were flawed and should have been pruned by Sun. But will everyone in the Java community agree with his -- or Oracle's -- assessments? Would the to-be-pruned project communities agree? Again, my question: do we really want the corporate entity Oracle to start making these decisions?
Moving on in the slide:
The notion of supporting three IDEs is confusing. It didn't really work for BEA and while it sort of sounds good here, it's messy.
A few months ago, I created a poll that asked Which IDE do you use? In that poll, I neglected to include IntelliJ IDEA (because most of my communications as java.net editor were with NetBeans and Eclipse users). I'll tell you, the push-back from that exclusion was immense. The poll was boycotted by many IntelliJ IDEA users.
Even if it's "messy" for Oracle to support three IDEs (JDeveloper, Eclipse, and NetBeans, I assume), I don't see how that's a problem. From the developer community point of view, I think it's great, actually. As for "confusing" -- when you go to a grocery store, do you find it confusing to see many different varieties of vegetables and fruits? Even if it is confusing, don't we enjoy the opportunity to choose!?
Onward:
It's not possible to focus equally on every one of the many initiatives, which means that some things get starved and perhaps die in a year anyway.
That's how marketplaces work. In a great many areas, Oracle is saying "we're going to keep our hands off" and let market reality take its course. 80% of open source projects fail. 90% or more of new businesses fail within their first five years. 95% of people who try out futures/derivatives trading end up losing money and quitting. This is how the marketplace works. That some initiatives starve and die is normal. It would be abnormal for all or most of them to succeed. Oracle is just taking a hands-off approach, letting the nature of the marketplace make the final decisions. IMO, anyway...
Finally:
As Oracle EVP Thomas Kurian said, "Java is one of the crown jewels" Oracle got in the Sun acquisition. Treat it as such.
From what I see so far, Oracle is doing exactly that: it's treating Java as a crown jewel so valuable that it doesn't want to tamper with Java as an independent organism. I see Oracle as having listened to many unofficial messages from Sun, and from the Java community, during the nine months of acquisition wait time, stating that with respect to Java, Oracle wasn't acquiring a "product" -- rather, it was acquiring an opportunity to invest in a vibrant, open technology, that still has immense growth potential going forward, if only it is allowed to proceed within the organic, multi-faceted realm that has hitherto fostered its growth. Thus far, I see that message as having been heard by Oracle.
No dictatorial statement of Oracle's "strategy for Java's future"? That's exactly what I myself was hoping for, post-acquistion. Let's let the Java community itself make the decisions on Java's future. The best thing Oracle can do, in my view, is set Java even more free of corporate guardianship than was the case under Sun. This means supporting the Java community, but not dictating the result.
Hopefully, the community will ultimately find the right solutions to most of the problems Philip delineates in his presentation -- solutions to the problems the community decides most urgently need solving, that is. Yes, set the JCP free (as Philip says in Slide 7) and provide Apache an unrestricted Java TCK (as Philip says in Slide 3). Doing these things frees Java further into the hands of the community.
Progress may be slower when it is led by a diverse, fractious community. But, the community stays interested and more involved that way. That's a healthy situation for Oracle to try to promote, in my view.
In Java Today, the JCP Program Office has announced the Results of the ME Special Election:
Yesterday the ballot closed. Cablelabs is the new ME EC member. Detailed results follow below: * Cablelabs (Jon Courtney) with 48 votes (30%)...
Arun Gupta has posted TOTD #121: JDBC resource for MySQL and Oracle sample database in GlassFish v3:
This blog clearly explains how to configure the MySQL sample database (sakila) with GlassFish. Even though the instructions use a specific database but should work for other databases (such as Oracle, JavaDB, PostgreSQL, and others) as well. The second half of the blog provide specific syntax for the Oracle sample database...
Adam Bien provides code and explanation for the Simplest Possible EJB 3.1 Timer:
A timer doesn't have to be a singleton - it can be a @Stateless and even a @Stateful bean. The method doWork() will be invoked every second. There is no registration or configuration needed...
In today's Weblogs, Santiago Pericas-Geertsen is Exploring Hypermedia Support in Jersey:
During the last few weeks, Marc H., Paul S. and myself have been exploring some ideas to support Hypermedia in Jersey. The outcome of this investigation is an experimental implementation that is available in Jersey's trunk (module version 1.2-SNAPSHOT). Exactly what it means to support hypermedia is still an area of research, and some other implementations of JAX-RS (notably RESTfulie) have also proposed APIs for it. The REST architectural style, as defined by Roy Fielding in his thesis, is characterized by four constraints...
Juliano Viana posted his first java.net blog, Making Apache Wicket even more designer friendly :
Hi, my name is Juliano Viana, I'm a software consultant and developer based in Brazil, and I've been honored with the opportunity to blog in Java.net! Hope I can contribute something to this great community resource. For my first blog post at Java.net I've choosen to write about my web framework of choice, Apache Wicket. A designer and developer friendly framework Wicket is a great web framework - it allows the creation of complex web interfaces, complete with fancy ajax effects, in a simple and straigthforward way...
John Ferguson Smart asks you to Have pity on your system administrator: tips for using Hudson with complex Maven build jobs:
A new Java Power Tools Newsletter is out! This month, we will be taking a look at some of the ways you can make life easier for your system administrator, when you are using Hudson for large Maven projects. Check it out...
In the Forums,
morrisford is working on Portal issues involving Wonderland: Maggie and I were experimenting with 'portaling' between three servers and encountered several issues. These things seem to happen every time that multiple jumps are done, ie, from world1 to world2 to world3 to world1, etc...
In the GlassFish forum, Eve Pokua is seeing a javax.persistence.PersistenceException: Hello everyone, I have the following error. I am trying to bind data from my DB into a Jtable using the following tutorial. When it's not bind it runs ok. But binding it causes the following errors...
In the LWUIT forum, digitalsol has S60 devices performance problems: Hello, I've tested my app on Nokia N97 and 5800 and the performance is terrible in comparison to Nokia E71 for example. Can someone give me more info if this is a known problem, are there ways to improve the performance, etc...
Our current Spotlight is the Oracle announcement about Kenai.com: "Our plan is to shut down kenai.com and focus our efforts on java.net as the hosted development community. We are in the process of migrating java.net to the kenai technology. This means that any project currently hosted on kenai.com will be able to continue as you are on java.net. We are still working out the technical details, but the goal is to make this migration as seamless as possible for the current kenai.com projects..."
This week's java.net Poll asks Does your company use an enterprise repository manager for development? Voting will be open for the next week.
Our latest java.net Feature Article is Maven Repository Managers for the Enterprise, by John Smart. We're also featuring Jeff Friesen's Reading Newsfeeds in JavaFX with FeedRead, in which Jeff demonstrates how to apply JavaFX's RSS and Atom newsfeed capabilities to create a snazzy little JavaFX app that can run stand-alone or in a browser.
The latest Java Mobility Podcast is Java Mobile Podcast 92: MIDP 3.0 in Depth: Tutorials and Demonstrations: Excerpts from the JavaOne 2009 MIDP 3.0 In Depth: Tutorials and Demonstrations session with Roger Riggs, Lakshmi Dontamsetti and Stan Kao.
Current and upcoming Java Events:
- February 22-27: Java Training Philippines
- March 8-13: JavaEE Training Philippines
- March 17-19: TheServerSide Java Symposium 2010
- March 25-26: Agile Testing for Java Developers
Source: Blog java.net
Categorías: Blog's
17:20
gmuslera writes "Not enough speed from your ISP? Google seems to go into that market too. 'We're planning to build and test ultra high-speed broadband networks in a small number of trial locations across the United States. We'll deliver Internet speeds more than 100 times faster than what most Americans have access to today with 1 gigabit per second, fiber-to-the-home connections. We plan to offer service at a competitive price to at least 50,000 and potentially up to 500,000 people.' The goal isnt just to give ultra fast speed for some lucky ones, but to test under that conditions things like new generations of apps, and deployment techniques that take advantage of it." If they need a test neighborhood, I'm sure mine would be willing.Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
17:04
16:30
Slashdot frequent contributor Bennett Haselton writes a piece advocating for Pop-Ups and even more obtrusive advertising. But not for the reasons you might think. He says "Annoying pop-up ads have been a great friend to Internet freedom, by enabling the operation of proxy sites that would be too expensive to operate otherwise. With the rising costs of making new proxy sites to stay ahead of the "censorware" companies, even more intrusive ads could be an even bigger friend to Internet freedom. Got any ideas for how those more intrusive ads could work?" Clicky clicky below to read his point.Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
15:49
An anonymous reader writes "A band of cyber-attackers have taken down the Australian Parliament House website and hacked Prime Minister Kevin Rudd's website in coordinated protests against government plans to filter the Internet. The group responsible, called Anonymous, is known for coordinated Internet attacks against Scientology and other groups in the past. It recently turned its attention against the AU government after it said in December that it would block access to sites featuring material such as rape, drug use, bestiality and child sex abuse."Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
15:10
alphadogg writes "An upstart Trojan horse program has decided to take on its much-larger rival by stealing data and then removing the malicious program from infected computers. Security researchers say that the relatively unknown Spy Eye toolkit added this functionality just a few days ago in a bid to displace its larger rival, known as Zeus. The feature, called "Kill Zeus," apparently removes the Zeus software from the victim's PC, giving Spy Eye exclusive access to usernames and passwords. Zeus and Spy Eye are both Trojan-making toolkits, designed to give criminals an easy way to set up their own "botnet" networks of password-stealing programs. These programs emerged as a major problem in 2009, with the U.S. Federal Bureau of Investigation estimating last October that they have caused $100 million in losses."Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
14:31
Rish writes "A lawsuit that accused Microsoft of misleading consumers to download and install an update for Windows Genuine Advantage (WGA) under the guise that it was critical security update has been tossed out. Last month, a federal judge refused to certify the lawsuit as a class action, which would have meant anyone who owned a Windows XP PC in mid-2006 could join the case without having to hire an attorney, and on Friday the same judge dismissed the case completely."Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
14:05
Content available at: http://blogs.sun.com/arungupta/entry/totd_122_creating_a_jpa
Source: Blog java.net
Categorías: Blog's
13:57
Barence writes "Opera is launching a version of its Mini browser for the iPhone in what could prove a landmark decision for Apple's app gatekeepers. Apple has been traditionally hostile to rival browsers, with Mozilla claiming that Apple made it "too hard" for its rivals to develop a browser for the iPhone. However, Opera remains bullishly confident that it's app will be approved. "We have not submitted Opera Mini to the Apple App store," an Opera spokesperson told PC Pro. "However, we hope that Apple will not deny their users a choice in web browsing experience."" I can't imagine what would motivate them to do that.Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
13:17
DesScorp writes "It seems that there's a grain of truth to one old wives' tale; it turns out that you really can die of a broken heart, especially if you're a post-menopausal woman. The Wall Street Journal reports on a phenomena called 'broken-heart syndrome,' which often occurs after great emotional distress. Quoting: 'In a conventional heart attack, an obstructed artery starves the heart muscle of oxygenated blood, quickly resulting in the death of tissue and potentially permanently compromising heart function. In contrast, the heart muscle in broken-heart-syndrome patients is stunned in the adrenaline surge and appears to go into hibernation. Little tissue is lost.' In the article a doctor notes, 'The cells are alive, but mechanically or electrically disabled.' Documented cases track heart attacks in people with seemingly healthy hearts after the grief of the death of a loved one. Intense feelings can cause the heart actually to change shape. Doctors call this 'tako-tsubo,' after the Japanese phrase for 'octopus trap,' so called because the syndrome was first identified by a Japanese doctor who noticed the strange shape in the left ventricle. Doctors note that while strong emotions like grief are usually associated with the syndrome, stress or a migraine can also trigger such heart attacks."Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
10:21
dark_requiem writes "The 11th Circuit Court of Appeals has ruled that online content can be judged by the standards of the strictest community that is able to access it. The court upheld the conviction of pornography producer Paul F. Little, aka Max Hardcore, for violating obscenity laws in Tampa, despite the fact that the 'obscene' material in question was produced and sold in California. From the article: 'The Atlanta-based court rejected arguments by Little's attorneys that applying a local community standard to the Internet violates the First Amendment because doing so means material can be judged according to the standards of the strictest communities. In other words, the materials might be legal where they were produced and almost everywhere else. But if they violate the standards of one community, they are illegal in that community and the producers may be convicted of a crime. ... Jurors in Little's trial were told to judge the materials on the basis of how "the average person of the community as a whole — the Middle District of Florida" — would view the material.'"Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
09:40
Blizzard updated the official StarCraft II site today with a preview of how the revamped Battle.net will function. They emphasize the social features, competitive matchmaking system, and the ease of sharing mods and maps. Quoting:
"When the legacy Battle.net service introduced support for user-created mods such as DotA, Tower Defense, and many others, these user-created game types became immensely popular. But while Battle.net supported mods at a basic level, integration with tools and the mod community wasn't where it needed to be for a game releasing in 2010. The new Battle.net service will see some major improvements in this area. StarCraft II will include a full-featured content-creation toolkit — the same tools used by the StarCraft II design team to create the single-player campaign. To fully harness the community's mapmaking prowess, Battle.net will introduce a feature called Map Publishing. Map Publishing will let users upload their maps to the service and share them with the rest of the community immediately on the service. This also ties in with the goal of making Battle.net an always-connected experience — you can publish, browse, and download maps directly via the Battle.net client. Finding games based on specific mods will also be much easier with our all-new custom game system, placing the full breadth of the modding community's efforts at your fingertips."Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
07:22
k33l0r writes "Following Google's announcement ending support for Internet Explorer 6, I find myself wondering whether we (Web developers) really need to continue providing support for IE6 and IE7. Especially when creating Web sites intended for technical audiences, wouldn't it be best to end support for obsoleted browsers? Would this not provide additional incentives to upgrade? Recently I and my colleagues had to decide whether it was worth our time to try to support anything before IE8, and in the end we decided to redirect any IE6/7 user-agent to a separate page explaining that the site is not accessible with IE 6 or 7. This was easy once we saw from our analytics that fewer than 5% of visitors to the site were using IE at all. Have you had to make a choice like this? If so, what was your decision and what was the reasoning behind it?"Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
04:24
More details have come about about what was behind PayPal's decision to suspend personal payments to any user in India, as we discussed on Sunday. In a blog post today, PayPal revealed that payments to India will remain in suspension for at least a few months. Customers in India will be able to pull rupees out of the service into their bank accounts within a few days. The suspension came about when Indian government regulators raised questions about whether PayPal's service was enabling remittences (transfers of money by foreign workers) to Indian citizens. "The problems may have been triggered by a marketing push that promotes PayPal as a way to send money abroad, a source familiar with the matter said. The campaign — which reads 'As low as $1.50 to send $300 to countries like India' — may have caught the attention of Indian regulators, the source said."Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
02:20
Google announced Buzz today, as we anticipated this morning. CNET has a workmanlike description of the social-networking service, which is integrated into gmail. CNET identifies a central obstacle Buzz will have to overcome to gain traction: "The problem, however, will be the increasing backlash Google is seeing from the general public over how much data the company already controls on their online habits." Buzz is being rolled out over the next few days so some people will see a Buzz folder in their gmail, but most won't yet (this Twitter post explains how Safari users can get an early glimpse). A blog posting up at O'Reilly Answers points out some of the distinguishing characteristics of Google Buzz — one interesting one being its ability to post an update either pubilcly or privately, at the user's option. This design choice places it between the public-by-default Twitter and the private-by-default Facebook. Lauren Weinstein sounds a note of caution about the inherent privacy risks of Google's method of filling out initial friend profiles by automatic friending.Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
00:21
An anonymous reader writes "Ksplice, the company based on the MIT Ksplice project, is now offering its 'never reboot' service for Red Hat, Debian, and other Linux distros. You subscribe and get real-time kernel security updates that apply in-memory instead of rebooting. Last summer we discussed the free service for Ubuntu. Cool tech, but will people really pay $4 a month for this?"Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
Febrero 9, 2010
23:40
alex_guy_CA Notes that the US Trade Representative — who has been negotiating the secret Anti-Counterfeiting Trade Agreement without input from the American people or Congress — is seeking public submissions on how to conduct US foreign copyright policy. This means that Americans can file comments with the USTR asking for ACTA to be made public. Public Knowledge explains the process: "Under the Special 301 process the USTR seeks input from US copyright, trademark, and patent owners about whether policies and practices in foreign countries deny them adequate IP protection. The process has generally been used by IP holders to complain not only about lax enforcement in other countries, but also about limitations and exceptions in their laws that are beneficial to libraries, to education, to innovation, and to the public interest generally. The ability to comment in the Special 301 process is not limited to IP owners only. Any member of the public is free to file comments. If you believe in the importance of balanced copyright policies, file comments with the USTR and make your voice heard. Comments can be filed electronically via http://www.regulations.gov/ docket number USTR-2010-0003. You have to include the term '2010 Special 301 Review' in the 'Type Comment and Upload File' field. ... Deadline for filing is February 16 by 5 pm"Read more of this story at Slashdot.
Source: SlashDot.org
Categorías: Tecnologia
16:20
During the last few weeks, Marc H., Paul S. and myself have been exploring some ideas to support Hypermedia in Jersey. The outcome of this investigation is an experimental implementation that is available in Jersey's trunk (module version 1.2-SNAPSHOT). Exactly what it means to support hypermedia is still an area of research, and some other implementations of JAX-RS (notably RESTfulie) have also proposed APIs for it.
The REST architectural style, as defined by Roy Fielding in his thesis, is characterized by four constraints: (i) identification of resources (ii) manipulation of resources through representations (iii) self-descriptive messages and (iv) hypermedia as the engine of application state. It is constraint (iv), hypermedia as the engine of application state or HATEOAS for short, that is the least understood and the focus of our investigation.
It has been identified by other authors that there are actions that cannot be easily mapped to read or write operations on resources. These operations are inherently more complex and their details are rarely of interest to clients. In our work, we introduce the concept of action resources. An action resource is a sub-resource defined for the purpose of exposing workflow-related operations on parent resources. As sub-resources, action resources are identified by URIs that are relative to their parent. For instance, the following are examples of action resources:
http://.../orders/1/review
http://.../orders/1/pay
http://.../orders/1/ship
for purchase order “1” identified by http://.../orders/1.
A set of action resources defines—via their link relationships—a contract with clients that has the potential to evolve over time depending on the application’s state. For instance, assuming purchase orders are only reviewed once, the review action will become unavailable and the pay action will become available after an order is reviewed.
The notion of action resources naturally leads to discussions about improved client APIs to support them. Given that action resources are identified by URIs, no additional API is really necessary, but the use of client-side proxies and method invocations to trigger these actions seems quite natural. Additionally, the use of client proxies introduces a level of indirection that enables better support for server evolution, i.e. the ability of a server’s contract to support certain changes without breaking existing clients.
The Jersey extensions that we implemented were influenced by the following (inter-related) requirements:
- HATEOAS: Support for actions and contextual action sets as first-class citizens.
- Ease of use: Annotation-driven model for both client APIs and server APIs.
- Server Evolution: Various degrees of client and server coupling, ranging from static contracts to contextual contracts.
Source: Blog java.net
Categorías: Blog's
14:00
Hi, my name is Juliano Viana, I'm a software consultant and developer based in Brazil, and I've been honored with the opportunity to blog in Java.net! Hope I can contribute something to this great community resource.
For my first blog post at Java.net I've choosen to write about my web framework of choice, Apache Wicket.
A designer and developer friendly framework
Wicket is a great web framework - it allows the creation of complex web interfaces, complete with fancy ajax effects, in a simple and straigthforward way. The best Apache Wicket feature is in my oppinion the total separation between markup and business logic.A Web Designer working in an Apache Wicket project will probably never see a line of Java code, and the Developers can work on mock interfaces and be certain that when the time comes to make it look great the designers will be able to style it without any hassle.
Another feature I find extremely useful in Wicket is the page markup inheritance concept. In Wicket every page is a Java class that extends org.apache.wicket.Page. Each page has also an associated HTML file containing the page markup.Wicket allows one to create base pages that contain your web site main markup and common funcionality (such as heder, footer, CSS files , analytics scripts, login area, search area, language selection box etc.). One can then create specialized pages that inherit this common layout from the base page and provides just the specialized content.
A Wicket Base Page usually looks like :
Your Title...
Common header goes here...
Common footer goes here...
The wicket:child tag is used to mark where you want specialized content to be placed. A Wicket page extending this base page will then contain only the following HTML:
Page content goes here....
At run time Wicket will combine both markups in order to produce the final rendered page.
(for a complete description of how markup inheritance works in Wicket, see http://wicket.apache.org/examplemarkupinheritance.html).
What designers wanted
Recently I have started a new web project and (not surprisingly) decided to use Wicket as the main web framework. This project is not just a web application, but an entire web site. A website doesn't contain only application pages - it will have lots if informational pages like help, about, contact, news etc.
Once the designers decide the basic look and feel of the web site, this look and feel can then be moved to the Base Page and be automatically applied to all application pages.
This is great, but what if a designer wants to just create an informational page that still inherits the default web site content and behavior?
Here is the problem: since in Wicket each page is equal parts HTML and Java code, the designer needs to ask a developer to create a corresponding Java class for each page she wants to create, even if this page has pretty much the same behavior as the base page.
Wouldn't it be great if one could just place a HTML file into the web app content directory and have it automatically inherit all the features of a Wicket page?
The idea is to have a special page class (I've called it DynamicPage for the lack of a more appropriate name) that gets associated with any "orphan" HTML file in the web application (meaning a file not already associated with a Wicket page ).
DynamicPage should extend the application's BasePage and hence inherit all the common funcionality and layout.
This is a big departure from the way Wicket usually works, but would make our life much easier.
Customizing Wicket behavior
Thanks to the vision of the Apache Wicket creators one can customize almost everything in Wicket without having to resort to patching the code. After reading Wicket's code for a while I realized that I needed to implement a custom IRequestCycleProcessor. As the name implies an IRequestCycleProcessor is responsible for processing a web request, and among other things it routes the request to an appropriate RequestTarget (which in Wicket can be a Page or a component inside a Page, among other possibilities).
I've created a new IRequestCycleProcessor by extending WebRequestCycleProcessor (the default implementation) and overriding the method:
public IRequestTarget resolve(RequestCycle cycle, RequestParameters parameters) {
.....
}
My implementation first calls the superclass implementation to try to resolve the request in the traditional way. If the super implementation cannot find a Wicket target for the request, and the request is for an existing HTML file, it then returns an instance of BookmarkablePageRequestTarget which has DynamicPage as the Java class counterpart.
The next step is to make DynamicPage render the correct HTML markup file based on the request URL. This is accompished by making DynamicPage implement two interfaces: IMarkupResourceStreamProvider and IMarkupCacheKeyProvider. These interfaces tell Wicket that this page class is responsible for locating and loading its own markup.
A couple of aditional classes are required in order to make sure that Wicket is able to create page URLs for these dynamic pages correctly: DynamicWebRequestCodingStrategy and DynamicwebRequestTargetURLCodingStrategy. These classes are sligthly modifiied versions of the standard Wicket implementations and they help make the implementation complete: components inside these dynamic pages behave exactly as in "normal"pages, for traditional requests and also for Ajax requests.
Location, location, location...
Now that the designers can just create Wicket pages on the fly just by creating HTML files, they would also like to be able to place these HTML files in a separate folder from the Java source files. Wicket by default expects HTML files to be on the same directory as Java source files, and that is something that sometimes causes problems as designers don't feel very comfortable messing around with Java source code.
It is easy to change that by implementing a ResourceStreamLocator that tells Wicket where it should get the HTML markup files from. I have impemented a WebAppResourceStreamLocator which just loads the HTML files from the standard web context ( by calling ServetContext.getResource ). This implementation also allows one to strip common directories from the file name. This is useful if you use a deep Java package structure for your Wicket pages and still want your web app directory to look "natural". For example, Wicket will by default look for the HTML file for com.mycompany.web.MyPage under "com/company/web/MyPage.html". With WebAppResourceStreamLocator one can configure it to look for just "MyPage.html".
Pushing the component model further
Now that we have come all this way, wouldn't it be nice if we could improve things further by allowing designers to include Wicket panels inside these dynamic pages without the need for developer intervention?
Why does that make sense? Well, suppose your developers create a cool product search panel which, being a component, can be placed in any page. The designers would probably benefit from the freedom to move this component around and even place it inside arbitrary pages with little effort.
I've solved this problem by registering a new Wicket tag "wicket:dynamic" which can instantiate and add components to dynamic pages on the fly. This tag looks a lot like the standard "wicket:component" tag, but unlike wicket:component it adds the components at page construction time (not on page rendering time). I have chosen to implement it because wicket:component is not a fully supported Wicket tag acording to the documentation ( some Wicket developers believe it goes againt the core Wicket philosophy), and because some components don't work well if added at page rendering time.
Putting it all together
In order to make it easy to use these customizations in any Wicket application I have created a class library called LogicWicket (library and source can be downloaded here).
In order to use LogicWicket to make your applications more designer friendly, all you have to do is:
- Include the LogicWicket jar file in your web application
- Implement a Dynamic Page class. This class should extend your application's Base page and implement a few methods that delegate to LogicWicket's DynamicPageSupport class (see the example DynamicPage provided).
- In your Wicket Application class init method, register the custom resource stream locator: getResourceSettings().setResourceStreamLocator(new WebAppResourceStreamLocator(getServletContext(),"com/mypackage/web"));
- In tour Wicket Application class, override the method newRequestCycleProcessor like this:
Source: Blog java.net
Categorías: Blog's




