Author: julien(a)jboss.com
Date: 2008-06-11 05:25:12 -0400 (Wed, 11 Jun 2008)
New Revision: 10982
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoder.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoderChain.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoderContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoder.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoderChain.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoderContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/DefaultActionDecoder.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/DefaultActionEncoder.java
Removed:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderChain.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderChain.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionDecoder.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionEncoder.java
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionDecoder.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionEncoder.java
Log:
move the protocol codec in the presentation-presentation module
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -24,12 +24,14 @@
import org.jboss.portal.presentation.classic.model.ClassicUINode;
import org.jboss.portal.presentation.classic.model.ClassicViewPortContext;
+import org.jboss.portal.presentation.classic.protocol.ClassicActionDecoderContext;
+import org.jboss.portal.presentation.classic.protocol.ClassicActionEncoderContext;
import org.jboss.portal.presentation.view.DefaultPageViewPortScope;
import org.jboss.portal.presentation.view.PageViewPortScope;
-import org.jboss.portal.presentation.classic.protocol.ActionDecoder;
-import org.jboss.portal.presentation.classic.protocol.ActionEncoder;
-import org.jboss.portal.presentation.classic.protocol.ActionEncoderContext;
-import org.jboss.portal.presentation.classic.protocol.ActionDecoderContext;
+import org.jboss.portal.presentation.protocol.codec.ActionDecoder;
+import org.jboss.portal.presentation.protocol.codec.ActionDecoderContext;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoderContext;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.impl.model.UIModelImpl;
import
org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
@@ -122,7 +124,7 @@
}
//
- ActionDecoderContext decoderContext = new ActionDecoderContext(
+ ActionDecoderContext decoderContext = new ClassicActionDecoderContext(
req.getVerb(),
req.getWebRequestPath(),
req.getQueryParameterMap(),
@@ -241,7 +243,7 @@
{
byte[] bytes = IOTools.serialize(new NavigationalStateContextSerialization(),
SerializationFilter.COMPRESSOR, navigationalStateContext);
String ns = Base64.encodeBytes(bytes, true);
- encoderContext = new ActionEncoderContext(ns, resp);
+ encoderContext = new ClassicActionEncoderContext(ns, resp);
//
StructuralStateContext ssc = server.getStructuralStateContext();
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -24,8 +24,8 @@
import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.server.PresentationServerException;
-import org.jboss.portal.presentation.classic.protocol.ActionEncoder;
-import org.jboss.portal.presentation.classic.protocol.ActionDecoder;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
+import org.jboss.portal.presentation.protocol.codec.ActionDecoder;
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.WebResponse;
import org.jboss.portal.web.endpoint.EndPointServlet;
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.classic.protocol;
-
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public interface ActionDecoder
-{
-
- ProtocolAction decode(ActionDecoderContext context);
-
- }
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderChain.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderChain.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderChain.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -1,60 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.classic.protocol;
-
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class ActionDecoderChain implements ActionDecoder
-{
-
- /** . */
- private final List<ActionDecoder> decoders;
-
- public ActionDecoderChain(List<ActionDecoder> decoders)
- {
- this.decoders = decoders;
- }
-
- public ProtocolAction decode(ActionDecoderContext context)
- {
- for (ActionDecoder decoder : decoders)
- {
- ProtocolAction action = decoder.decode(context);
-
- //
- if (action != null)
- {
- return action;
- }
- }
-
- //
- return null;
- }
-}
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderContext.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderContext.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionDecoderContext.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -1,76 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.classic.protocol;
-
-import org.jboss.portal.web.WebRequest;
-import org.jboss.portal.web.Body;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class ActionDecoderContext
-{
-
- /** . */
- private final WebRequest.Verb verb;
-
- /** . */
- private final String path;
-
- /** . */
- private final Map<String, String[]> queryParameterMap;
-
- /** . */
- private final Body body;
-
- public ActionDecoderContext(WebRequest.Verb verb, String path, Map<String,
String[]> queryParameterMap, Body body)
- {
- this.verb = verb;
- this.path = path;
- this.queryParameterMap = queryParameterMap;
- this.body = body;
- }
-
- public WebRequest.Verb getVerb()
- {
- return verb;
- }
-
- public String getPath()
- {
- return path;
- }
-
- public Map<String, String[]> getQueryParameterMap()
- {
- return queryParameterMap;
- }
-
- public Body getBody()
- {
- return body;
- }
-}
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.classic.protocol;
-
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public interface ActionEncoder
-{
-
- String encode(ProtocolAction action, ActionEncoderContext context);
-
-}
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderChain.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderChain.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderChain.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -1,60 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.classic.protocol;
-
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class ActionEncoderChain implements ActionEncoder
-{
-
- /** . */
- private List<ActionEncoder> encoders;
-
- public ActionEncoderChain(List<ActionEncoder> encoders)
- {
- this.encoders = encoders;
- }
-
- public String encode(ProtocolAction action, ActionEncoderContext context)
- {
- for (ActionEncoder encoder : encoders)
- {
- String v = encoder.encode(action, context);
-
- //
- if (v != null)
- {
- return v;
- }
- }
-
- //
- return null;
- }
-}
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderContext.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderContext.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/ActionEncoderContext.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -1,57 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.classic.protocol;
-
-import org.jboss.portal.web.WebResponse;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class ActionEncoderContext
-{
-
- /** . */
- private final String navigationalState;
-
- /** . */
- private final WebResponse webResponse;
-
- public ActionEncoderContext(String navigationalState, WebResponse webResponse)
- {
- this.navigationalState = navigationalState;
- this.webResponse = webResponse;
- }
-
- public String getNavigationalState()
- {
- return navigationalState;
- }
-
- public String renderURL(String path, Map<String, String[]> parameters) throws
IllegalArgumentException
- {
- return webResponse.renderURL(path, parameters, null);
- }
-}
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionDecoder.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionDecoder.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionDecoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -1,87 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.classic.protocol;
-
-import org.jboss.portal.presentation.protocol.GetActivation;
-import org.jboss.portal.presentation.protocol.PostActivation;
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
-import org.jboss.portal.common.NotYetImplemented;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class DefaultActionDecoder implements ActionDecoder
-{
-
- public ProtocolAction decode(ActionDecoderContext context)
- {
- ProtocolAction action = null;
-
- //
- String webPath = context.getPath();
-
- //
- if (webPath.startsWith("/view/"))
- {
- String targetId = webPath.substring("/view/".length());
- action = new ViewUIObjectAction(targetId);
- }
- else if (webPath.startsWith("/invoke/"))
- {
- int from = "/invoke/".length();
-
- //
- String path = null;
- int to = webPath.indexOf('/', from + 1);
- if (to == -1)
- {
- to = webPath.length();
- }
- else
- {
- path = webPath.substring(to + 1);
- }
-
- //
- String targetId = webPath.substring(from, to);
-
- //
- switch (context.getVerb())
- {
- case GET:
- action= new GetActivation(targetId, path,
context.getQueryParameterMap());
- break;
- case POST:
- action = new PostActivation(targetId, path,
context.getQueryParameterMap(), context.getBody());
- break;
- default:
- throw new NotYetImplemented();
- }
- }
-
- //
- return action;
- }
-}
\ No newline at end of file
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionEncoder.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionEncoder.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/protocol/DefaultActionEncoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -1,68 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.classic.protocol;
-
-import org.jboss.portal.common.text.FastURLEncoder;
-import org.jboss.portal.presentation.protocol.LinkActivation;
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-import org.jboss.portal.presentation.protocol.UIObjectAction;
-import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class DefaultActionEncoder implements ActionEncoder
-{
-
- public DefaultActionEncoder()
- {
- }
-
- public String encode(ProtocolAction action, ActionEncoderContext context)
- {
- if (action instanceof UIObjectAction)
- {
- UIObjectAction objectAction = (UIObjectAction)action;
-
- //
- String targetId =
FastURLEncoder.getUTF8Instance().encode(objectAction.getTargetId());
-
- //
- if (action instanceof ViewUIObjectAction)
- {
- return context.renderURL("/view/" + targetId, null);
- }
- else if (action instanceof LinkActivation)
- {
- LinkActivation linkActivationAction = (LinkActivation)action;
-
- //
- return context.renderURL("/invoke/" + targetId,
linkActivationAction.getQueryParameters());
- }
- }
-
- //
- return null;
- }
-}
\ No newline at end of file
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
---
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-11
09:25:12 UTC (rev 10982)
@@ -105,9 +105,9 @@
- <bean name="DefaultActionEncoder"
class="org.jboss.portal.presentation.classic.protocol.DefaultActionEncoder"/>
+ <bean name="DefaultActionEncoder"
class="org.jboss.portal.presentation.protocol.codec.DefaultActionEncoder"/>
<bean name="PortletActionEncoder"
class="org.jboss.portal.presentation.portal.content.portlet.protocol.PortletActionEncoder"/>
- <bean name="ActionEncoder"
class="org.jboss.portal.presentation.classic.protocol.ActionEncoderChain">
+ <bean name="ActionEncoder"
class="org.jboss.portal.presentation.protocol.codec.ActionEncoderChain">
<constructor>
<parameter>
<list>
@@ -118,9 +118,9 @@
</constructor>
</bean>
- <bean name="DefaultActionDecoder"
class="org.jboss.portal.presentation.classic.protocol.DefaultActionDecoder"/>
+ <bean name="DefaultActionDecoder"
class="org.jboss.portal.presentation.protocol.codec.DefaultActionDecoder"/>
<bean name="PortletActionDecoder"
class="org.jboss.portal.presentation.portal.content.portlet.protocol.PortletActionDecoder"/>
- <bean name="ActionDecoder"
class="org.jboss.portal.presentation.classic.protocol.ActionDecoderChain">
+ <bean name="ActionDecoder"
class="org.jboss.portal.presentation.protocol.codec.ActionDecoderChain">
<constructor>
<parameter>
<list>
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionDecoder.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionDecoder.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionDecoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.content.portlet.protocol;
-import org.jboss.portal.presentation.classic.protocol.ActionDecoder;
-import org.jboss.portal.presentation.classic.protocol.ActionDecoderContext;
+import org.jboss.portal.presentation.protocol.codec.ActionDecoder;
+import org.jboss.portal.presentation.protocol.codec.ActionDecoderContext;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.LifeCyclePhase;
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionEncoder.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionEncoder.java 2008-06-11
07:51:45 UTC (rev 10981)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/protocol/PortletActionEncoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.content.portlet.protocol;
-import org.jboss.portal.presentation.classic.protocol.ActionEncoder;
-import org.jboss.portal.presentation.classic.protocol.ActionEncoderContext;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoderContext;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import java.util.Map;
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoder.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoder.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.protocol.codec;
+
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface ActionDecoder
+{
+
+ ProtocolAction decode(ActionDecoderContext context);
+
+ }
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoderChain.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoderChain.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoderChain.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.protocol.codec;
+
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ActionDecoderChain implements ActionDecoder
+{
+
+ /** . */
+ private final List<ActionDecoder> decoders;
+
+ public ActionDecoderChain(List<ActionDecoder> decoders)
+ {
+ this.decoders = decoders;
+ }
+
+ public ProtocolAction decode(ActionDecoderContext context)
+ {
+ for (ActionDecoder decoder : decoders)
+ {
+ ProtocolAction action = decoder.decode(context);
+
+ //
+ if (action != null)
+ {
+ return action;
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoderContext.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoderContext.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionDecoderContext.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.protocol.codec;
+
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface ActionDecoderContext
+{
+
+ WebRequest.Verb getVerb();
+
+ String getPath();
+
+ Map<String, String[]> getQueryParameterMap();
+
+ Body getBody();
+}
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoder.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoder.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.protocol.codec;
+
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface ActionEncoder
+{
+
+ String encode(ProtocolAction action, ActionEncoderContext context);
+
+}
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoderChain.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoderChain.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoderChain.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.protocol.codec;
+
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ActionEncoderChain implements ActionEncoder
+{
+
+ /** . */
+ private List<ActionEncoder> encoders;
+
+ public ActionEncoderChain(List<ActionEncoder> encoders)
+ {
+ this.encoders = encoders;
+ }
+
+ public String encode(ProtocolAction action, ActionEncoderContext context)
+ {
+ for (ActionEncoder encoder : encoders)
+ {
+ String v = encoder.encode(action, context);
+
+ //
+ if (v != null)
+ {
+ return v;
+ }
+ }
+
+ //
+ return null;
+ }
+}
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoderContext.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoderContext.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/ActionEncoderContext.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.protocol.codec;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface ActionEncoderContext
+{
+
+ String getNavigationalState();
+
+ String renderURL(String path, Map<String, String[]> parameters) throws
IllegalArgumentException;
+}
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/DefaultActionDecoder.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/DefaultActionDecoder.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/DefaultActionDecoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.protocol.codec;
+
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.common.NotYetImplemented;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DefaultActionDecoder implements ActionDecoder
+{
+
+ public ProtocolAction decode(ActionDecoderContext context)
+ {
+ ProtocolAction action = null;
+
+ //
+ String webPath = context.getPath();
+
+ //
+ if (webPath.startsWith("/view/"))
+ {
+ String targetId = webPath.substring("/view/".length());
+ action = new ViewUIObjectAction(targetId);
+ }
+ else if (webPath.startsWith("/invoke/"))
+ {
+ int from = "/invoke/".length();
+
+ //
+ String path = null;
+ int to = webPath.indexOf('/', from + 1);
+ if (to == -1)
+ {
+ to = webPath.length();
+ }
+ else
+ {
+ path = webPath.substring(to + 1);
+ }
+
+ //
+ String targetId = webPath.substring(from, to);
+
+ //
+ switch (context.getVerb())
+ {
+ case GET:
+ action= new GetActivation(targetId, path,
context.getQueryParameterMap());
+ break;
+ case POST:
+ action = new PostActivation(targetId, path,
context.getQueryParameterMap(), context.getBody());
+ break;
+ default:
+ throw new NotYetImplemented();
+ }
+ }
+
+ //
+ return action;
+ }
+}
\ No newline at end of file
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/DefaultActionEncoder.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/DefaultActionEncoder.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/codec/DefaultActionEncoder.java 2008-06-11
09:25:12 UTC (rev 10982)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, 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.portal.presentation.protocol.codec;
+
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.UIObjectAction;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DefaultActionEncoder implements ActionEncoder
+{
+
+ public DefaultActionEncoder()
+ {
+ }
+
+ public String encode(ProtocolAction action, ActionEncoderContext context)
+ {
+ if (action instanceof UIObjectAction)
+ {
+ UIObjectAction objectAction = (UIObjectAction)action;
+
+ //
+ String targetId =
FastURLEncoder.getUTF8Instance().encode(objectAction.getTargetId());
+
+ //
+ if (action instanceof ViewUIObjectAction)
+ {
+ return context.renderURL("/view/" + targetId, null);
+ }
+ else if (action instanceof LinkActivation)
+ {
+ LinkActivation linkActivationAction = (LinkActivation)action;
+
+ //
+ return context.renderURL("/invoke/" + targetId,
linkActivationAction.getQueryParameters());
+ }
+ }
+
+ //
+ return null;
+ }
+}
\ No newline at end of file