Thursday, March 1, 2007

Web traffic for the WSRP4J demo

pencil icon, that"s clickable to start editing the post
Work in slow progress Following the README with the WSRP4J dist I succeded in getting the demo running and heres a dump of the web traffic it generates as captured with the tcpmon tool. The traffic is between the wsrp4j proxy portlet and the wsrp4j-producer (forwarding the jsr168 testportlet that comes with wsrp4j). The portlet page that these (identical) portlets end up in looks like.

What do you have to offer

The first thing the proxyportlet does it to query the wsrp4j-producer about what portlets are available (done with axis 1.4 which the wsrp4j proxyportlet uses):
POST /wsrp4j-producer/services/WSRPServiceDescriptionService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:getServiceDescription"
Content-Length: 386

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getServiceDescription xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationContext xsi:nil="true" />
    </getServiceDescription>
  </soapenv:Body>
</soapenv:Envelope>

and the answer is
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getServiceDescriptionResponse
      xsi:type="ns1:ServiceDescription"
      xmlns="urn:oasis:names:tc:wsrp:v1:types"
      xmlns:ns1="urn:oasis:names:tc:wsrp:v1:types">
      <ns1:requiresRegistration xsi:type="xsd:boolean">true</ns1:requiresRegistration>
      <ns1:requiresInitCookie xsi:type="ns1:CookieProtocol">perGroup</ns1:requiresInitCookie>
    </getServiceDescriptionResponse>
  </soapenv:Body>
</soapenv:Envelope>


which is kind of an no-answer since it just indicates the it requires registration prior to any thing (requiresRegistration), and that it requires that cookies are initialized per group (requiresInitCookie) more about that later.

All right I'll register
Since it requires registration there's only one thing to do:
POST /wsrp4j-producer/services/WSRPRegistrationService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:register"
Content-Length: 469

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <register xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <consumerName>WSRP4J Proxy Portlet</consumerName>
      <consumerAgent>WSRP4J Proxy Portlet</consumerAgent>
      <methodGetSupported>false</methodGetSupported>
    </register>
  </soapenv:Body>
</soapenv:Envelope>
and the producer accepts with:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <registerResponse xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationHandle>0:0:0:0:0:0:0:1_1173173104036_0</registrationHandle>
    </registerResponse>
  </soapenv:Body>
</soapenv:Envelope>
so the registrationHandle is 0:0:0:0:0:0:0:1_1173173104036_0.

Okay now show me what you offer After having registred it's now possible to actually get the serviceDescription:
POST /wsrp4j-producer/services/WSRPServiceDescriptionService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:getServiceDescription"
Content-Length: 464

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getServiceDescription xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationContext>
        <registrationHandle>0:0:0:0:0:0:0:1_1173173104036_0</registrationHandle>
      </registrationContext>
    </getServiceDescription>
  </soapenv:Body>
</soapenv:Envelope>
and here goes the answer which is quite verbose since it contains a complete description of the portlet/service. One annoyiance is all the unnessesary xsi:type the Axis 1.* produces which I've never been able to remove not even with sendXsiTypes.
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getServiceDescriptionResponse
      xsi:type="ns1:ServiceDescription"
      xmlns="urn:oasis:names:tc:wsrp:v1:types"
      xmlns:ns1="urn:oasis:names:tc:wsrp:v1:types">
      <ns1:requiresRegistration xsi:type="xsd:boolean">true</ns1:requiresRegistration>
      <ns1:offeredPortlets xsi:type="ns1:PortletDescription">
        <ns1:portletHandle xsi:type="xsd:string">wsrp4j-testportlet.WSRP4JTestPortletA</ns1:portletHandle>
        <ns1:markupTypes xsi:type="ns1:MarkupType">
          <ns1:mimeType xsi:type="xsd:string">text/html</ns1:mimeType>
          <ns1:modes xsi:type="xsd:string">wsrp:view</ns1:modes>
          <ns1:modes xsi:type="xsd:string">wsrp:edit</ns1:modes>
          <ns1:modes xsi:type="xsd:string">wsrp:help</ns1:modes>
          <ns1:windowStates xsi:type="xsd:string">wsrp:normal</ns1:windowStates>
          <ns1:windowStates xsi:type="xsd:string">wsrp:minimized</ns1:windowStates>
          <ns1:windowStates xsi:type="xsd:string">wsrp:maximized</ns1:windowStates>
          <ns1:locales xsi:type="xsd:string">en</ns1:locales>
        </ns1:markupTypes>
        <ns1:groupID xsi:type="xsd:string">wsrp4j-testportlet</ns1:groupID>
        <ns1:description
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test Portlet Description</ns1:value>
        </ns1:description>
        <ns1:shortTitle
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test</ns1:value>
        </ns1:shortTitle>
        <ns1:title
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test Portlet</ns1:value>
        </ns1:title>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP</ns1:value>
        </ns1:keywords>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J</ns1:value>
        </ns1:keywords>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">Test</ns1:value>
        </ns1:keywords>
        <ns1:usesMethodGet xsi:type="xsd:boolean">false</ns1:usesMethodGet>
        <ns1:userContextStoredInSession xsi:type="xsd:boolean">false</ns1:userContextStoredInSession>
        <ns1:templatesStoredInSession xsi:type="xsd:boolean">false</ns1:templatesStoredInSession>
        <ns1:hasUserSpecificState xsi:type="xsd:boolean">true</ns1:hasUserSpecificState>
        <ns1:doesUrlTemplateProcessing xsi:type="xsd:boolean">false</ns1:doesUrlTemplateProcessing>
      </ns1:offeredPortlets>
      <ns1:offeredPortlets xsi:type="ns1:PortletDescription">
        <ns1:portletHandle xsi:type="xsd:string">wsrp4j-testportlet.WSRP4JTestPortletB</ns1:portletHandle>
        <ns1:markupTypes xsi:type="ns1:MarkupType">
          <ns1:mimeType xsi:type="xsd:string">text/html</ns1:mimeType>
          <ns1:modes xsi:type="xsd:string">wsrp:view</ns1:modes>
          <ns1:modes xsi:type="xsd:string">wsrp:edit</ns1:modes>
          <ns1:modes xsi:type="xsd:string">wsrp:help</ns1:modes>
          <ns1:windowStates xsi:type="xsd:string">wsrp:normal</ns1:windowStates>
          <ns1:windowStates xsi:type="xsd:string">wsrp:minimized</ns1:windowStates>
          <ns1:windowStates xsi:type="xsd:string">wsrp:maximized</ns1:windowStates>
          <ns1:locales xsi:type="xsd:string">en</ns1:locales>
        </ns1:markupTypes>
        <ns1:groupID xsi:type="xsd:string">wsrp4j-testportlet</ns1:groupID>
        <ns1:description
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test Portlet Description</ns1:value>
        </ns1:description>
        <ns1:shortTitle
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test</ns1:value>
        </ns1:shortTitle>
        <ns1:title
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test Portlet</ns1:value>
        </ns1:title>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP</ns1:value>
        </ns1:keywords>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J</ns1:value>
        </ns1:keywords>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">Test</ns1:value>
        </ns1:keywords>
        <ns1:usesMethodGet xsi:type="xsd:boolean">false</ns1:usesMethodGet>
        <ns1:userContextStoredInSession xsi:type="xsd:boolean">false</ns1:userContextStoredInSession>
        <ns1:templatesStoredInSession xsi:type="xsd:boolean">false</ns1:templatesStoredInSession>
        <ns1:hasUserSpecificState xsi:type="xsd:boolean">true</ns1:hasUserSpecificState>
        <ns1:doesUrlTemplateProcessing xsi:type="xsd:boolean">false</ns1:doesUrlTemplateProcessing>
      </ns1:offeredPortlets>
      <ns1:requiresInitCookie xsi:type="ns1:CookieProtocol">perGroup</ns1:requiresInitCookie>
    </getServiceDescriptionResponse>
  </soapenv:Body>
</soapenv:Envelope>

So there two portlets availeble and they are identified by:

  • wsrp4j-testportlet.WSRP4JTestPortletA
  • wsrp4j-testportlet.WSRP4JTestPortletB

and the are actually the same portlet, that is portlet code but exposed twice to show of som IPC (Inter Portlet Communication) within a portlet group (portletapplication).



Initializing cookie Next the cookie is initialized
POST /wsrp4j-producer/services/WSRPBaseService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:initCookie"
Content-Length: 442

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <initCookie xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationContext>
        <registrationHandle>0:0:0:0:0:0:0:1_1173173104036_0</registrationHandle>
      </registrationContext>
    </initCookie>
  </soapenv:Body>
</soapenv:Envelope>
The response body is basicly empty since the cookie comes as a normal HTTP header
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=CD75D795F9463373DD7A0919DF0680E0; Path=/
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <initCookieResponse xmlns="urn:oasis:names:tc:wsrp:v1:types" />
  </soapenv:Body>
</soapenv:Envelope>
I don't understand why it's done this way since it's all webservice and not (legacy) browsers, so all clients will be WSRP aware, but I guess the spec writers wanted to stick with known protocols where possible, so the session handling between the consumer and producer uses normal HTTP cookies. Now discovery and initialization is done and the markup can be exchanged.

Give the markup for the portlet

POST /wsrp4j-producer/services/WSRPBaseService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:getMarkup"
Content-Length: 1483
Cookie: JSESSIONID=CD75D795F9463373DD7A0919DF0680E0

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getMarkup xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationContext>
        <registrationHandle>0:0:0:0:0:0:0:1_1173173104036_0</registrationHandle>
      </registrationContext>
      <portletContext>
        <portletHandle>wsrp4j-testportlet.WSRP4JTestPortletA</portletHandle>
      </portletContext>
      <runtimeContext>
        <userAuthentication>wsrp:none</userAuthentication>
        <portletInstanceKey>wsrp4j-proxyportlet_row2_col3_p3</portletInstanceKey>
        <namespacePrefix>Pluto_wsrp4j_proxyportlet_row2_col3_p3_</namespacePrefix>
      </runtimeContext>
      <userContext>
        <userContextKey>dummyUserContextKey</userContextKey>
      </userContext>
      <markupParams>
        <secureClientCommunication>false</secureClientCommunication>
        <locales>en</locales>
        <locales>de</locales>
        <mimeTypes>text/html</mimeTypes>
        <mode>wsrp:view</mode>
        <windowState>wsrp:normal</windowState>
        <clientData>
          <userAgent>WSRP4J Proxy Portlet</userAgent>
        </clientData>
        <markupCharacterSets>UTF-8</markupCharacterSets>
        <validNewModes>wsrp:view</validNewModes>
        <validNewModes>wsrp:help</validNewModes>
        <validNewModes>wsrp:edit</validNewModes>
        <validNewWindowStates>wsrp:normal</validNewWindowStates>
        <validNewWindowStates>wsrp:maximized</validNewWindowStates>
        <validNewWindowStates>wsrp:minimized</validNewWindowStates>
      </markupParams>
    </getMarkup>
  </soapenv:Body>
</soapenv:Envelope>

And here it comes (my not so pretty print)
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getMarkupResponse xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <markupContext>
        <mimeType>text/html; charset=UTF-8</mimeType>
        <markupString>
          &lt;h2&gt;URL Types Test&lt;/h2&gt;Time:Tue Mar 06 10:25:04 CET 2007&lt;BR/&gt;Current
          Mode:view&lt;BR/&gt;Current Window State:normal&lt;P/&gt;&lt;FONT
          SIZE=&quot;-1&quot;&gt;&lt;BR/&gt;&lt;B&gt;Render: &lt;/B&gt;Click here on &lt;A
          HREF=&quot;wsrp_rewrite?wsrp-urlType=render&amp;amp;wsrp-navigationalState=rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAAAeA**&amp;amp;wsrp-secureURL=false/wsrp_rewrite&quot;&gt;Render&lt;/A&gt;
          URL.&lt;BR/&gt;&lt;BR/&gt;&lt;B&gt;Action: &lt;/B&gt;Click here on &lt;A
          HREF=&quot;wsrp_rewrite?wsrp-urlType=blockingAction&amp;amp;wsrp-interactionState=rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAABdAAGQUNUSU9OdXIAE1tMamF2YS5sYW5nLlN0cmluZzut0lbn6R17RwIAAHhwAAAAAXQAATF4&amp;amp;wsrp-secureURL=false/wsrp_rewrite&quot;&gt;Action&lt;/A&gt;
          URL.&lt;BR/&gt;&lt;I&gt;Group Scope :0&lt;/I&gt;&lt;BR/&gt;&lt;I&gt;Portlet Scope
          :0&lt;/I&gt;&lt;BR/&gt;&lt;BR/&gt;&lt;B&gt;Resource: &lt;/B&gt;&lt;BR/&gt;&lt;IMG
          SRC=&quot;wsrp_rewrite?wsrp-urlType=resource&amp;amp;wsrp-url=http%3A%2F%2Flocalhost%3A9101%2Fwsrp4j-testportlet%2Fimages%2Fproject-logo.jpg&amp;amp;wsrp-requiresRewrite=false&amp;amp;wsrp-secureURL=false/wsrp_rewrite&quot;
          align=&quot;TOP&quot;/&gt;&lt;BR/&gt;&lt;BR/&gt;&lt;B&gt;Namespace:
          &lt;/B&gt;Pluto_wsrp4j_proxyportlet_row2_col3_p3_someFunctionHere()&lt;BR/&gt;&lt;HR/&gt;&lt;B&gt;Navigation&lt;/B&gt;&lt;BR/&gt;Page
          1&lt;BR/&gt;&lt;A
          HREF=&quot;wsrp_rewrite?wsrp-urlType=render&amp;amp;wsrp-navigationalState=rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAABdAAHanNwTmFtZXVyABNbTGphdmEubGFuZy5TdHJpbmc7rdJW5-kde0cCAAB4cAAAAAF0AAl0ZXN0Mi5qc3B4&amp;amp;wsrp-secureURL=false/wsrp_rewrite&quot;&gt;Next
          &amp;gt;&amp;gt;&lt;/A&gt;&lt;/FONT&gt;
        </markupString>
        <locale>en</locale>
        <requiresUrlRewriting>true</requiresUrlRewriting>
      </markupContext>
    </getMarkupResponse>
  </soapenv:Body>
</soapenv:Envelope>


and the same for the other portlet (ending with B).

please send the image

The portlet has an image resource that's fetched and cached for the second portlet. The request is a simple HTTP GET request (without a body)

GET /wsrp4j-testportlet/images/project-logo.jpg HTTP/1.1
User-Agent: Java/1.5.0_10
Host: localhost:9101
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive


and the answer is the jpeg image in binary so I'll not show that:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
ETag: W/"12241-1171550282000"
Last-Modified: Thu, 15 Feb 2007 14:38:02 GMT
Content-Type: image/jpeg
Content-Length: 12241
Date: Tue, 06 Mar 2007 09:25:04 GMT


and that completes the portlet page that the user sees.

Read more

Tuesday, February 27, 2007

The reel Sweetxml

pencil icon, that"s clickable to start editing the post
To my surprise I've discovered that my others also have fallen for the Sweetxml name, and that it's about XML in an non-XML way, it's clearly not for me as XML without angel brackets simply isn't XML - to me ;-). If you absolute has to see it you can read more about it on Paul Cantrell's creative effort on software and the Google groups on the software project. The purpose should be a more readable document, but I doesn't do it for me and the lack of tools/knowledge and the non-standard just doesn't make me join in. I allways try to respect other peoples choices, som I'll do the same with this and just because i own Sweetxml.org doesn't cange that.

Read more

Portlet Resources using clean JSTL

pencil icon, that"s clickable to start editing the post

Since I'm a great fan of XML I prefer to write my JSP pages as XML, since it guarantees wellformed markup and makes it easier to find errors in JSP's at development time (ant task to check for wellformedness) and naturally all the normal advantages of scriptlet free pages. This is also valid for my JSP's for my portlets and JSTL once more proved value to me when I had to reference a static resource (and image). In the test portlet application that comes with WSRP4J it's written as:

<IMG SRC=<%=renderResponse.encodeURL(renderRequest.getContextPath() + "/images/project-logo.jpg")%>" align="TOP" />

Adhering to best practice with URLencoding, this can be achived with JSTL:

<c:url var="imageUrl" context="${renderRequest.contextPath}" value="/images/project-logo.jpg" />
<img src="${imageUrl}" />

Easy and clean just as it should be. The only improvement I can think of would be to ectend the portlet taglib to include an image tag that would do it automatically in one simpel tag, like:

<portlet:img src="/images/project-logo.jpg" />

much like Struts and Spring.

Read more

Sunday, February 25, 2007

Pluto 1.0.1 and web-app 2.4

pencil icon, that"s clickable to start editing the post
I wanted to get started on using WSRP by the WSRP4J project at apache , and has ended up in non-productive try and fails and google searches. Long story short, to get started WSRP4J doesn't have a binary to start with and therefore i had to use it from the svn repo, to find out that it uses Maven, which i havn't used before. I did get it running after some time, and then i wanted to tryit on my own portlets. I've tried the 1.1 beta branch of Pluto, but WSRP4J still uses Pluto 1.0.1, and for days i've been hassling to get i running. Logging/debugging in Tomcat 5.5/6.0 still puzzles me (worth and entry of it's own) but the last piece that i've got working was after endless log entries like
Feb 25, 2007 12:34:26 PM org.apache.pluto.portalImpl.services.log.LoggerImpl error
SEVERE: Error in Portlet
java.lang.NullPointerException
   at org.apache.pluto.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:109)
   at org.apache.pluto.invoker.impl.PortletInvokerImpl.load(PortletInvokerImpl.java:80)
   at org.apache.pluto.PortletContainerImpl.portletLoad(PortletContainerImpl.java:218)
   at org.apache.pluto.portalImpl.core.PortletContainerWrapperImpl.portletLoad(PortletContainerWrapperImpl.java:94)
   at org.apache.pluto.portalImpl.aggregation.PortletFragment.service(PortletFragment.java:120)
   at org.apache.jsp.WEB_002dINF.aggregation.ColumnFragment_jsp._jspService(ColumnFragment_jsp.java:76)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
   at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
   at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)
   at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(AbstractFragment.java:112)
   at org.apache.jsp.WEB_002dINF.aggregation.RowFragment_jsp._jspService(RowFragment_jsp.java:76)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
   at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
   at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)
   at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(AbstractFragment.java:112)
   at org.apache.jsp.WEB_002dINF.aggregation.PageFragment_jsp._jspService(PageFragment_jsp.java:85)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
   at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
   at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)
   at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(AbstractFragment.java:112)
   at org.apache.jsp.WEB_002dINF.aggregation.RootFragment_jsp._jspService(RootFragment_jsp.java:147)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
   at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
   at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)
   at org.apache.pluto.portalImpl.aggregation.AbstractFragment.service(AbstractFragment.java:112)
   at org.apache.pluto.portalImpl.Servlet.doGet(Servlet.java:254)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
   at java.lang.Thread.run(Thread.java:595)
I had an idea that web-app versions might be a problem, and had it running when i changed to version 2.3, I then changed it to 2.4 and redeployed and i still worked, but that was probably due to me lack of understanding on redeploying to tomcat. Any how it's also described in the mail archives (this from the google cache) Re: Supporting web.xml with 2.4 XSD The solution was to only put the version="2.4" attribute on the <web-app> tag and not the namespace information. Now I'll have to make sure everything else works without the namespace attributes. That's right for me as well. Now I'm not sure wether it'll actually run as a 2.4 web-app in tomcat, but time will show.

Read more

Tuesday, February 13, 2007

First entry at blog.sweetxml.org aka sweetxml.blogger.com

pencil icon, that"s clickable to start editing the post
I've finally decided to try out a hosted blog, since my own server is often off line and during my lateste upgrade of fedora I somehow lost my database backup. I'll try to restore my few postings from my last blog thanks to google cache.

Read more