本文整理汇总了Java中javax.portlet.PortletSecurityException类的典型用法代码示例。如果您正苦于以下问题:Java PortletSecurityException类的具体用法?Java PortletSecurityException怎么用?Java PortletSecurityException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PortletSecurityException类属于javax.portlet包,在下文中一共展示了PortletSecurityException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: portletModeMappingViewRenderRequestWithUnauthorizedUserRole
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Test
public void portletModeMappingViewRenderRequestWithUnauthorizedUserRole() throws Exception {
MockRenderRequest request = new MockRenderRequest();
MockRenderResponse response = new MockRenderResponse();
request.setPortletMode(PortletMode.VIEW);
request.addUserRole("role3");
request.setParameter("action", "not mapped");
request.setParameter("myParam", "not mapped");
complexDispatcherPortlet.doDispatch(request, response);
Map<?, ?> model = (Map<?, ?>) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
Exception exception = (Exception) model.get("exception");
assertNotNull(exception);
assertTrue(exception.getClass().equals(PortletSecurityException.class));
InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
assertEquals("failed-default-1", view.getBeanName());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:DispatcherPortletTests.java
示例2: testUnauthorizedUser
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
public void testUnauthorizedUser() throws Exception {
UserRoleAuthorizationInterceptor interceptor = new UserRoleAuthorizationInterceptor();
String validRole = "allowed";
interceptor.setAuthorizedRoles(new String[] {validRole});
MockRenderRequest request = new MockRenderRequest();
MockRenderResponse response = new MockRenderResponse();
Object handler = new Object();
request.addUserRole("someOtherRole");
assertFalse(request.isUserInRole(validRole));
try {
interceptor.preHandle(request, response, handler);
fail("should have thrown PortletSecurityException");
}
catch (PortletSecurityException ex) {
// expected
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:18,代码来源:UserRoleAuthorizationInterceptorTests.java
示例3: testRequestWithNoUserRoles
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
public void testRequestWithNoUserRoles() throws Exception {
UserRoleAuthorizationInterceptor interceptor = new UserRoleAuthorizationInterceptor();
String validRole = "allowed";
interceptor.setAuthorizedRoles(new String[] {validRole});
MockRenderRequest request = new MockRenderRequest();
MockRenderResponse response = new MockRenderResponse();
Object handler = new Object();
assertFalse(request.isUserInRole(validRole));
try {
interceptor.preHandle(request, response, handler);
fail("should have thrown PortletSecurityException");
}
catch (PortletSecurityException ex) {
// expected
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:17,代码来源:UserRoleAuthorizationInterceptorTests.java
示例4: unauthorizedUser
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Test(expected = PortletSecurityException.class)
public void unauthorizedUser() throws Exception {
String validRole = "allowed";
interceptor.setAuthorizedRoles(new String[] {validRole});
request.addUserRole("someOtherRole");
assertFalse(request.isUserInRole(validRole));
interceptor.preHandle(request, response, new Object());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:UserRoleAuthorizationInterceptorTests.java
示例5: requestWithNoUserRoles
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Test(expected = PortletSecurityException.class)
public void requestWithNoUserRoles() throws Exception {
String validRole = "allowed";
interceptor.setAuthorizedRoles(new String[] {validRole});
assertFalse(request.isUserInRole(validRole));
interceptor.preHandle(request, response, new Object());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:UserRoleAuthorizationInterceptorTests.java
示例6: portletModeMappingEditActionRequestWithUnauthorizedUserRole
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Test
public void portletModeMappingEditActionRequestWithUnauthorizedUserRole() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
request.addUserRole("role3");
request.setParameter("action", "not mapped");
request.setParameter("myParam", "not mapped");
complexDispatcherPortlet.processAction(request, response);
String exception = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
assertNotNull(exception);
String name = PortletSecurityException.class.getName();
assertTrue(exception.startsWith(name));
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:15,代码来源:DispatcherPortletTests.java
示例7: processAction
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Override
public void processAction(ActionRequest req, ActionResponse res) throws PortletException, PortletSecurityException, IOException
{
Application.setInPortalServer(true);
try
{
super.processAction(req, res);
}
finally
{
Application.setInPortalServer(false);
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:14,代码来源:WebScriptRepoPortlet.java
示例8: render
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Override
public void render(RenderRequest req, RenderResponse res) throws PortletException, PortletSecurityException, IOException
{
Application.setInPortalServer(true);
try
{
super.render(req, res);
}
finally
{
Application.setInPortalServer(false);
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:14,代码来源:WebScriptRepoPortlet.java
示例9: testInterceptorWithNoAuthorizedRoles
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
public void testInterceptorWithNoAuthorizedRoles() throws Exception {
UserRoleAuthorizationInterceptor interceptor = new UserRoleAuthorizationInterceptor();
MockRenderRequest request = new MockRenderRequest();
MockRenderResponse response = new MockRenderResponse();
Object handler = new Object();
request.addUserRole("someRole");
try {
interceptor.preHandle(request, response, handler);
fail("should have thrown PortletSecurityException");
}
catch (PortletSecurityException ex) {
// expected
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:15,代码来源:UserRoleAuthorizationInterceptorTests.java
示例10: testPortletModeMappingEditActionRequestWithUnauthorizedUserRole
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
public void testPortletModeMappingEditActionRequestWithUnauthorizedUserRole() throws Exception {
MockActionRequest request = new MockActionRequest();
MockActionResponse response = new MockActionResponse();
request.setPortletMode(PortletMode.EDIT);
request.addUserRole("role3");
request.setParameter("action", "not mapped");
request.setParameter("myParam", "not mapped");
complexDispatcherPortlet.processAction(request, response);
String exception = response.getRenderParameter(DispatcherPortlet.ACTION_EXCEPTION_RENDER_PARAMETER);
assertNotNull(exception);
String name = PortletSecurityException.class.getName();
assertTrue(exception.startsWith(name));
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:14,代码来源:DispatcherPortletTests.java
示例11: testPortletModeMappingViewRenderRequestWithUnauthorizedUserRole
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
public void testPortletModeMappingViewRenderRequestWithUnauthorizedUserRole() throws Exception {
MockRenderRequest request = new MockRenderRequest();
MockRenderResponse response = new MockRenderResponse();
request.setPortletMode(PortletMode.VIEW);
request.addUserRole("role3");
request.setParameter("action", "not mapped");
request.setParameter("myParam", "not mapped");
complexDispatcherPortlet.doDispatch(request, response);
Map model = (Map) request.getAttribute(ViewRendererServlet.MODEL_ATTRIBUTE);
Exception exception = (Exception) model.get("exception");
assertNotNull(exception);
assertTrue(exception.getClass().equals(PortletSecurityException.class));
InternalResourceView view = (InternalResourceView) request.getAttribute(ViewRendererServlet.VIEW_ATTRIBUTE);
assertEquals("failed-default-1", view.getBeanName());
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:16,代码来源:DispatcherPortletTests.java
示例12: handleSecureFlag
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
/**
* Sets the secure flag on the URl as required
*
* @throws JspException
*/
protected void handleSecureFlag() throws JspException {
BaseURL url = getUrl();
if (secure != null && !secure.equalsIgnoreCase("true") && !secure.equalsIgnoreCase("false")) {
StringBuilder txt = new StringBuilder(128);
txt.append("Invalid secure option: ").append(secure);
txt.append(", valid options: true, false");
throw new JspException(txt.toString());
}
if(url == null){
throw new IllegalStateException("internal error: url not set");
}
if (var != null) {
pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
}
if (secure != null) {
try {
url.setSecure(isSecure());
} catch (PortletSecurityException e) {
// ignore exception as Pluto doesn't support setSecure
// throw new JspException(e);
}
}
}
开发者ID:apache,项目名称:portals-pluto,代码行数:34,代码来源:BaseURLTag.java
示例13: interceptorWithNoAuthorizedRoles
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Test(expected = PortletSecurityException.class)
public void interceptorWithNoAuthorizedRoles() throws Exception {
request.addUserRole("someRole");
interceptor.preHandle(request, response, new Object());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:UserRoleAuthorizationInterceptorTests.java
示例14: setSecure
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Override
public void setSecure(boolean secure) throws PortletSecurityException {
this.secure = secure;
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:MockBaseURL.java
示例15: setSecure
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
public void setSecure(boolean secure) throws PortletSecurityException {
this.secure = secure;
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:4,代码来源:MockBaseURL.java
示例16: setSecure
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
@Override
public void setSecure(boolean secure) throws PortletSecurityException {
((BaseURL)wrapped).setSecure(secure);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:5,代码来源:BaseURLWrapper.java
示例17: setSecure
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
public void setSecure(boolean secure) throws PortletSecurityException {
urlProvider.setSecure(secure);
}
开发者ID:apache,项目名称:portals-pluto,代码行数:4,代码来源:BaseURLImpl.java
示例18: setSecure
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
public void setSecure(boolean secure) throws PortletSecurityException {
throw new PortletSecurityException("setSecure is not supported.");
}
开发者ID:apache,项目名称:portals-pluto,代码行数:4,代码来源:PortletURLProviderImpl.java
示例19: handleNotAuthorized
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
/**
* Handle a request that is not authorized according to this interceptor.
* Default implementation throws a new PortletSecurityException.
* <p>This method can be overridden to write a custom message, forward or
* redirect to some error page or login page, or throw a PortletException.
* @param request current portlet request
* @param response current portlet response
* @param handler chosen handler to execute, for type and/or instance evaluation
* @throws javax.portlet.PortletException if there is an internal error
* @throws java.io.IOException in case of an I/O error when writing the response
*/
protected void handleNotAuthorized(PortletRequest request, PortletResponse response, Object handler)
throws PortletException, IOException {
throw new PortletSecurityException("Request not authorized");
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:UserRoleAuthorizationInterceptor.java
示例20: setSecure
import javax.portlet.PortletSecurityException; //导入依赖的package包/类
void setSecure(boolean secure) throws PortletSecurityException;
开发者ID:apache,项目名称:portals-pluto,代码行数:2,代码来源:PortletURLProvider.java
注:本文中的javax.portlet.PortletSecurityException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论