javax.ejb.AccessLocalException Java Examples
The following examples show how to use
javax.ejb.AccessLocalException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdminfacesAutoConfiguration.java From joinfaces with Apache License 2.0 | 6 votes |
/** * This {@link WebFragmentRegistrationBean} is equivalent to the * {@code META-INF/web-fragment.xml} of the {@code admin-template.jar}. * * @return adminTemplateWebFragmentRegistrationBean */ @Bean public WebFragmentRegistrationBean adminTemplateWebFragmentRegistrationBean() { WebFragmentRegistrationBean bean = new WebFragmentRegistrationBean(); bean.getContextParams().put("primefaces.THEME", "admin"); bean.getErrorPages().add(new ErrorPage(HttpStatus.FORBIDDEN, "/403.xhtml")); bean.getErrorPages().add(new ErrorPage(AccessDeniedException.class, "/403.xhtml")); bean.getErrorPages().add(new ErrorPage(AccessLocalException.class, "/403.xhtml")); bean.getErrorPages().add(new ErrorPage(HttpStatus.NOT_FOUND, "/404.xhtml")); bean.getErrorPages().add(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.xhtml")); bean.getErrorPages().add(new ErrorPage(Throwable.class, "/500.xhtml")); bean.getErrorPages().add(new ErrorPage(ViewExpiredException.class, "/expired.xhtml")); bean.getErrorPages().add(new ErrorPage(OptimisticLockException.class, "/optimistic.xhtml")); bean.getListeners().add(AdminServletContextListener.class); return bean; }
Example #2
Source File: AccessLocalExceptionMapper.java From eplmp with Eclipse Public License 1.0 | 5 votes |
@Override public Response toResponse(AccessLocalException e) { LOGGER.log(Level.WARNING, e.getMessage()); LOGGER.log(Level.FINE, null, e); return Response.status(Response.Status.UNAUTHORIZED) .header("Reason-Phrase", "Access denied") .build(); }
Example #3
Source File: EJBInvocationHandler.java From tomee with Apache License 2.0 | 4 votes |
/** * Renamed method so it shows up with a much more understandable purpose as it * will be the top element in the stacktrace * * @param e Throwable * @param method Method */ protected Throwable convertException(final Throwable e, final Method method) { if (!remote && e instanceof RemoteException) { if (e instanceof TransactionRequiredException) { return new TransactionRequiredLocalException(e.getMessage()).initCause(getCause(e)); } if (e instanceof TransactionRolledbackException) { return new TransactionRolledbackLocalException(e.getMessage()).initCause(getCause(e)); } /** * If a client attempts to invoke a method on a removed bean's business interface, * we must throw a javax.ejb.NoSuchEJBException. If the business interface is a * remote business interface that extends java.rmi.Remote, the * java.rmi.NoSuchObjectException is thrown to the client instead. * See EJB 3.0, section 4.4 */ if (e instanceof NoSuchObjectException) { if (java.rmi.Remote.class.isAssignableFrom(method.getDeclaringClass())) { return e; } else { return new NoSuchEJBException(e.getMessage()).initCause(getCause(e)); } } if (e instanceof AccessException) { return new AccessLocalException(e.getMessage()).initCause(getCause(e)); } return new EJBException(e.getMessage()).initCause(getCause(e)); } if (remote && e instanceof EJBAccessException) { if (e.getCause() instanceof Exception) { return new AccessException(e.getMessage(), (Exception) e.getCause()); } else { return new AccessException(e.getMessage()); } } if (!remote && e instanceof EJBTransactionRolledbackException) { return new TransactionRolledbackLocalException(e.getMessage()).initCause(getCause(e)); } return e; }
Example #4
Source File: BaseEjbProxyHandler.java From tomee with Apache License 2.0 | 4 votes |
/** * Renamed method so it shows up with a much more understandable purpose as it * will be the top element in the stacktrace * * @param e Throwable * @param method Method * @param interfce Class */ protected Throwable convertException(Throwable e, final Method method, final Class interfce) { final boolean rmiRemote = Remote.class.isAssignableFrom(interfce); if (e instanceof TransactionRequiredException) { if (!rmiRemote && interfaceType.isBusiness()) { return new EJBTransactionRequiredException(e.getMessage()).initCause(getCause(e)); } else if (interfaceType.isLocal()) { return new TransactionRequiredLocalException(e.getMessage()).initCause(getCause(e)); } else { return e; } } if (e instanceof TransactionRolledbackException) { if (!rmiRemote && interfaceType.isBusiness()) { return new EJBTransactionRolledbackException(e.getMessage()).initCause(getCause(e)); } else if (interfaceType.isLocal()) { return new TransactionRolledbackLocalException(e.getMessage()).initCause(getCause(e)); } else { return e; } } if (e instanceof NoSuchObjectException) { if (!rmiRemote && interfaceType.isBusiness()) { return new NoSuchEJBException(e.getMessage()).initCause(getCause(e)); } else if (interfaceType.isLocal()) { return new NoSuchObjectLocalException(e.getMessage()).initCause(getCause(e)); } else { return e; } } if (e instanceof AccessException) { if (!rmiRemote && interfaceType.isBusiness()) { return new AccessLocalException(e.getMessage()).initCause(getCause(e)); } else if (interfaceType.isLocal()) { return new AccessLocalException(e.getMessage()).initCause(getCause(e)); } else { return e; } } if (e instanceof RemoteException) { if (!rmiRemote && interfaceType.isBusiness()) { return new EJBException(e.getMessage()).initCause(getCause(e)); } else if (interfaceType.isLocal()) { return new EJBException(e.getMessage()).initCause(getCause(e)); } else { return e; } } for (final Class<?> type : method.getExceptionTypes()) { if (type.isAssignableFrom(e.getClass())) { return e; } } // Exception is undeclared // Try and find a runtime exception in there while (e.getCause() != null && !(e instanceof RuntimeException)) { e = e.getCause(); } return e; }