我为用户提供了带有访问密钥的特殊URL.与简单的匿名用户相比,通过此特殊网址访问公共页面的用户应该能够看到一些额外的数据.
我想基于请求中提供的参数给匿名用户一些额外的角色,所以我可以在我的模板中做这样的事情:
<@sec.authorize ifAnyGranted="ROLE_ADMIN, ROLE_USER, ROLE_INVITED_VISITOR">
...some additional stuff for invited user to see
</@sec.authorize>
Run Code Online (Sandbox Code Playgroud)
目前我正在实施Spring的OncePerRequestfilter:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
if (null != request.getParameter("accessKey")) {
if(isValid(request.getParameter("accessKey"))) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
//how do i add additional roles to authenticated (potentially anonymous) user?
}
}
}
Run Code Online (Sandbox Code Playgroud) 我在线性布局中添加了触摸事件以响应滑动手势,并且效果很好.但是,当我向布局添加按钮时,将忽略父线框布局.我应该如何防止这种情况发生?
LinearLayout ln2 = (LinearLayout) findViewById(R.id.fr2);
ln2.setOnTouchListener(swipe);
Run Code Online (Sandbox Code Playgroud)
我该怎么用onInterceptTouch?
button touch-event android-linearlayout swipe-gesture findviewbyid
在此处提供的代码示例中,为JSON JAXB编组导入以下内容:
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
<!-- Jackson -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-lgpl</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-lgpl</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.3.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
其中'jackson-xc提供额外的Jaxb支持'.
在Spring中使用JAXB JSON marhsalling时,两组maven依赖项之间有什么区别?应该优选使用哪一个?
在我的页面中有一些commandButton打开对话框.表有300行,关闭HTML对话框后不会破坏并保留在HTML页面中.我想隐藏后在对话框中销毁数据.然后单击commandButton重复操作加载对话框并在对话框中加载数据.我发现了这种方法
<p:ajax event="close" update="growl" listener="#{dialogBean.handleClose}"/>
Run Code Online (Sandbox Code Playgroud)
但不知道如何从facescontext中销毁对话框.
目前我正在使用tomcat 6和spring-security 3.0.3.RELEASE而没有apache.
我可以强制https登录页面,它工作得很好.
下一个配置用于防止通过http访问某些页面.
<http use-expressions="true">
<intercept-url pattern="/" access="permitAll" />
<intercept-url pattern="/login" access="permitAll" requires-channel="https" />
<intercept-url pattern="/spring_security_login" access="permitAll" requires-channel="https" />
<intercept-url pattern="/users/new" access="permitAll" requires-channel="https" />
<intercept-url pattern="/users/authorize/*" access="isAuthenticated()" />
<!--<form-login /> -->
<form-login login-page="/login" />
<logout />
<remember-me />
<!--
Uncomment to enable X509 client authentication support <x509 />
-->
<!-- Uncomment to limit the number of sessions a user can have -->
<session-management>
<concurrency-control max-sessions="10000"
error-if-maximum-exceeded="true" />
</session-management>
</http>
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试通过非https链接访问/ buyer/new,
http://localhost:8085/path/buyers/new我会收到下一个错误:
The page isn't …Run Code Online (Sandbox Code Playgroud) 我有3个bean:组织,角色,用户
角色 - 组织关系 - @ManyToOne
角色 - 用户关系 - @ManyToMany
组织:
@Entity
@Table(name = "entity_organization")
public class Organization implements Serializable {
private static final long serialVersionUID = -646783073824774092L;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
Long id;
String name;
@OneToMany(targetEntity = Role.class, mappedBy = "organization")
List<Role> roleList;
...
Run Code Online (Sandbox Code Playgroud)
作用:
@Entity
@Table(name = "entity_role")
public class Role implements Serializable {
private static final long serialVersionUID = -8468851370626652688L;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
Long id;
String name;
String description;
@ManyToOne
Organization organization;
...
Run Code Online (Sandbox Code Playgroud)
用户:
@Entity …Run Code Online (Sandbox Code Playgroud) 我最近尝试使用中继方服务公钥加密Saml2断言.不幸的是,我甚至无法完成测试阶段
这是我的代码
public class EncryptionTest {
public static void main(String args[]){
try {
// The Assertion to be encrypted
FileInputStream fis;
DataInputStream in, in2;
File f = new File("src/main/resources/AssertionTest");
byte[] buffer = new byte[(int) f.length()];
in = new DataInputStream(new FileInputStream(f));
in.readFully(buffer);
in.close();
//Assertion = DataInputStream.readUTF(in);
String in_assert = new String(buffer);
System.out.println(in_assert);
org.apache.axiom.om.OMElement OMElementAssertion = org.apache.axiom.om.util.AXIOMUtil.stringToOM(in_assert);
Assertion assertion = convertOMElementToAssertion2(OMElementAssertion);
// Assume this contains a recipient's RSA public key
Credential keyEncryptionCredential;
keyEncryptionCredential = getCredentialFromFilePath("src/main/resources/cert.pem");
EncryptionParameters encParams = new EncryptionParameters();
encParams.setAlgorithm(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
KeyEncryptionParameters …Run Code Online (Sandbox Code Playgroud) encryption public-key-encryption assertion opensaml saml-2.0
我正在创建带有Primefaces的JSF应用程序。基本上我有这种看法。有一个选项卡视图,其中每个选项卡都包含一个命令按钮和一个手风琴面板(另一种选项卡视图)。在其他元素中,手风琴面板的选项卡包含每个命令按钮。我的问题是,第一个命令按钮(在1级选项卡下)在单击时正确调用了操作方法,而第二个按钮(在2级选项卡下)未正确调用。我应该说tabView和AccordionPanel都正常工作,因为它们正在显示应显示的信息。
我正在发布视图的简化版本,以便您可以看到正在发生的事情。
<h:form>
<p:tabView id="unitTabs" orientation="left" dynamic="true" cache="false" var="unit" value="#{unitController.getUnitsOfLoggedInUser(loginController.checkedUser)}">
<p:tab id="unitTab" title="#{unit.unitName}">
<p:commandButton value="Add Lecture" action="#{unitController.setTemporary(unit)}" onclick="createLectureDialog.show()">
<p:accordionPanel id="lectureTabs" value ="#{lectureController.getLecturesForUnit(unit)}" var="lecture" dynamic="true" cache="false">
<p:tab title="#{lecture.lectureName}">
<p:commandButton value="Add Criterion" action ="#{lectureController.setTemporary(lecture)}" onclick="createCriterionDialog.show()" >
</p:tab>
</p:accordionPanel>
</p:tab>
</p:tabView>
</h:form>
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?谢谢
我正在尝试为我的portlet创建一个搜索表单.portlet是一个地址簿应用程序,所有dao和服务构建器都使用服务构建器构建.我想给用户一个基本/高级搜索表单(就像liferay上的其他表格一样,例如控制中心的"用户和组织").
我已经实现了查看liferay源代码(6.1 GA1)的所有逻辑和页面,但搜索表单没有以任何方式显示,我将把代码放在这里.
在view.jsp中:
<%
PortletURL portletURL = renderResponse.createRenderURL();
portletURL.setParameter("jspPage", "/html/addressbookportlet/view.jsp");
pageContext.setAttribute("portletURL", portletURL);
String portletURLString = portletURL.toString();
%>
<aui:form action="<%= portletURLString %>" method="get" name="fm">
<liferay-portlet:renderURLParams varImpl="portletURL" />
<aui:input name="isSearch" type="hidden" value="true" />
<aui:input name="redirect" type="hidden" value="<%= portletURLString %>" />
<liferay-ui:search-container
searchContainer="<%= new ABContactSearch(renderRequest, portletURL) %>"
>
<%
ABContactDisplayTerms displayTerms = (ABContactDisplayTerms)searchContainer.getDisplayTerms();
ABContactSearchTerms searchTerms = (ABContactSearchTerms)searchContainer.getSearchTerms();
Long societyId = GetterUtil.getLong(searchTerms.getSocietyId(),0);
Long contactTypeId = GetterUtil.getLong(searchTerms.getContactTypeId(), 0);
Long brandId = GetterUtil.getLong(searchTerms.getBrandId(),0);
Long channelId = GetterUtil.getLong(searchTerms.getChannelId(),0);
%>
<liferay-ui:search-form
searchContainer="<%=searchContainer%>"
servletContext="<%= this.getServletConfig().getServletContext() %>"
showAddButton="true"
page='<%= …Run Code Online (Sandbox Code Playgroud) 这个帖子不是问题,当我通过Liferay论坛关于使用PortletURL时,这是一个疑问.
在某些情况下,我在javscript方法中看到了这个PortletURL
function createRowURL() {
var portletURL = new Liferay.PortletURL();
portletURL.setParameter("rowNumber", "25" );
return portletURL.toString();
}
Run Code Online (Sandbox Code Playgroud)
在某些情况下,我在doViewMethod中看到了这个PortletURL ,如图所示
要获得currentURL:
PortletURL url = PortletURLUtil.getCurrent(renderRequest, mimeResponse or renderResponse)
Run Code Online (Sandbox Code Playgroud)
从renderResponse创建PortletURL:
对于RenderURL:
PortletURL renderURL = renderResponse.createRenderURL();
Run Code Online (Sandbox Code Playgroud)对于actionURL:
PortletURL actionURL = renderResponse.createActionURL();
Run Code Online (Sandbox Code Playgroud)有人可以告诉我在哪种情况下PortletURL会有用吗?
jsf ×2
liferay ×2
primefaces ×2
anonymous ×1
assertion ×1
button ×1
encryption ×1
findviewbyid ×1
hibernate ×1
java ×1
java-ee ×1
jaxb ×1
join ×1
json ×1
managed-bean ×1
marshalling ×1
mysql ×1
named-query ×1
opensaml ×1
roles ×1
saml-2.0 ×1
search-form ×1
spring ×1
sql ×1
tomcat ×1
touch-event ×1