1 16 17 package org.apache.cocoon.portal.wsrp.consumer; 18 19 import oasis.names.tc.wsrp.v1.types.ClientData; 20 import oasis.names.tc.wsrp.v1.types.MarkupContext; 21 import oasis.names.tc.wsrp.v1.types.NamedString; 22 import oasis.names.tc.wsrp.v1.types.SessionContext; 23 24 import org.apache.wsrp4j.consumer.ConsumerEnvironment; 25 import org.apache.wsrp4j.consumer.InteractionRequest; 26 import org.apache.wsrp4j.consumer.MarkupRequest; 27 import org.apache.wsrp4j.consumer.driver.GenericWSRPBaseRequestImpl; 28 29 42 public class WSRPRequestImpl extends GenericWSRPBaseRequestImpl 43 implements InteractionRequest, MarkupRequest { 44 45 46 protected final SimplePortletWindowSession windowSession; 47 48 49 protected final Request request; 50 51 52 protected final ConsumerEnvironment consEnv; 53 54 61 public WSRPRequestImpl(SimplePortletWindowSession session, 62 Request request, 63 ConsumerEnvironment env) { 64 if (session == null) { 65 throw(new IllegalStateException ("session must not be null")); 66 } 67 if (env == null) { 68 throw(new IllegalStateException ("environment must not be null")); 69 } 70 if ( request == null ) { 71 this.request = new RequestImpl(); 72 } else { 73 this.request = request; 74 } 75 this.windowSession = session; 76 this.consEnv = env; 77 } 78 79 82 public String getSessionID() { 83 SessionContext sessionCtx = windowSession.getPortletSession().getSessionContext(); 84 if (sessionCtx != null) { 85 return sessionCtx.getSessionID(); 86 } 87 return null; 88 } 89 90 93 public String getPortletInstanceKey() { 94 return windowSession.getWindowID(); 95 } 96 97 100 public String getNavigationalState() { 101 return windowSession.getNavigationalState(); 102 } 103 104 107 public String getWindowState() { 108 return windowSession.getWindowState(); 109 } 110 111 114 public String getMode() { 115 return this.windowSession.getMode(); 116 } 117 118 121 public ClientData getClientData() { 122 return null; 123 } 124 125 128 public String [] getLocales() { 129 return this.consEnv.getSupportedLocales(); 130 } 131 132 135 public String [] getModes() { 136 return this.consEnv.getSupportedModes(); 137 } 138 139 142 public String [] getWindowStates() { 143 return this.consEnv.getSupportedWindowStates(); 144 } 145 146 149 public String [] getMimeTypes() { 150 return consEnv.getMimeTypes(); 151 } 152 153 156 public String [] getCharacterEncodingSet() { 157 return this.consEnv.getCharacterEncodingSet(); 158 } 159 160 163 public String getUserAuthentication() { 164 return this.consEnv.getUserAuthentication(); 165 } 166 167 170 public String getInteractionState() { 171 return this.request.getInteractionState(); 172 } 173 174 177 public NamedString[] getFormParameters() { 178 return this.request.getFormParameters(); 179 } 180 181 184 public MarkupContext getCachedMarkup() { 185 return this.windowSession.getCachedMarkup(); 186 } 187 } 188 | Popular Tags |