In a project I face up to an intensive import of content into a Websphere Portal. I do not like very much iframe's option cause of elegance, accesibility, etc, issues.
I thought I could use JSTL tags like <c:import> by a simple portlet to run jsp code. Although I have no problems when I import local files, external urls seem to be a problem for the start of service() method.
Ideas? Experiences?
thanks in advances
iñigo
Ryan
SCJP & SCWCD
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
I attach SystemOut if you want to have a look at. It's a WSP's spanish installation, so log contains some spanish terms. Sorry. :-)
I run jsp code using the BlurbPortlet to deploy it. And in order to work with JSTL jakarta-taglibs are installed and tlds and lib configured.
Code is quite simple:
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page session="false" %>
<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portletAPI" %>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="cAPI" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<body>
<c:import url="http://www.ibm.com/" />
</body>
</html>
If such a code is pointing to a local file insted of an external url, configuration in portlet is fine and content is displayed. But when it's pointing to an external url, no content is embeded and page stays blank. And a tail -f on the server spit the log attached.
Any idea will be very welcome, Ryan.
iñigo
Looking at the logs I see
http:://www.ibm.com/
Also if the code is in a portlet you should not have the HTML and body tags.
<%@page session="false" contentType="text/html" pageEncoding="ISO-8859-1" import="java.util.*,javax.portlet.*,importtest.*" %>
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<portlet:defineObjects/>
<DIV style="margin: 6px">
<c:import url="http://www.ibm.com/" />
</DIV>
In the logs I see the following
[10/22/07 10:25:39:625 EDT] 0000007e ServletWrappe E SRVE0014E: Uncaught service() exception root cause /_ImportTest/jsp/html/ImportTestPortletView.jsp: javax.servlet.jsp.JspTagException: 302 http://www.ibm.com/
at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireReader(Unknown Source)
at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(Unknown Source)
at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(Unknown Source)
According to the JSTL spec if anything other then 200 is returned an exception will be thrown.
For external resources
If the URLConnection class throws an IOException or a
RuntimeException, throw a JspException with the message from the
original exception included in the message and the original exception as the
root cause.
For an HttpURLConnection, if the response status code is other than 2xx (i.e.
200-299, the range of success codes in the HTTP response codes), throw a
JspException with the path and status code in the message.
However later the spec does state that when importing an external resource using the HTTP protocol, <c:import> behaves according to the semantics of a GET request sent via the java.net.HttpURLConnection class, with setFollowRedirects set to true.
So according to the above I would have expected it to follow the redirect. I will need to look into this further.
Would it be possible for you to open a PMR and place my name in it?
We have moved our static files in the theme to webserver and disabled fileServing in theme. Now we are not able to load the default.properties file.I've attached the exception that we are getting. It is at this line
in styles_rules.jspf file where we are getting the exception. Could you please help?