Package org.springmodules.feedxt.web.view

Examples of org.springmodules.feedxt.web.view.AddFeedSubscriptionView


    protected Object formBackingObject(HttpServletRequest request) throws Exception {
        return generator.generate();
    }

    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
        AddFeedSubscriptionView factoryView = (AddFeedSubscriptionView) command;
        FeedSubscription subscription = factoryView.makeFeedSubscription();
        User user = this.userHolder.getUser();
        try {
            this.userService.subscribeToFeed(user, subscription);
        } catch (SubscriptionAlreadyExistentException ex) {
            errors.reject("subscription.duplicated.name", "Subscription with the same name already existent.");
View Full Code Here


    public boolean supports(Class aClass) {
        return AddFeedSubscriptionView.class.isAssignableFrom(aClass);
    }

    public void validate(Object object, Errors errors) {
        AddFeedSubscriptionView view = (AddFeedSubscriptionView) object;
        if (view.getName() == null || view.getName().equals("")) {
            errors.rejectValue("name", "subscription.empty.name", "Empty name.");
        }
        if (view.getFeedUrl() == null) {
            errors.rejectValue("feedUrl", "subscription.empty.url", "Empty feed URL.");
        } else {
            try {
                URL url = new URL(view.getFeedUrl());
            } catch (MalformedURLException ex) {
                errors.rejectValue("feedUrl", "subscription.malformed.url", "Malformed URL.");
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.springmodules.feedxt.web.view.AddFeedSubscriptionView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.