Changeset 5029
- Timestamp:
- 01/28/10 11:48:37 (2 years ago)
- Location:
- branches/release-0.14.x
- Files:
-
- 5 modified
-
ChangeLog (modified) (1 diff)
-
pustefix-core/src/main/java/de/schlund/pfixcore/workflow/ContextImpl.java (modified) (2 diffs)
-
pustefix-core/src/main/java/de/schlund/pfixcore/workflow/context/RequestContextImpl.java (modified) (1 diff)
-
pustefix-webservices/pustefix-webservices-jaxws/src/main/java/org/pustefixframework/webservices/jaxws/JAXWSProcessor.java (modified) (4 diffs)
-
pustefix-webservices/pustefix-webservices-jsonws/src/main/java/org/pustefixframework/webservices/jsonws/JSONWSProcessor.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/release-0.14.x/ChangeLog
r5007 r5029 1 2010-01-28 Martin Leidig <mleidig@schlund.de> 2 3 Added support for setting cookies at webservice responses. 4 5 Therefore cookies set at the context during processing of a 6 webservice request are added to the HttpServletResponse 7 after the service object's method invocation and right before 8 writing the response. 9 1 10 2010-01-13 Martin Leidig <mleidig@schlund.de> 2 11 -
branches/release-0.14.x/pustefix-core/src/main/java/de/schlund/pfixcore/workflow/ContextImpl.java
r4512 r5029 19 19 package de.schlund.pfixcore.workflow; 20 20 21 import java.util.List; 21 22 import java.util.Properties; 22 23 … … 70 71 } 71 72 73 public List<Cookie> getCookies() { 74 return getRequestContextForCurrentThreadWithError().getCookies(); 75 } 76 72 77 public Cookie[] getRequestCookies() { 73 78 return getRequestContextForCurrentThreadWithError().getRequestCookies(); -
branches/release-0.14.x/pustefix-core/src/main/java/de/schlund/pfixcore/workflow/context/RequestContextImpl.java
r4580 r5029 890 890 891 891 public void addCookie(Cookie cookie) { 892 if (currentpservreq == null) {893 throw new IllegalStateException("Cookies are only available witihin request handling");894 }895 892 cookielist.add(cookie); 893 } 894 895 public List<Cookie> getCookies() { 896 return cookielist; 896 897 } 897 898 -
branches/release-0.14.x/pustefix-webservices/pustefix-webservices-jaxws/src/main/java/org/pustefixframework/webservices/jaxws/JAXWSProcessor.java
r4517 r5029 26 26 import javax.servlet.ServletContext; 27 27 import javax.servlet.ServletException; 28 import javax.servlet.http.Cookie; 28 29 import javax.servlet.http.HttpServletRequest; 29 30 import javax.servlet.http.HttpServletResponse; … … 40 41 import org.pustefixframework.webservices.ProcessingInfo; 41 42 import org.pustefixframework.webservices.SOAPActionRequestWrapper; 43 import org.pustefixframework.webservices.ServiceCallContext; 42 44 import org.pustefixframework.webservices.ServiceException; 43 45 import org.pustefixframework.webservices.ServiceProcessor; … … 59 61 import com.sun.xml.ws.transport.http.servlet.ServletAdapterList; 60 62 import com.sun.xml.ws.transport.http.servlet.WSServletDelegate; 63 64 import de.schlund.pfixcore.workflow.Context; 65 import de.schlund.pfixcore.workflow.ContextImpl; 61 66 62 67 /** … … 220 225 } finally { 221 226 ctx.endInvocation(); 227 ServiceResponse res = ServiceCallContext.getCurrentContext().getServiceResponse(); 228 if(res.getUnderlyingResponse() instanceof HttpServletResponse) { 229 HttpServletResponse httpRes = (HttpServletResponse)res.getUnderlyingResponse(); 230 Context context = ServiceCallContext.getCurrentContext().getContext(); 231 if(context != null) { 232 List<Cookie> cookies = ((ContextImpl)context).getCookies(); 233 for(Cookie cookie: cookies) { 234 httpRes.addCookie(cookie); 235 } 236 } 237 } 222 238 } 223 239 } -
branches/release-0.14.x/pustefix-webservices/pustefix-webservices-jsonws/src/main/java/org/pustefixframework/webservices/jsonws/JSONWSProcessor.java
r4517 r5029 29 29 import java.util.List; 30 30 31 import javax.servlet.http.Cookie; 32 import javax.servlet.http.HttpServletResponse; 33 31 34 import org.apache.log4j.Logger; 32 import org.pustefixframework.webservices.json.JSONArray;33 import org.pustefixframework.webservices.json.JSONObject;34 import org.pustefixframework.webservices.json.parser.JSONParser;35 36 import de.schlund.pfixcore.beans.BeanDescriptorFactory;37 import de.schlund.pfixcore.beans.InitException;38 import de.schlund.pfixcore.beans.metadata.DefaultLocator;39 35 import org.pustefixframework.webservices.ProcessingInfo; 40 36 import org.pustefixframework.webservices.ServiceCallContext; … … 49 45 import org.pustefixframework.webservices.fault.Fault; 50 46 import org.pustefixframework.webservices.fault.FaultHandler; 47 import org.pustefixframework.webservices.json.JSONArray; 48 import org.pustefixframework.webservices.json.JSONObject; 49 import org.pustefixframework.webservices.json.parser.JSONParser; 50 51 import de.schlund.pfixcore.beans.BeanDescriptorFactory; 52 import de.schlund.pfixcore.beans.InitException; 53 import de.schlund.pfixcore.beans.metadata.DefaultLocator; 54 import de.schlund.pfixcore.workflow.Context; 55 import de.schlund.pfixcore.workflow.ContextImpl; 51 56 52 57 /** … … 186 191 } 187 192 193 if(res.getUnderlyingResponse() instanceof HttpServletResponse){ 194 HttpServletResponse httpRes = (HttpServletResponse)res.getUnderlyingResponse(); 195 Context context = ServiceCallContext.getCurrentContext().getContext(); 196 if(context != null) { 197 List<Cookie> cookies = ((ContextImpl)context).getCookies(); 198 for(Cookie cookie: cookies) { 199 httpRes.addCookie(cookie); 200 } 201 } 202 } 203 188 204 res.setContentType("text/plain"); 189 205 res.setCharacterEncoding("utf-8");
