• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ErrorResolution类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中net.sourceforge.stripes.action.ErrorResolution的典型用法代码示例。如果您正苦于以下问题:Java ErrorResolution类的具体用法?Java ErrorResolution怎么用?Java ErrorResolution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ErrorResolution类属于net.sourceforge.stripes.action包,在下文中一共展示了ErrorResolution类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: newReview

点赞 3

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("new")
public Resolution newReview() {
    if (getId() == null)
        return new ErrorResolution(404);
    Product product = productService.getProduct(getId());
    if (product == null)
        return new ErrorResolution(404);

    if (isCustomerLoggedIn()) {
        if (customerReviewService.hasReview(getId(), ((Customer) getLoggedInCustomer()).getId())) {
            return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
        }
    }

    formAction = "/review/add/" + getId();
    redirectUrl = "/review/new/" + getId();
    return view("review/review_form");
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:19,
代码来源:CustomerReviewAction.java

示例2: deleteReview

点赞 3

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("delete")
public Resolution deleteReview() {
    if (!isCustomerLoggedIn()) {
        return redirect("/customer/account/login");
    }

    if (getId() == null) {
        if (isCustomerLoggedIn()) {
            return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
        } else {
            return new ErrorResolution(404);
        }
    }

    CustomerReview review = customerReviewService.getCustomerReview(getId());
    if (review == null || !review.getCustomerId().equals(((Customer) getLoggedInCustomer()).getId()))
        return new ErrorResolution(404);

    customerReviewService.deleteReview(review);

    return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:23,
代码来源:CustomerReviewAction.java

示例3: viewCustomerReviews

点赞 3

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("customer")
public Resolution viewCustomerReviews() {
    if (getId() == null)
        return new ErrorResolution(404);
    Customer customer = customerService.getCustomer(getId());
    if (customer == null)
        return new ErrorResolution(404);

    Boolean published = true;
    if (isCustomerLoggedIn()) {
        if (getId().equals(((Customer) getLoggedInCustomer()).getId()))
            published = null;
    }

    reviews = getCustomerReviews(published);
    pagingUri = "/review/customer/" + getId();
    return view("review/customer");
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:19,
代码来源:CustomerReviewAction.java

示例4: processEditReview

点赞 3

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("process-edit")
public Resolution processEditReview() {
    if (!isCustomerLoggedIn())
        return redirect("/customer/account/login");

    if (getId() == null)
        return new ErrorResolution(404);

    CustomerReview customerReview = customerReviewService.getCustomerReview(getId());

    if (customerReview == null)
        return new ErrorResolution(404);

    customerReview.setRating(getRating());
    customerReview.setHeadline(getHeadline());
    customerReview.setReview(getReview());
    customerReview.setPublished(getAutoPublished());

    customerReviewService.updateReview(customerReview);

    return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:23,
代码来源:CustomerReviewAction.java

示例5: reportAbuse

点赞 3

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("abuse")
public Resolution reportAbuse() {
    if (getId() == null)
        return new ErrorResolution(404);

    if (!isCustomerLoggedIn()) {
        redirectUrl = "/review/abuse/" + getId();
        return redirect("/customer/account/login");
    }

    CustomerReview review = customerReviewService.getCustomerReview(getId());
    if (review == null)
        return new ErrorResolution(404);
    product = productService.getProduct(review.getProductId());
    return view("review/abuse_form");
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:17,
代码来源:CustomerReviewAction.java

示例6: processReportAbuse

点赞 3

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("process-abuse")
public Resolution processReportAbuse() {
    if (getId() == null)
        return new ErrorResolution(404);

    if (!isCustomerLoggedIn()) {
        return redirect("/customer/account/login");
    }

    CustomerReview review = customerReviewService.getCustomerReview(getId());
    if (review == null)
        return new ErrorResolution(404);
    product = productService.getProduct(review.getProductId());

    Abuse abuse = app.model(Abuse.class);
    abuse.setId(app.nextId());
    abuse.setHeadline(abuseHeadline);
    abuse.setText(abuseText);
    abuse.setCustomerId(((Customer) getLoggedInCustomer()).getId());
    abuse.setReviewId(review.getId());

    review.addAbuse(abuse);
    customerReviewService.updateReview(review);

    return redirect("/review/view/" + product.getId());
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:27,
代码来源:CustomerReviewAction.java

示例7: execute

点赞 3

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
public void execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
    if(request.getParameter("__portofino_quiet_auth_failure") != null) {
        return;
    }
    Subject subject = SecurityUtils.getSubject();
    if (!subject.isAuthenticated()) {
        new AuthenticationRequiredResolution(errorMessage).execute(request, response);
    } else {
        ServletContext servletContext = request.getServletContext();
        Configuration configuration =
                (Configuration) servletContext.getAttribute(BaseModule.PORTOFINO_CONFIGURATION);
        String loginPage = configuration.getString(PortofinoProperties.LOGIN_PAGE);
        UrlBuilder loginUrlBuilder =
                new UrlBuilder(request.getLocale(), loginPage, false);
        response.setHeader(AuthenticationRequiredResolution.LOGIN_PAGE_HEADER, loginUrlBuilder.toString());
        new ErrorResolution(STATUS, errorMessage).execute(request, response);
    }
}
 

开发者ID:ManyDesigns,
项目名称:Portofino,
代码行数:19,
代码来源:ForbiddenAccessResolution.java

示例8: intercept

点赞 3

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
public Resolution intercept(ExecutionContext context) throws Exception {
    ActionBean actionBean = context.getActionBean();
    Method handler = context.getHandler();

    logger.debug("Checking guards on {}", handler);
    if(ButtonsLogic.doGuardsPass(actionBean, handler)) {
        return context.proceed();
    } else {
        logger.warn("Operation not permitted. Method: " + context.getHandler());
        if(actionBean instanceof Guarded) {
            return ((Guarded) actionBean).guardsFailed(handler);
        } else {
            return new ErrorResolution(CONFLICT);
        }
    }
}
 

开发者ID:ManyDesigns,
项目名称:Portofino,
代码行数:17,
代码来源:GuardsInterceptor.java

示例9: special

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("special")
public Resolution special() {

    discountPromotion = discountPromotions.findById(DiscountPromotion.class, getId());

    if (discountPromotion == null)
        return new ErrorResolution(404);

    Date nowDate = new Date();
    if (discountPromotion.getShowFrom() != null && nowDate.before(discountPromotion.getShowFrom())
        || discountPromotion.getShowTo() != null && nowDate.after(discountPromotion.getShowTo()))
        return new ErrorResolution(404);

    return view("discount_promotion/special_form");
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:16,
代码来源:DiscountPromotionAction.java

示例10: editReview

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("edit")
public Resolution editReview() {
    if (getId() == null)
        return new ErrorResolution(404);
    formAction = "/review/process-edit/" + getId();
    redirectUrl = "/review/edit/" + getId();
    CustomerReview review = customerReviewService.getCustomerReview(getId());
    if (review == null)
        return new ErrorResolution(404);
    rating = review.getRating();
    this.review = review.getReview();
    headline = review.getHeadline();
    product = productService.getProduct(review.getProductId());
    return view("review/review_form");
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:16,
代码来源:CustomerReviewAction.java

示例11: viewReviews

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("view")
public Resolution viewReviews() {
    if (getId() == null)
        return new ErrorResolution(404);
    Product product = productService.getProduct(getId());
    if (product == null)
        return new ErrorResolution(404);

    reviews = getProductReviews();
    pagingUri = "/review/view/" + getId();
    return view("review/view");
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:13,
代码来源:CustomerReviewAction.java

示例12: processReview

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@HandlesEvent("add")
public Resolution processReview() {
    if (!isCustomerLoggedIn())
        return redirect("/customer/account/login");

    if (getId() == null)
        return new ErrorResolution(404);

    Product p = productService.getProduct(getId());
    if (p == null)
        return new ErrorResolution(404);

    if (customerReviewService.hasReview(getId(), ((Customer) getLoggedInCustomer()).getId())) {
        return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
    }

    CustomerReview customerReview = app.model(CustomerReview.class);
    customerReview.setProductId(getId());
    customerReview.setRating(getRating());
    customerReview.setHeadline(getHeadline());
    customerReview.setReview(getReview());
    customerReview.belongsTo(this.<Customer>getLoggedInCustomer());
    customerReview.setPublished(getAutoPublished());

    customerReviewService.createReview(customerReview);

    return redirect("/review/customer/" + ((Customer) getLoggedInCustomer()).getId());
}
 

开发者ID:geetools,
项目名称:geeCommerce-Java-Shop-Software-and-PIM,
代码行数:29,
代码来源:CustomerReviewAction.java

示例13: execute

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
public void execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
    if(request.getParameter("__portofino_quiet_auth_failure") != null) {
        return;
    }
    ServletContext servletContext = request.getServletContext();
    Configuration configuration =
            (Configuration) servletContext.getAttribute(BaseModule.PORTOFINO_CONFIGURATION);
    String loginPage = configuration.getString(PortofinoProperties.LOGIN_PAGE);
    if (response.getContentType() == null || response.getContentType().contains("text/html")) {
        ElementsActionBeanContext context = new ElementsActionBeanContext();
        context.setRequest(request);
        String originalPath = context.getActionPath();
        UrlBuilder urlBuilder =
                new UrlBuilder(Locale.getDefault(), originalPath, false);
        Map<?, ?> parameters = request.getParameterMap();
        urlBuilder.addParameters(parameters);
        String returnUrl = urlBuilder.toString();
        logger.info("Anonymous user not allowed to see {}. Redirecting to login.", originalPath);
        RedirectResolution redirectResolution =
                new RedirectResolution(loginPage, true);
        redirectResolution.addParameter("returnUrl", returnUrl);
        redirectResolution.execute(request, response);
    } else {
        logger.debug("AJAX call while user disconnected");
        UrlBuilder loginUrlBuilder =
                new UrlBuilder(request.getLocale(), loginPage, false);
        response.setHeader(LOGIN_PAGE_HEADER, loginUrlBuilder.toString());
        new ErrorResolution(STATUS, errorMessage).execute(request, response);
    }
}
 

开发者ID:ManyDesigns,
项目名称:Portofino,
代码行数:31,
代码来源:AuthenticationRequiredResolution.java

示例14: preparePage

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
public Resolution preparePage() {
    if(!pageInstance.getParameters().isEmpty()) {
        return new ErrorResolution(404);
    }
    chartConfiguration = (ChartJsConfiguration) pageInstance.getConfiguration();
    return null;
}
 

开发者ID:ManyDesigns,
项目名称:Portofino,
代码行数:8,
代码来源:ChartJsAction.java

示例15: execute

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
@DefaultHandler
public Resolution execute() {
    String clientIP = context.getRequest().getRemoteAddr();
    try {
        InetAddress clientAddr = InetAddress.getByName(clientIP);
        if(!isLocalIPAddress(clientAddr)) {
            logger.warn("Received request from non-local addr, forbidding access: {}", clientAddr);
            return new ErrorResolution(403);
        }
    } catch (UnknownHostException e) {
        logger.error("Could not determine request address", e);
        return new ErrorResolution(403);
    }

    MailSender mailSender = (MailSender) context.getServletContext().getAttribute(MailModule.MAIL_SENDER);
    if(mailSender == null) {
        return new ErrorResolution(500, "Mail Sender not active");
    }
    logger.debug("Sending pending email messages");
    HashSet<String> idsToMarkAsSent = new HashSet<String>();
    int serverErrors = mailSender.runOnce(idsToMarkAsSent);
    if(serverErrors < 0) {
        logger.warn("Mail sender did not run.");
    } else if(serverErrors > 0) {
        logger.warn("Mail sender encountered {} server errors.", serverErrors);
    }
    if(!idsToMarkAsSent.isEmpty()) {
        logger.warn("The following email(s) were sent but could not be marked as sent; they will be sent twice! {}", idsToMarkAsSent);
    }

    return null;
}
 

开发者ID:ManyDesigns,
项目名称:Portofino,
代码行数:33,
代码来源:SendMailAction.java

示例16: intercept

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
public Resolution intercept(ExecutionContext context) throws Exception {
    logger.debug("Retrieving Stripes objects");
    ActionBean actionBean = context.getActionBean();
    Method handler = context.getHandler();

    logger.debug("Checking guards on {}", handler);
    if(ButtonsLogic.doGuardsPass(actionBean, handler)) {
        return context.proceed();
    } else {
        logger.warn("Operation not permitted.");
        return new ErrorResolution(CONFLICT);
    }
}
 

开发者ID:hongliangpan,
项目名称:manydesigns.cn,
代码行数:14,
代码来源:GuardsInterceptor.java

示例17: preparePage

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
public Resolution preparePage() {
	if (!pageInstance.getParameters().isEmpty()) {
		return new ErrorResolution(404);
	}
	chartConfiguration = (ChartConfiguration) pageInstance.getConfiguration();
	return null;
}
 

开发者ID:hongliangpan,
项目名称:manydesigns.cn,
代码行数:8,
代码来源:ChartAction.java

示例18: preparePage

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
public Resolution preparePage() {
    if(!PageActionLogic.supportsDetail(getClass()) && !pageInstance.getParameters().isEmpty()) {
        return new ErrorResolution(404);
    }
    return null;
}
 

开发者ID:ManyDesigns,
项目名称:Portofino,
代码行数:7,
代码来源:CustomAction.java

示例19: preparePage

点赞 2

import net.sourceforge.stripes.action.ErrorResolution; //导入依赖的package包/类
public Resolution preparePage() {
    if(!pageInstance.getParameters().isEmpty()) {
        return new ErrorResolution(404);
    }
    return null;
}
 

开发者ID:ManyDesigns,
项目名称:Portofino,
代码行数:7,
代码来源:ActivityStreamAction.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)