本文整理汇总了Java中javax.naming.NoPermissionException类的典型用法代码示例。如果您正苦于以下问题:Java NoPermissionException类的具体用法?Java NoPermissionException怎么用?Java NoPermissionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoPermissionException类属于javax.naming包,在下文中一共展示了NoPermissionException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDiscussion
import javax.naming.NoPermissionException; //导入依赖的package包/类
@RequestMapping(value = "/{discussionId}", method = RequestMethod.PUT)
@Interceptors({ ProjectMemberRequired.class, ProjectNotArchivedRequired.class })
@ResponseBody
public Object updateDiscussion(@PathVariable("companyId") int companyId, @PathVariable("projectId") int projectId,
@PathVariable("discussionId") int discussionId, @Valid @RequestBody DiscussionForm form,
@RequestParam(value = "recover", defaultValue = "false", required = true) Boolean recover)
throws NoPermissionException {
if (recover) {
return recoverDiscussion(discussionId);
}
logger.info("Updating discussion " + discussionId);
logger.info("attachments " + form.getAttachments().size());
form.setProjectId(projectId);
form.setCompanyId(companyId);
discussionService.updateSelective(form);
Topic topic = topicService.getTopicByTypeAndId(form.getType(), form.getId());
TopicDTO result = TopicTransform.topicToTopicDTO(topic);
logger.info("add comment count...");
addCommentCount(result);
logger.info("Finishing...");
return result;
}
示例2: recoverDiscussion
import javax.naming.NoPermissionException; //导入依赖的package包/类
private Map<String, ?> recoverDiscussion(@PathVariable("discussionId") int discussionId)
throws NoPermissionException {
logger.info("recovering " + discussionId);
Discussion discussion = discussionService.getById(discussionId);
if (discussion.getId().equals(session.getCurrentUser().getId())) {
throw new NoPermissionException();
}
discussion.setDeleted(false);
discussionService.updateSelective(discussion);
// discussionService.discardDiscussion(discussionId);
discussion = discussionService.getByIdWithDetail(discussionId);
DiscussionDTO discussionDto = DiscussionTransform.discussionToDiscussionDTOWithDetail(discussion);
Topic topic = topicService.getTopicByTypeAndId(discussion.getType(), discussion.getId());
TopicDTO topicDTO = TopicTransform.topicToTopicDTO(topic);
addCommentCount(topicDTO);
return ImmutableMap.of("discussion", discussionDto, "topic", topicDTO);
}
示例3: checkIsDestroyed
import javax.naming.NoPermissionException; //导入依赖的package包/类
/**
* Checks if this context has been destroyed. isDestroyed is set to true when a context is
* destroyed by calling destroySubcontext method.
*
* @throws NoPermissionException if this context has been destroyed
*/
private void checkIsDestroyed() throws NamingException {
if (isDestroyed) {
throw new NoPermissionException(
LocalizedStrings.ContextImpl_CAN_NOT_INVOKE_OPERATIONS_ON_DESTROYED_CONTEXT
.toLocalizedString());
}
}
示例4: addToEnvironment
import javax.naming.NoPermissionException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Object addToEnvironment(String propName, Object propVal)
throws NoPermissionException {
if (propName.equals(SECURITY_MANAGER)) {
installSecurityManager();
}
return environment.put(propName, propVal);
}
示例5: installSecurityManager
import javax.naming.NoPermissionException; //导入依赖的package包/类
/**
* Installs {@link RMISecurityManager} if it is not already installed.
*
* @throws NoPermissionException
* If security manager other than {@link RMISecurityManager} is
* installed and prohibits installing a new security manager.
*/
protected void installSecurityManager() throws NoPermissionException {
if (!(System.getSecurityManager() instanceof RMISecurityManager)) {
try {
System.setSecurityManager(new RMISecurityManager());
} catch (SecurityException e) {
// jndi.84=Cannot install RMISecurityManager
throw (NoPermissionException) new NoPermissionException(
Messages.getString("jndi.84")).initCause(e); //$NON-NLS-1$
}
}
}
示例6: installSecurityManager
import javax.naming.NoPermissionException; //导入依赖的package包/类
/**
* Installs {@link RMISecurityManager} if it is not already installed.
*
* @throws NoPermissionException
* If security manager other than {@link RMISecurityManager}
* is installed and prohibits installing a new security manager.
*/
protected void installSecurityManager() throws NoPermissionException {
if (! (System.getSecurityManager() instanceof RMISecurityManager)) {
try {
System.setSecurityManager(new RMISecurityManager());
} catch (SecurityException e) {
// jndi.84=Cannot install RMISecurityManager
throw (NoPermissionException) new NoPermissionException(
Messages.getString("jndi.84")).initCause(e); //$NON-NLS-1$
}
}
}
示例7: newNamingException
import javax.naming.NoPermissionException; //导入依赖的package包/类
/**
* Prepares a new {@link NamingException} wrapping the specified
* {@link RemoteException} source exception. Source exception becomes a
* {@linkplain NamingException#getCause() cause} of the generated exception.
*
* The particular subclass of {@link NamingException} returned depends on
* the particular subclass of source {@link RemoteException}.
*
* If source exception is not of a specific class or is not a
* {@link RemoteException} or is <code>null</code>, then plain
* {@link NamingException} is returned.
*
* Note: {@link Throwable#fillInStackTrace()} should be called before
* throwing the generated exception, to provide the proper (not including
* this method) stack trace for the exception.
*
* Example of use:
*
* <code>try {
* ...
* } catch (RemoteException e) {
* throw (NamingException) newNamingException(e).fillInStackTrace();
* }</code>
*
* @param e
* Source {@link RemoteException}.
*
* @return Generated {@link NamingException} exception.
*/
@SuppressWarnings("deprecation")
protected NamingException newNamingException(Throwable e) {
NamingException ret = (e instanceof AccessException) ? new NoPermissionException()
: (e instanceof ConnectException) ? new ServiceUnavailableException()
: (e instanceof ConnectIOException)
|| (e instanceof ExportException)
|| (e instanceof MarshalException)
|| (e instanceof UnmarshalException) ? new CommunicationException()
: (e instanceof ActivateFailedException)
|| (e instanceof NoSuchObjectException)
|| (e instanceof java.rmi.server.SkeletonMismatchException)
|| (e instanceof java.rmi.server.SkeletonNotFoundException)
|| (e instanceof StubNotFoundException)
|| (e instanceof UnknownHostException) ? new ConfigurationException()
: (e instanceof ServerException) ? newNamingException(e
.getCause())
: new NamingException();
if (ret.getCause() == null) {
ret.initCause(e);
}
return ret;
}
示例8: registerUser
import javax.naming.NoPermissionException; //导入依赖的package包/类
@PostMapping(value = "/register", headers = "Content-Type=application/x-www-form-urlencoded")
@ResponseBody
public Map<String, String> registerUser(@Valid @ModelAttribute RegisterRequest registerRequest,
@Valid @ModelAttribute CaptchaRequest captchaRequest, HttpServletRequest request) throws Exception
{
if (authenticationSettings.getSignUp())
{
if (!registerRequest.getPassword().equals(registerRequest.getConfirmPassword()))
{
throw new BindException(RegisterRequest.class, "password does not match confirm password");
}
if (!captchaService.validateCaptcha(captchaRequest.getCaptcha()))
{
throw new CaptchaException("invalid captcha answer");
}
User user = toUser(registerRequest);
String activationUri = null;
if (StringUtils.isEmpty(request.getHeader("X-Forwarded-Host")))
{
activationUri = ServletUriComponentsBuilder.fromCurrentRequest()
.replacePath(URI + "/activate")
.build()
.toUriString();
}
else
{
String scheme = request.getHeader("X-Forwarded-Proto");
if (scheme == null) scheme = request.getScheme();
activationUri = scheme + "://" + request.getHeader("X-Forwarded-Host") + URI + "/activate";
}
accountService.createUser(user, activationUri);
String successMessage = authenticationSettings.getSignUpModeration() ? REGISTRATION_SUCCESS_MESSAGE_ADMIN : REGISTRATION_SUCCESS_MESSAGE_USER;
captchaService.removeCaptcha();
return Collections.singletonMap("message", successMessage);
}
else
{
throw new NoPermissionException("Self registration is disabled");
}
}
示例9: newNamingException
import javax.naming.NoPermissionException; //导入依赖的package包/类
/**
* Prepares a new {@link NamingException} wrapping the specified
* {@link RemoteException} source exception. Source exception becomes a
* {@linkplain NamingException#getCause() cause} of the generated exception.
*
* The particular subclass of {@link NamingException} returned depends
* on the particular subclass of source {@link RemoteException}.
*
* If source exception is not of a specific class or is not
* a {@link RemoteException} or is <code>null</code>,
* then plain {@link NamingException} is returned.
*
* Note: {@link Throwable#fillInStackTrace()} should be called before
* throwing the generated exception, to provide the proper
* (not including this method) stack trace for the exception.
*
* Example of use:
*
* <code>try {
* ...
* } catch (RemoteException e) {
* throw (NamingException) newNamingException(e).fillInStackTrace();
* }</code>
*
* @param e
* Source {@link RemoteException}.
*
* @return Generated {@link NamingException} exception.
*/
@SuppressWarnings("deprecation") //$NON-NLS-1$
protected NamingException newNamingException(Throwable e) {
NamingException ret =
(e instanceof AccessException)
? new NoPermissionException()
: (e instanceof ConnectException)
? new ServiceUnavailableException()
: (e instanceof ConnectIOException)
|| (e instanceof ExportException)
|| (e instanceof MarshalException)
|| (e instanceof UnmarshalException)
? new CommunicationException()
: (e instanceof ActivateFailedException)
|| (e instanceof NoSuchObjectException)
|| (e instanceof java.rmi.server.SkeletonMismatchException)
|| (e instanceof java.rmi.server.SkeletonNotFoundException)
|| (e instanceof StubNotFoundException)
|| (e instanceof UnknownHostException)
? new ConfigurationException()
: (e instanceof ServerException)
? newNamingException(e.getCause())
: new NamingException();
if (ret.getCause() == null) {
ret.initCause(e);
}
return ret;
}
示例10: checkIsDestroyed
import javax.naming.NoPermissionException; //导入依赖的package包/类
/**
* Checks if this context has been destroyed. isDestroyed is set to true when
* a context is destroyed by calling destroySubcontext method.
*
* @throws NoPermissionException if this context has been destroyed
*/
private void checkIsDestroyed() throws NamingException {
if (isDestroyed) { throw new NoPermissionException(LocalizedStrings.ContextImpl_CAN_NOT_INVOKE_OPERATIONS_ON_DESTROYED_CONTEXT.toLocalizedString()); }
}