taylor 02/04/09 15:14:00
Modified: src/java/org/apache/jetspeed/capability
BaseCapabilityMap.java CapabilityMapFactory.java
ClientCapabilityMap.java
src/java/org/apache/jetspeed/portal/portlets
NewRSSPortlet.java
src/java/org/apache/jetspeed/services/profiler
JetspeedProfilerService.java
Log:
- added XML mediatype support
Revision Changes Path
1.5 +6 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/capability/BaseCapabilityMap.java
Index: BaseCapabilityMap.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/capability/BaseCapabilityMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BaseCapabilityMap.java 24 Sep 2001 09:39:48 -0000 1.4
+++ BaseCapabilityMap.java 9 Apr 2002 22:13:59 -0000 1.5
@@ -66,7 +66,7 @@
/**
@author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
-@version $Id: BaseCapabilityMap.java,v 1.4 2001/09/24 09:39:48 sgala Exp $
+@version $Id: BaseCapabilityMap.java,v 1.5 2002/04/09 22:13:59 taylor Exp $
*/
public abstract class BaseCapabilityMap implements CapabilityMap {
@@ -130,12 +130,17 @@
*/
public void setMimeTypes( MimeType[] mimeTypes ) {
this.mimeTypes = mimeTypes;
+ if (this.mimeTypes.length > 0)
+ {
+ this.mimeType= this.mimeTypes[0];
+ }
}
/**
@see CapabilityMap#setMimeTypes
*/
public void setMimeTypes( MimeType mimeType ) {
+ this.mimeType= mimeType;
this.mimeTypes = new MimeType[1];
this.mimeTypes[0] = mimeType;
}
1.9 +5 -8
jakarta-jetspeed/src/java/org/apache/jetspeed/capability/CapabilityMapFactory.java
Index: CapabilityMapFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/capability/CapabilityMapFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- CapabilityMapFactory.java 3 Jan 2002 19:00:46 -0000 1.8
+++ CapabilityMapFactory.java 9 Apr 2002 22:13:59 -0000 1.9
@@ -54,9 +54,8 @@
package org.apache.jetspeed.capability;
-import org.apache.jetspeed.util.*;
-import org.apache.turbine.util.*;
-import java.util.*;
+import org.apache.turbine.util.RunData;
+import java.util.Hashtable;
/**
This class describes various browsers capabilities and provides the
@@ -66,11 +65,12 @@
handle more browsers.
@author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
-@version $Id: CapabilityMapFactory.java,v 1.8 2002/01/03 19:00:46 sgala Exp $
+@version $Id: CapabilityMapFactory.java,v 1.9 2002/04/09 22:13:59 taylor Exp $
*/
public class CapabilityMapFactory {
- private static final String DEFAULT_AGENT = "Mozilla/4.0";
+ public static final String DEFAULT_AGENT = "Mozilla/4.0";
+ public static final String AGENT_XML = "agentxml/1.0";
private static Hashtable agents = new Hashtable();
@@ -114,9 +114,6 @@
if ( cm == null ) {
String userAgent = rundata.getUserAgent();
-
- Log.info( "Created a CapabilityMap for agent: " + userAgent );
-
cm = getCapabilityMap( userAgent );
1.11 +23 -20
jakarta-jetspeed/src/java/org/apache/jetspeed/capability/ClientCapabilityMap.java
Index: ClientCapabilityMap.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/capability/ClientCapabilityMap.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ClientCapabilityMap.java 13 Mar 2002 07:34:07 -0000 1.10
+++ ClientCapabilityMap.java 9 Apr 2002 22:13:59 -0000 1.11
@@ -66,7 +66,7 @@
handle more browsers.
@author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
-@version $Id: ClientCapabilityMap.java,v 1.10 2002/03/13 07:34:07 taylor Exp $
+@version $Id: ClientCapabilityMap.java,v 1.11 2002/04/09 22:13:59 taylor Exp $
*/
public class ClientCapabilityMap extends BaseCapabilityMap implements CapabilityMap
{
@@ -204,58 +204,61 @@
case 2:
}
}
-
- //go through each WAP device
- determineWAP();
-
- //go through VoiceXML devices
- determineVoice();
-
+ else if (browser.equals("agentxml"))
+ {
+ setPreferredType(MimeType.XML);
+ setCapability(HTML_XML);
+ setMimeTypes(MimeType.XML);
+ }
+ else
+ {
+ //go through each WAP device
+ if (!determineWAP())
+ determineVoice();
+ }
}
/**
Go through the given array fo strings and if this matches set WML MimeTypes
correctly.
*/
- private void determineWAP() {
+ private boolean determineWAP() {
- for( int i = 0; i < WAP_DEVICES_STARTS.length; ++i ) {
+ for (int i = 0; i < WAP_DEVICES_STARTS.length; ++i ) {
if ( this.getAgent().startsWith( WAP_DEVICES_STARTS[i] ) ) {
this.setPreferredType( MimeType.WML );
this.setMimeTypes( MimeType.WML );
- break;
+ return true;
}
}
- for( int i = 0; i < WAP_DEVICES_CONTAINS.length; ++i ) {
+ for (int i = 0; i < WAP_DEVICES_CONTAINS.length; ++i ) {
if ( this.getAgent().indexOf( WAP_DEVICES_CONTAINS[i] ) != -1 ) {
this.setPreferredType( MimeType.WML );
this.setMimeTypes( MimeType.WML );
- break;
+ return true;
}
}
-
-
+ return false;
}
/**
Go through the given array fo strings and if this matches set WML MimeTypes
correctly.
*/
- private void determineVoice() {
+ private boolean determineVoice() {
- for( int i = 0; i < VOICE_DEVICES_CONTAINS.length; ++i ) {
+ for (int i = 0; i < VOICE_DEVICES_CONTAINS.length; ++i ) {
if ( this.getAgent().indexOf( VOICE_DEVICES_CONTAINS[i] ) != -1 ) {
this.setPreferredType( MimeType.VXML );
this.setMimeTypes( MimeType.VXML );
- break;
+ return true;
}
}
-
-
+ return false;
}
}
1.15 +14 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/NewRSSPortlet.java
Index: NewRSSPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/NewRSSPortlet.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- NewRSSPortlet.java 28 Jan 2002 11:25:50 -0000 1.14
+++ NewRSSPortlet.java 9 Apr 2002 22:13:59 -0000 1.15
@@ -98,7 +98,7 @@
is only used for this mime-type</dd>
</dl>
@author <A HREF="mailto:[EMAIL PROTECTED]">Rapha�l Luta</A>
-@version $Id: NewRSSPortlet.java,v 1.14 2002/01/28 11:25:50 sgala Exp $
+@version $Id: NewRSSPortlet.java,v 1.15 2002/04/09 22:13:59 taylor Exp $
*/
public class NewRSSPortlet extends FileWatchPortlet {
@@ -108,9 +108,10 @@
private Document document = null;
private Hashtable stylesheets = null;
private Hashtable params = null;
+
/**
- This method loads the init parameters and
- parse the document tied to this portlet
+ This method loads the init parameters and
+ parse the document tied to this portlet
*/
public void init( ) throws PortletException {
@@ -150,7 +151,9 @@
url = getPortletConfig().getURL();
String content = JetspeedDiskCache.getInstance().getEntry( url
).getData();
-
+ CapabilityMap xmap =
+
CapabilityMapFactory.getCapabilityMap(CapabilityMapFactory.AGENT_XML);
+ setContent( new ClearElement(content), xmap );
InputSource isrc = new InputSource( this.cleanse( content ) );
isrc.setSystemId( url );
isrc.setEncoding("UTF-8");
@@ -226,6 +229,13 @@
Log.error( e );
content = new ClearElement(e.getMessage());
}
+ }
+ }
+ else
+ {
+ if (map.getPreferredType().equals(MimeType.XML))
+ {
+ return getContent( data, map );
}
}
1.25 +16 -11
jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java
Index: JetspeedProfilerService.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- JetspeedProfilerService.java 4 Apr 2002 18:39:50 -0000 1.24
+++ JetspeedProfilerService.java 9 Apr 2002 22:14:00 -0000 1.25
@@ -133,7 +133,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Santiago Gala</a>
- * @version $Id: JetspeedProfilerService.java,v 1.24 2002/04/04 18:39:50 taylor Exp
$
+ * @version $Id: JetspeedProfilerService.java,v 1.25 2002/04/09 22:14:00 taylor Exp
$
*/
public class JetspeedProfilerService extends TurbineBaseService
@@ -281,18 +281,21 @@
try
{
AccessControlList acl = rundata.getACL();
- RoleSet roles =
acl.getRoles(JetspeedSecurity.getGroup(JetspeedSecurity.JETSPEED_GROUP));
- if (roles != null)
+ if (acl != null)
{
- Iterator it = roles.elements();
- while (it.hasNext())
+ RoleSet roles =
acl.getRoles(JetspeedSecurity.getGroup(JetspeedSecurity.JETSPEED_GROUP));
+ if (roles != null)
{
- // note: this is an unordered list. will need to change
db schema to order it
- Role role = (Role)it.next();
- rundata.getParameters().setString( Profiler.PARAM_ROLE,
role.getName() );
- profile = fallbackProfile(rundata, cm);
- if (profile != null)
- break;
+ Iterator it = roles.elements();
+ while (it.hasNext())
+ {
+ // note: this is an unordered list. will need to
change db schema to order it
+ Role role = (Role)it.next();
+ rundata.getParameters().setString(
Profiler.PARAM_ROLE, role.getName() );
+ profile = fallbackProfile(rundata, cm);
+ if (profile != null)
+ break;
+ }
}
}
}
@@ -666,7 +669,9 @@
key = "text/vnd.wap.wml";
MediaTypeEntry mte = (MediaTypeEntry) mediaMap.get(key);
if (null != mte)
+ {
return mte.getName();
+ }
}
return "";
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>