You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nesto <ne...@libero.it> on 2003/03/10 11:14:45 UTC

xml header on delivered pages

Hi!

I'm designing the interface for mobile devices for a web portal using Cocoon.

When I test my pages on a iPaq (with Pocket Internet Explorer) I get the correct page, without errors, but with del xml header visualized at the beginning of every page.
<?xml version="1.0" encoding="ISO-8859-1"?> (and then I get the right content...)
Of couse I want to delete it!!

Here I write the informations I think are importants for this problem:

The XSPs that are called in a pipeline for a iPaq http request (for example) have at the beginning the xml header (<?xml version="1.0" encoding="ISO-8859-1"?>),
while the xsl doesn't.
Then I deliver the markup with this serializer:

<map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html" name="xhtml-Transitional" pool-grow="2" pool-max="64" pool-min="2" src="org.apache.cocoon.serialization.XMLSerializer">
    <doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
    <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system>
    <encoding>ISO-8859-1</encoding>
</map:serializer>


I think the responsible of the writing of the xml header is the serializer, but I have no idea on how solve the problem.
Thank you for your help!

Nesto


Re: Redirection from the action that is being a part of aggregated pipeline.

Posted by ad...@gmx.de.
Hi,

I just wanted to fix some "misspeling" in previous post (see end of this
mail).
The console output I have added states that 
"cocoon/magellan/admin/groups" cannot be matched - of course 
it should be "cocoon/magellan/admin/users" - I have exactly 
the same problem with groups maintanace page. By accident
I have copied log output from the session with the "groups maintenance page"

> 21:26:24,307 INFO  [STDOUT] No pipeline matched request:
> cocoon/magellan/admin/groups

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


[SOLUTION] Redirection from the action that is being a part of aggregated pipeline.

Posted by ad...@gmx.de.
Hi every1

THE PROBLEM WAS

> I agregate 5 pipelines. 4 of them are almost simple static HTML the 5th
> one handles whole logic which is handled by action-set. All of the
pipelines
> work separately. Aggregation also works but *only when none* of the action
> which redirects to different URI is called due to user request.

SOLUTION

The solution is quite simple (but I could not reconcile to it for some
time).
You just  must not use Redirector, redirect or globalRedirect methods in the
actions that are part of aggregated pipeline.
Special thanks goes here to Diana Shannon from Apache.org who found some
time
to discuss this matter with me.

So if you have some redirections (or redirecting actions)  in the aggregated
pipelines
you have to pull them out of there and place it somewhere in the
aggregating pipeline body (the  one that contains <map:aggregate> tag). 

cheers & happy coding A.

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Redirection from the action that is being a part of aggregated pipeline.

Posted by ad...@gmx.de.
Hi,

if anyone could help with following problem I would be thankful.

I agregate 5 pipelines. 4 of them are almost simple static HTML the 5th one
handles whole logic which is handled by action-set. All of the pipelines work
separately. Aggregation also works but *only when none* of the action which
redirects to different URI is called due to user request.
All of the processing is done in the single subsitemap mounted at
/cocoon/magellan

To make it more clear I describe what excatly I try to achive. My page
provides simple user administration (Create, Remove, Update - user).

the action set that handles that looks like this

   <map:action-set name="users_maintenance">
      <map:act type="create-user" action="create_user">            
      </map:act>
      <map:act type="remove-user" action="remove_user">
      </map:act>
      <map:act type="update-user" action="update_user">
      </map:act>
      <map:act type="select-user">
      </map:act>
    </map:action-set>

(I have cut out actions cfg. params - they are not needed in this
discussion)

this action set is used in the following part of the  pipeline
(again config params are cut out)

      <map:match pattern="internal/admin/users">
        <map:act set="users_maintenance"/>
        <map:generate type="file" src="admin/users_edit.xml"/>
        <map:transform type="cif-trans"/>
        <map:transform type="i18n">
        </map:transform>
        <map:transform type="xslt" src="admin/users_edit.xsl">
        </map:transform>
        <map:transform type="i18n">
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>

the aggregation is defined as follows:

    <map:pipeline>
      <map:match pattern="*/*">
        <map:aggregate element="teweb_agg_doc">
          <map:part src="cocoon:/internal/header/{1}"
                          element="teweb_l_header"/>
          <map:part src="cocoon:/internal/auth" 
                          element="teweb_r_header"/>
          <map:part src="cocoon:/internal/navi_bar" 
                          element="teweb_navi_bar"/>
          <map:part src="cocoon:/internal/context_menu" 
                          element="teweb_context_menu"/>
          <map:part src="cocoon:/internal/{1}/{2}" 
                          element="teweb_main"/>
        </map:aggregate>
        <map:transform type="xslt" src="common/front_page.xsl"/>
        <map:serialize type="html"/>
      </map:match>
    </map:pipeline>

you can assume here for simplicity sake that {1} equals "admin" and {2}
equals "users".
And now the problem. Let say I browse user "terminator" so my URI looks like
this 

   magellan/admin/users?user_login=terminator

Now I decide to remove "terminator". The "remove-user" action is matched and
user is removed.
But at the end of action I want to redirect request to 

   /admin/users

(I do not want to browse none-existing user no more). I use redirector to do
this:

   rediarector.redirect(false, request.getRequestURI());

Redirection causes IllegalStateException :

21:26:24,347 ERROR [Engine] StandardWrapperValve[Cocoon2]: Servlet.service()
for servlet Cocoon2 thr
ew exception
java.lang.IllegalStateException
        at
org.apache.catalina.connector.ResponseFacade.reset(ResponseFacade.java:252)
        at
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1037)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
ava:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   
Well at least I think that redirection is a problem here - the core.log does
not even shows any exception. The one above comes from JBoss console.
Normally I can see exception in core.log but this one somehow does not appear. 
Please remeber that the "administration pipeline" *works when  processed
separately*
(if I change serialization to HTML and access magellan/internal/admin/users
- all the action works properly)

I have modified a little bit CocoonServlet and added few System outs ( to
see internal exception message). The internal message says:

21:26:24,307 INFO  [STDOUT] No pipeline matched request:
cocoon/magellan/admin/groups

I do not get it how it happens. I can browse URI
/cocoon/magellan/admin/users - everything is displayed correctly.
Only when I try to remove user (or execute similar action) whole thing
blows up. I have also tried to call globalRedirect method - the exception is
quie different then. It says  that XML stream was closed.
If more details are needed I will provide them on demand.

Any help is welcome. 

greetings, Adam.

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


AW: xml header on delivered pages

Posted by Marco Rolappe <m_...@web.de>.
hi nesto,

you can use <omit-xml-declaration>yes</omit-xml-declaration> in your
serializer config.

but IIUC the xml declaration should be in the markup, since it's xhtml.
maybe you have to use a mime-type different from text/html?
  -----Ursprüngliche Nachricht-----
  Von: cocoon-users-return-47501-m_rolappe=web.de@xml.apache.org
[mailto:cocoon-users-return-47501-m_rolappe=web.de@xml.apache.org]Im Auftrag
von Nesto
  Gesendet: Montag, 10. März 2003 11:15
  An: cocoon-users@xml.apache.org
  Betreff: xml header on delivered pages


  Hi!

  I'm designing the interface for mobile devices for a web portal using
Cocoon.

  When I test my pages on a iPaq (with Pocket Internet Explorer) I get the
correct page, without errors, but with del xml header visualized at the
beginning of every page.
  <?xml version="1.0" encoding="ISO-8859-1"?> (and then I get the right
content...)
  Of couse I want to delete it!!

  Here I write the informations I think are importants for this problem:

  The XSPs that are called in a pipeline for a iPaq http request (for
example) have at the beginning the xml header (<?xml version="1.0"
encoding="ISO-8859-1"?>),
  while the xsl doesn't.
  Then I deliver the markup with this serializer:

  <map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html"
name="xhtml-Transitional" pool-grow="2" pool-max="64" pool-min="2"
src="org.apache.cocoon.serialization.XMLSerializer">
      <doctype-public>-//W3C//DTD XHTML 1.0
Transitional//EN</doctype-public>

<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doc
type-system>
      <encoding>ISO-8859-1</encoding>
  </map:serializer>


  I think the responsible of the writing of the xml header is the
serializer, but I have no idea on how solve the problem.
  Thank you for your help!

  Nesto