本文整理汇总了Java中net.sourceforge.stripes.exception.StripesServletException类的典型用法代码示例。如果您正苦于以下问题:Java StripesServletException类的具体用法?Java StripesServletException怎么用?Java StripesServletException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StripesServletException类属于net.sourceforge.stripes.exception包,在下文中一共展示了StripesServletException类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: doStartTag
import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
* Determine if the body should be evaluated or not.
*
* @return EVAL_BODY_INCLUDE if the body should be included, or SKIP_BODY
* @throws JspException when the tag cannot (decide if to) write the body content
*/
@Override
public int doStartTag()
throws JspException
{
// Retrieve the action bean and event handler to secure.
ActionBean actionBean;
if (bean == null)
{
// Search in page, request, session (if valid) and application scopes, in that order.
actionBean = (ActionBean)pageContext.findAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN);
LOG.debug("Determining access for the action bean of the form: ", actionBean);
}
else
{
// Search in page, request, session (if valid) and application scopes, in that order.
actionBean = (ActionBean)pageContext.findAttribute(bean);
LOG.debug("Determining access for action bean \"", bean, "\": ", actionBean);
}
if (actionBean == null)
{
throw new StripesJspException(
"Could not find the action bean. This means that either you specified the name \n" +
"of a bean that doesn't exist, or this tag is not used inside a Stripes Form.");
}
Method handler;
try
{
if (event == null)
{
handler = StripesFilter.getConfiguration().getActionResolver().getDefaultHandler(actionBean.getClass());
LOG.debug("Found a handler for the default event: ", handler);
}
else
{
handler = StripesFilter.getConfiguration().getActionResolver().getHandler(actionBean.getClass(), event);
LOG.debug("Found a handler for event \"", event, "\": %s", handler);
}
}
catch (StripesServletException e)
{
throw new StripesJspException("Failed to get the handler for the event.", e);
}
// Get the judgement of the security manager.
SecurityManager securityManager = (SecurityManager)pageContext.getAttribute(
SecurityInterceptor.SECURITY_MANAGER, PageContext.REQUEST_SCOPE);
boolean haveSecurityManager = securityManager != null;
boolean eventAllowed;
if (haveSecurityManager)
{
LOG.debug("Determining access using this security manager: ", securityManager);
eventAllowed = Boolean.TRUE.equals(securityManager.getAccessAllowed(actionBean, handler));
}
else
{
LOG.debug("There is no security manager; allowing access");
eventAllowed = true;
}
// Show the tag's content (or not) based on this
//noinspection deprecation
if (haveSecurityManager && negate)
{
LOG.debug("This tag negates the decision of the security manager.");
eventAllowed = !eventAllowed;
}
LOG.debug("Access is ", eventAllowed ? "allowed" : "denied", '.');
return eventAllowed ? EVAL_BODY_AGAIN : SKIP_BODY;
}
开发者ID:StripesFramework,项目名称:stripes-stuff,代码行数:81,代码来源:AllowedTag.java
示例17: getActionBean
import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
* Returns the ActionBean class that is bound to the UrlBinding supplied. If the action
* bean already exists in the appropriate scope (request or session) then the existing
* instance will be supplied. If not, then a new instance will be manufactured and have
* the supplied ActionBeanContext set on it.
*
* @param path a URL to which an ActionBean is bound, or a path starting with the URL
* to which an ActionBean has been bound.
* @param context the current ActionBeanContext
* @return a Class<ActionBean> for the ActionBean requested
* @throws StripesServletException if the UrlBinding does not match an ActionBean binding
*/
public ActionBean getActionBean(ActionBeanContext context, String path) throws StripesServletException {
Class<? extends ActionBean> beanClass = getActionBeanType(path);
ActionBean bean;
if (beanClass == null) {
throw new ActionBeanNotFoundException(path, getUrlBindingFactory().getPathMap());
}
String bindingPath = getUrlBinding(beanClass);
try {
HttpServletRequest request = context.getRequest();
if (beanClass.isAnnotationPresent(SessionScope.class)) {
bean = (ActionBean) request.getSession().getAttribute(bindingPath);
if (bean == null) {
bean = makeNewActionBean(beanClass, context);
request.getSession().setAttribute(bindingPath, bean);
}
}
else {
bean = (ActionBean) request.getAttribute(bindingPath);
if (bean == null) {
bean = makeNewActionBean(beanClass, context);
request.setAttribute(bindingPath, bean);
}
}
setActionBeanContext(bean, context);
}
catch (Exception e) {
StripesServletException sse = new StripesServletException(
"Could not create instance of ActionBean type [" + beanClass.getName() + "].", e);
log.error(sse);
throw sse;
}
assertGetContextWorks(bean);
return bean;
}
开发者ID:scarcher2,项目名称:stripes,代码行数:54,代码来源:AnnotatedClassActionResolver.java
示例18: getActionBean
import net.sourceforge.stripes.exception.StripesServletException; //导入依赖的package包/类
/**
* Gets the logical name of the ActionBean that should handle the request. Implemented to look
* up the name of the form based on the name assigned to the form in the form tag, and
* encoded in a hidden field.
*
* @param context the ActionBeanContext for the current request
* @return the name of the form to be used for this request
*/
public ActionBean getActionBean(ActionBeanContext context) throws StripesServletException {
HttpServletRequest request = context.getRequest();
String path = HttpUtil.getRequestedPath(request);
ActionBean bean = getActionBean(context, path);
request.setAttribute(RESOLVED_ACTION, getUrlBindingFromPath(path));
return bean;
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:16,代码来源:AnnotatedClassActionResolver.java
注:本文中的net.sourceforge.stripes.exception.StripesServletException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论