本文整理汇总了Java中net.sourceforge.stripes.action.ForwardResolution类的典型用法代码示例。如果您正苦于以下问题:Java ForwardResolution类的具体用法?Java ForwardResolution怎么用?Java ForwardResolution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ForwardResolution类属于net.sourceforge.stripes.action包,在下文中一共展示了ForwardResolution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findView
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
/**
* <p>Attempts to locate a default view for the urlBinding provided and return a
* ForwardResolution that will take the user to the view. Looks for views by using the
* list of attempts returned by {@link #getFindViewAttempts(String)}.
*
* <p>For each view name derived a check is performed using
* {@link ServletContext#getResource(String)} to see if there is a file located at that URL.
* Only if a file actually exists will a Resolution be returned.</p>
*
* <p>Can be overridden to provide a different kind of resolution. It is strongly recommended
* when overriding this method to check for the actual existence of views prior to manufacturing
* a resolution in order not to cause confusion when URLs are mistyped.</p>
*
* @param urlBinding the url being accessed by the client in the current request
* @return a Resolution if a default view can be found, or null otherwise
* @since Stripes 1.3
*/
protected Resolution findView(String urlBinding) {
List<String> attempts = getFindViewAttempts(urlBinding);
ServletContext ctx = StripesFilter.getConfiguration()
.getBootstrapPropertyResolver().getFilterConfig().getServletContext();
for (String jsp : attempts) {
try {
// This will try /account/ViewAccount.jsp
if (ctx.getResource(jsp) != null) {
return new ForwardResolution(jsp);
}
}
catch (MalformedURLException mue) {
}
}
return null;
}
示例2: newOrderForm
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution newOrderForm() {
HttpSession session = context.getRequest().getSession();
AccountActionBean accountBean = (AccountActionBean) session.getAttribute("/actions/Account.action");
CartActionBean cartBean = (CartActionBean) session.getAttribute("/actions/Cart.action");
clear();
if (accountBean == null || !accountBean.isAuthenticated()) {
setMessage("You must sign on before attempting to check out. Please sign on and try checking out again.");
return new ForwardResolution(AccountActionBean.class);
} else if (cartBean != null) {
order.initOrder(accountBean.getAccount(), cartBean.getCart());
return new ForwardResolution(NEW_ORDER);
} else {
setMessage("An order could not be created because a cart could not be found.");
return new ForwardResolution(ERROR);
}
}
示例3: newOrder
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution newOrder() {
HttpSession session = context.getRequest().getSession();
if (shippingAddressRequired) {
shippingAddressRequired = false;
return new ForwardResolution(SHIPPING);
} else if (!isConfirmed()) {
return new ForwardResolution(CONFIRM_ORDER);
} else if (getOrder() != null) {
orderService.insertOrder(order);
CartActionBean cartBean = (CartActionBean) session.getAttribute("/actions/Cart.action");
cartBean.clear();
setMessage("Thank you, your order has been submitted.");
return new ForwardResolution(VIEW_ORDER);
} else {
setMessage("An error occurred processing your order (order was null).");
return new ForwardResolution(ERROR);
}
}
示例4: signon
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution signon() {
account = accountService.getAccount(getUsername(), getPassword());
if (account == null) {
String value = "Invalid username or password. Signon failed.";
setMessage(value);
clear();
return new ForwardResolution(SIGNON);
} else {
account.setPassword(null);
myList = catalogService.getProductListByCategory(account.getFavouriteCategoryId());
authenticated = true;
HttpSession s = context.getRequest().getSession();
// this bean is already registered as /actions/Account.action
s.setAttribute("accountBean", this);
return new RedirectResolution(CatalogActionBean.class);
}
}
示例5: updateCartQuantities
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution updateCartQuantities() {
HttpServletRequest request = context.getRequest();
Iterator<CartItem> cartItems = getCart().getAllCartItems();
while (cartItems.hasNext()) {
CartItem cartItem = (CartItem) cartItems.next();
String itemId = cartItem.getItem().getItemId();
try {
int quantity = Integer.parseInt((String) request.getParameter(itemId));
getCart().setQuantityByItemId(itemId, quantity);
if (quantity < 1) {
cartItems.remove();
}
} catch (Exception e) {
//ignore parse exceptions on purpose
}
}
return new ForwardResolution(VIEW_CART);
}
示例6: showLogFile
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
@HandlesEvent("showLogFile")
public Resolution showLogFile() {
if (!isDocumentAdder()) {
return new ForwardResolution(ERROR_500);
}
FileInputStream fis = null;
DataInputStream dis = null;
File logFile = new File(this.getLogDirectory(logName,true)+ "/" +filename);
if (logFile.canRead()) {
try {
fis = new FileInputStream(logFile);
} catch (FileNotFoundException e) {
e.printStackTrace();
return new StreamingResolution(MIME_TEXT, new LocalizableMessage("error.filenotfound").getMessage(getUserLocale()));
}
dis = new DataInputStream(fis);
} else {
return new StreamingResolution(MIME_TEXT, new LocalizableMessage("error.filenotfound").getMessage(getUserLocale()));
}
// Force view in browser
StreamingResolution streamRes = new StreamingResolution(MIME_TEXT, dis).setAttachment(false);
streamRes.setCharacterEncoding("UTF-8");
return streamRes;
}
示例7: updateConfiguration
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
@Button(list = "configuration", key = "update.configuration", type = Button.TYPE_PRIMARY)
@RequiresPermissions(level = AccessLevel.DEVELOP)
public Resolution updateConfiguration() {
prepareConfigurationForms();
readPageConfigurationFromRequest();
configurationForm.readFromRequest(context.getRequest());
boolean valid = validatePageConfiguration();
valid = valid && configurationForm.validate();
if(valid) {
updatePageConfiguration();
configurationForm.writeToObject(pageInstance.getConfiguration());
saveConfiguration(pageInstance.getConfiguration());
SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
return cancel();
} else {
SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
return new ForwardResolution("/m/map/configure.jsp");
}
}
示例8: updateConfiguration
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
@Button(list = "configuration", key = "update.configuration", type = Button.TYPE_PRIMARY)
@RequiresPermissions(level = AccessLevel.DEVELOP)
public Resolution updateConfiguration() {
prepareConfigurationForms();
readPageConfigurationFromRequest();
configurationForm.readFromRequest(context.getRequest());
boolean valid = validatePageConfiguration();
valid = valid && configurationForm.validate();
if(valid) {
updatePageConfiguration();
configurationForm.writeToObject(pageInstance.getConfiguration());
saveConfiguration(pageInstance.getConfiguration());
SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
return cancel();
} else {
SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
return new ForwardResolution("/m/calendar/configure.jsp");
}
}
示例9: updateConfiguration
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
@Button(list = "configuration", key = "update.configuration", type = Button.TYPE_PRIMARY)
@RequiresPermissions(level = AccessLevel.DEVELOP)
public Resolution updateConfiguration() {
prepareConfigurationForms();
readPageConfigurationFromRequest();
configurationForm.readFromRequest(context.getRequest());
boolean valid = validatePageConfiguration();
valid = valid && configurationForm.validate();
if(valid) {
updatePageConfiguration();
configurationForm.writeToObject(pageInstance.getConfiguration());
saveConfiguration(pageInstance.getConfiguration());
SessionMessages.addInfoMessage(ElementsThreadLocals.getText("configuration.updated.successfully"));
return cancel();
} else {
SessionMessages.addErrorMessage(ElementsThreadLocals.getText("the.configuration.could.not.be.saved"));
return new ForwardResolution("/m/gallery/configure.jsp");
}
}
示例10: update
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution update() {
Customer customer = getContext().getCustomer();
try {
customerPersist.init(getDataBaseConnection());
if (customerPersist.change(customer)) {
getContext().getMessages().add(
new SimpleMessage(getLocalizationKey("message.Customer.updated"),
customer.getName()));
}
} catch (SQLException ex) {
getContext().getValidationErrors().addGlobalError(
new SimpleError(ex.getMessage()));
return getContext().getSourcePageResolution();
}
return new ForwardResolution(WelcomeActionBean.class);
}
示例11: accept
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution accept() throws UnsupportedEncodingException, NoSuchAlgorithmException, SQLException {
// try {
customerPersist.init(getDataBaseConnection());
Customer customer = getCustomer();
customer.setSearchkey(customer.getName());
getContext().getMessages().add(
new SimpleMessage(getLocalizationKey("message.Customer.registered"),
customerPersist.add(customer).getName())
);
// } catch (SQLException ex) {
// getContext().getValidationErrors().addGlobalError(
// new SimpleError(ex.getMessage()));
// return getContext().getSourcePageResolution();
// }
return new ForwardResolution(CustomerAuthorizationActionBean.class);
}
示例12: update
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution update() {
User user = getContext().getUser();
try {
userPersist.init(getDataBaseConnection());
if (userPersist.change(user)) {
getContext().getMessages().add(
new SimpleMessage(getLocalizationKey("message.User.updated"),
user.getName()));
}
} catch (SQLException ex) {
getContext().getValidationErrors().addGlobalError(
new SimpleError(ex.getMessage()));
return getContext().getSourcePageResolution();
}
return new ForwardResolution(WelcomeActionBean.class);
}
示例13: delete
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution delete() throws SQLException {
Place place = getPlace();
try {
sharedTicketPersist.init(getDataBaseConnection());
if (sharedTicketPersist.delete(place.getId())) {
getContext().getMessages().add(
new SimpleMessage(getLocalizationKey("message.Order.deleted"),
place.getName()));
}
} catch (SQLException ex) {
getContext().getValidationErrors().addGlobalError(
new SimpleError(ex.getMessage()));
return getContext().getSourcePageResolution();
}
return new ForwardResolution(FloorListActionBean.class);
}
示例14: accept
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution accept() throws UnsupportedEncodingException, NoSuchAlgorithmException {
try {
userPersist.init(getDataBaseConnection());
User user = getUser();
user.setId(UUID.randomUUID().toString());
getContext().getMessages().add(
new SimpleMessage(getLocalizationKey("message.User.registered"),
userPersist.add(user).getName())
);
} catch (SQLException ex) {
getContext().getValidationErrors().addGlobalError(
new SimpleError(ex.getMessage()));
return getContext().getSourcePageResolution();
}
return new ForwardResolution(UserAuthorizationActionBean.class);
}
示例15: newOrder
import net.sourceforge.stripes.action.ForwardResolution; //导入依赖的package包/类
public Resolution newOrder() {
final HttpSession session = context.getRequest().getSession();
if (shippingAddressRequired) {
shippingAddressRequired = false;
return new ForwardResolution(SHIPPING);
} else if (!isConfirmed()) {
return new ForwardResolution(CONFIRM_ORDER);
} else if (getOrder() != null) {
orderService.insertOrder(order);
final CartActionBean cartBean = (CartActionBean) session.getAttribute("/actions/Cart.action");
cartBean.clear();
setMessage("Thank you, your order has been submitted.");
return new ForwardResolution(VIEW_ORDER);
} else {
setMessage("An error occurred processing your order (order was null).");
return new ForwardResolution(ERROR);
}
}