当前位置: 首页>>代码示例>>Java>>正文


Java StripesServletException类代码示例

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


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

示例1: initDefaultValueWithDefaultHandlerIfNeeded

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Ensure the default event name is set if the binding uses the $event parameter.
 * Can only be done safely after the event mappings have been processed.
 * see http://www.stripesframework.org/jira/browse/STS-803
 */
void initDefaultValueWithDefaultHandlerIfNeeded(ActionResolver actionResolver) {
    if (PARAMETER_NAME_EVENT.equals(name)) {
        Method defaultHandler;
        try {
            defaultHandler = actionResolver.getDefaultHandler(beanClass);
        } catch (StripesServletException e) {
            throw new StripesRuntimeException("Caught an exception trying to get default handler for ActionBean '" + beanClass.getName() +
                    "'. Make sure this ActionBean has a default handler.", e);
        }
        HandlesEvent annotation = defaultHandler.getAnnotation(HandlesEvent.class);
        if (annotation != null) {
            this.defaultValue = annotation.value();
        } else {
            this.defaultValue = defaultHandler.getName();
        }
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:23,代码来源:UrlBindingParameter.java

示例2: getActionBean

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * <p>Overridden to trap the exception that is thrown when a URL cannot be mapped to an
 * ActionBean and then attempt to construct a dummy ActionBean that will forward the
 * user to an appropriate view.  In an exception is caught then the method
 * {@link #handleActionBeanNotFound(ActionBeanContext, String)} is invoked to handle
 * the exception.</p>
 *
 * @param context the ActionBeanContext of the current request
 * @param urlBinding the urlBinding determined for the current request
 * @return an ActionBean if there is an appropriate way to handle the request
 * @throws StripesServletException if no ActionBean or alternate strategy can be found
 */
@Override
public ActionBean getActionBean(ActionBeanContext context,
                                String urlBinding) throws StripesServletException {
    try {
        return super.getActionBean(context, urlBinding);
    }
    catch (StripesServletException sse) {
        ActionBean bean = handleActionBeanNotFound(context, urlBinding);
        if (bean != null) {
            setActionBeanContext(bean, context);
            assertGetContextWorks(bean);
            return bean;
        }
        else {
            throw sse;
        }
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:31,代码来源:NameBasedActionResolver.java

示例3: getDefaultHandler

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Returns the Method that is the default handler for events in the ActionBean class supplied.
 * If only one handler method is defined in the class, that is assumed to be the default. If
 * there is more than one then the method marked with @DefaultHandler will be returned.
 *
 * @param bean the ActionBean type bound to the request
 * @return Method object that should handle the request
 * @throws StripesServletException if no default handler could be located
 */
public Method getDefaultHandler(Class<? extends ActionBean> bean) throws StripesServletException {
    Map<String,Method> handlers = this.eventMappings.get(bean);

    if (handlers.size() == 1) {
        return handlers.values().iterator().next();
    }
    else {
        Method handler = handlers.get(DEFAULT_HANDLER_KEY);
        if (handler != null) return handler;
    }

    // If we get this far, there is no sensible default!  Kaboom!
    throw new StripesServletException("No default handler could be found for ActionBean of " +
        "type: " + bean.getName());
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:25,代码来源:AnnotatedClassActionResolver.java

示例4: StripesRequestWrapper

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Constructor that will, if the POST is multi-part, parse the POST data and make it
 * available through the normal channels.  If the request is not a multi-part post then it is
 * just wrapped and the behaviour is unchanged.
 *
 * @param request the HttpServletRequest to wrap
 *        this is not a file size limit, but a post size limit.
 * @throws FileUploadLimitExceededException if the total post size is larger than the limit
 * @throws StripesServletException if any other error occurs constructing the wrapper
 */
public StripesRequestWrapper(HttpServletRequest request) throws StripesServletException {
    super(request);

    String contentType = request.getContentType();
    boolean isPost = "POST".equalsIgnoreCase(request.getMethod());
    if (isPost && contentType != null && contentType.startsWith("multipart/form-data")) {
        constructMultipartWrapper(request);
    }

    // Create a parameter map that merges the URI parameters with the others
    if (isMultipart())
        this.parameterMap = new MergedParameterMap(this, this.multipart);
    else
        this.parameterMap = new MergedParameterMap(this);
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:26,代码来源:StripesRequestWrapper.java

示例5: getDefaultHandler

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Returns the Method that is the default handler for events in the
 * ActionBean class supplied. If only one handler method is defined in the
 * class, that is assumed to be the default. If there is more than one then
 * the method marked with @DefaultHandler will be returned.
 * 
 * @param bean
 *            the ActionBean type bound to the request
 * @return Method object that should handle the request
 * @throws StripesServletException
 *             if no default handler could be located
 */
public Method getDefaultHandler(Class<? extends ActionBean> bean) throws StripesServletException {
    Map<String, Method> handlers = eventMappings.get(getGuicelessActionBean(bean));

    if (handlers.size() == 1) {
        return handlers.values().iterator().next();
    } else {
        Method handler = handlers.get(DEFAULT_HANDLER_KEY);
        if (handler != null)
            return handler;
    }

    // If we get this far, there is no sensible default! Kaboom!
    throw new StripesServletException(
        "No default handler could be found for ActionBean of " + "type: " + bean.getName());
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:28,代码来源:AnnotatedClassActionResolver.java

示例6: isEventName

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Returns true if {@code name} is the name of an event handled by {@link ActionBean}s of type
 * {@code beanType}.
 * 
 * @param beanType An {@link ActionBean} class
 * @param name The name to look up
 */
protected boolean isEventName(Class<? extends ActionBean> beanType, String name) {
    if (beanType == null || name == null)
        return false;

    try {
        ActionResolver actionResolver = StripesFilter.getConfiguration().getActionResolver();
        return actionResolver.getHandler(beanType, name) != null;
    }
    catch (StripesServletException e) {
        // Ignore the exception and assume the name is not an event
        return false;
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:21,代码来源:WizardFieldsTag.java

示例7: getContextInstance

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Returns a new instance of the configured class, or ActionBeanContext if a class is
 * not specified.
 */
public ActionBeanContext getContextInstance(HttpServletRequest request,
                                            HttpServletResponse response) throws ServletException {
    try {
        ActionBeanContext context = getConfiguration().getObjectFactory().newInstance(
                this.contextClass);
        context.setRequest(request);
        context.setResponse(response);
        return context;
    }
    catch (Exception e) {
        throw new StripesServletException("Could not instantiate configured " +
        "ActionBeanContext class: " + this.contextClass, e);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:19,代码来源:DefaultActionBeanContextFactory.java

示例8: assertGetContextWorks

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Since many down stream parts of Stripes rely on the ActionBean properly returning the
 * context it is given, we'll just test it up front. Called after the bean is instantiated.
 *
 * @param bean the ActionBean to test to see if getContext() works correctly
 * @throws StripesServletException if getContext() returns null
 */
protected void assertGetContextWorks(final ActionBean bean) throws StripesServletException {
    if (bean.getContext() == null) {
        throw new StripesServletException("Ahem. Stripes has just resolved and instantiated " +
                "the ActionBean class " + bean.getClass().getName() + " and set the ActionBeanContext " +
                "on it. However calling getContext() isn't returning the context back! Since " +
                "this is required for several parts of Stripes to function correctly you should " +
                "now stop and implement setContext()/getContext() correctly. Thank you.");
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:17,代码来源:AnnotatedClassActionResolver.java

示例9: getHandler

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Uses the Maps constructed earlier to locate the Method which can handle the event.
 *
 * @param bean the subclass of ActionBean that is bound to the request.
 * @param eventName the name of the event being handled
 * @return a Method object representing the handling method.
 * @throws StripesServletException thrown when no method handles the named event.
 */
public Method getHandler(Class<? extends ActionBean> bean, String eventName)
    throws StripesServletException {
    Map<String,Method> mappings = this.eventMappings.get(bean);
    Method handler = mappings.get(eventName);

    // If we could not find a handler then we should blow up quickly
    if (handler == null) {
        throw new StripesServletException(
                "Could not find handler method for event name [" + eventName + "] on class [" +
                bean.getName() + "].  Known handler mappings are: " + mappings);
    }

    return handler;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:23,代码来源:AnnotatedClassActionResolver.java

示例10: createConfiguration

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Create and configure a new {@link Configuration} instance using the suppied
 * {@link FilterConfig}.
 * 
 * @param filterConfig The filter configuration supplied by the container.
 * @return The new configuration instance.
 * @throws ServletException If the configuration cannot be created.
 */
protected static Configuration createConfiguration(FilterConfig filterConfig)
        throws ServletException {
    BootstrapPropertyResolver bootstrap = new BootstrapPropertyResolver(filterConfig);

    // Set up the Configuration - if one isn't found by the bootstrapper then
    // we'll just use the default: RuntimeConfiguration
    Class<? extends Configuration> clazz = bootstrap.getClassProperty(CONFIG_CLASS,
            Configuration.class);

    if (clazz == null)
        clazz = RuntimeConfiguration.class;

    try {
        Configuration configuration = clazz.newInstance();
        configuration.setBootstrapPropertyResolver(bootstrap);
        configuration.init();
        return configuration;
    }
    catch (Exception e) {
        log.fatal(e,
                "Could not instantiate specified Configuration. Class name specified was ",
                "[", clazz.getName(), "].");
        throw new StripesServletException("Could not instantiate specified Configuration. "
                + "Class name specified was [" + clazz.getName() + "].", e);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:35,代码来源:StripesFilter.java

示例11: wrapRequest

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Wraps the HttpServletRequest with a StripesServletRequest.  This is done to ensure that any
 * form posts that contain file uploads get handled appropriately.
 *
 * @param servletRequest the HttpServletRequest handed to the dispatcher by the container
 * @return an instance of StripesRequestWrapper, which is an HttpServletRequestWrapper
 * @throws StripesServletException if the wrapper cannot be constructed
 */
protected StripesRequestWrapper wrapRequest(HttpServletRequest servletRequest)
        throws StripesServletException {
    try {
        return StripesRequestWrapper.findStripesWrapper(servletRequest);
    }
    catch (IllegalStateException e) {
        return new StripesRequestWrapper(servletRequest);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:18,代码来源:StripesFilter.java

示例12: constructMultipartWrapper

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Responsible for constructing the MultipartWrapper object and setting it on to
 * the instance variable 'multipart'.
 *
 * @param request the HttpServletRequest to wrap
 *        this is not a file size limit, but a post size limit.
 * @throws StripesServletException if any other error occurs constructing the wrapper
 */
protected void constructMultipartWrapper(HttpServletRequest request) throws StripesServletException {
    try {
        this.multipart =
                StripesFilter.getConfiguration().getMultipartWrapperFactory().wrap(request);
    }
    catch (IOException e) {
        throw new StripesServletException("Could not construct request wrapper.", e);
    }
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:18,代码来源:StripesRequestWrapper.java

示例13: getHandler

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * Uses the Maps constructed earlier to locate the Method which can handle
 * the event.
 * 
 * @param bean
 *            the subclass of ActionBean that is bound to the request.
 * @param eventName
 *            the name of the event being handled
 * @return a Method object representing the handling method.
 * @throws StripesServletException
 *             thrown when no method handles the named event.
 */
public Method getHandler(Class<? extends ActionBean> bean, String eventName) throws StripesServletException {
    Map<String, Method> mappings = eventMappings.get(getGuicelessActionBean(bean));
    Method handler = mappings.get(eventName);

    // If we could not find a handler then we should blow up quickly
    if (handler == null) {
        throw new StripesServletException("Could not find handler method for event name [" + eventName
            + "] on class [" + bean.getName() + "].  Known handler mappings are: " + mappings);
    }

    return handler;
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:25,代码来源:AnnotatedClassActionResolver.java

示例14: getActionBean

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
 * <p>
 * Overridden to trap the exception that is thrown when a URL cannot be
 * mapped to an ActionBean and then attempt to construct a dummy ActionBean
 * that will forward the user to an appropriate view. In an exception is
 * caught then the method
 * {@link #handleActionBeanNotFound(ActionBeanContext, String)} is invoked
 * to handle the exception.
 * </p>
 *
 * @param context
 *            the ActionBeanContext of the current request
 * @param urlBinding
 *            the urlBinding determined for the current request
 * @return an ActionBean if there is an appropriate way to handle the
 *         request
 * @throws StripesServletException
 *             if no ActionBean or alternate strategy can be found
 */
@Override
public ActionBean getActionBean(ActionBeanContext context, String urlBinding) throws StripesServletException {
    try {
        return super.getActionBean(context, urlBinding);
    } catch (StripesServletException sse) {
        ActionBean bean = handleActionBeanNotFound(context, urlBinding);
        if (bean != null) {
            setActionBeanContext(bean, context);
            assertGetContextWorks(bean);
            return bean;
        } else {
            throw sse;
        }
    }
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:35,代码来源:NameBasedActionResolver.java

示例15: handleStripesServletException

import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
public Resolution handleStripesServletException(StripesServletException servletException, HttpServletRequest request, HttpServletResponse response) {
	logger.info("handleStripesServletException invoked " + servletException.getMessage());
	return new ForwardResolution("/error.jsp").addParameter("exception", servletException.getMessage());
}
 
开发者ID:mikkeliamk,项目名称:osa,代码行数:5,代码来源:CustomExceptionHandler.java


注:本文中的net.sourceforge.stripes.exception.StripesServletException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。