[jboss-cvs] JBossAS SVN: r71698 - projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 3 12:08:55 EDT 2008
Author: anil.saldhana at jboss.com
Date: 2008-04-03 12:08:55 -0400 (Thu, 03 Apr 2008)
New Revision: 71698
Added:
projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util/JBossXACMLUtil.java
Log:
util method
Added: projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util/JBossXACMLUtil.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util/JBossXACMLUtil.java (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml/src/main/java/org/jboss/security/xacml/util/JBossXACMLUtil.java 2008-04-03 16:08:55 UTC (rev 71698)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.security.xacml.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import org.jboss.security.xacml.factories.RequestResponseContextFactory;
+import org.jboss.security.xacml.interfaces.ResponseContext;
+import org.jboss.security.xacml.sunxacml.ctx.ResponseCtx;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * Utility methods for JBossXACML
+ * @author Anil.Saldhana at redhat.com
+ * @since Apr 3, 2008
+ * @version $Revision$
+ */
+public class JBossXACMLUtil
+{
+ public static Element getResponseContextElement(ResponseContext response) throws Exception
+ {
+ Node node = response.getDocumentElement();
+ if(node instanceof Element)
+ return (Element) node;
+
+ Element element = null;
+ if(element == null)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ response.marshall(baos);
+
+ byte[] resp = baos.toByteArray();
+ System.out.println("RESPONSE:"+new String(resp));
+ ByteArrayInputStream bis = new ByteArrayInputStream(resp);
+
+ ResponseContext newRC = RequestResponseContextFactory.createResponseContext();
+ newRC.readResponse(bis);
+ element = (Element) newRC.getDocumentElement();
+ }
+ return element;
+ }
+
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list