Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 70316 invoked from network); 25 Jan 2008 18:38:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jan 2008 18:38:27 -0000 Received: (qmail 39710 invoked by uid 500); 25 Jan 2008 18:38:18 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 39575 invoked by uid 500); 25 Jan 2008 18:38:17 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 39566 invoked by uid 99); 25 Jan 2008 18:38:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jan 2008 10:38:17 -0800 X-ASF-Spam-Status: No, hits=-98.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jan 2008 18:38:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D924E1A983A; Fri, 25 Jan 2008 10:38:00 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r615303 - in /incubator/cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/... Date: Fri, 25 Jan 2008 18:37:59 -0000 To: cxf-commits@incubator.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080125183800.D924E1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Fri Jan 25 10:37:58 2008 New Revision: 615303 URL: http://svn.apache.org/viewvc?rev=615303&view=rev Log: [CXF-1405] Move setting up the incoming message into AbstractHTTPDestination so that jetty and servlet should always be consistent. Update JAXRS to properly parse the Accept header Fix a BUNCH of JAXRS tests that were not setting an Accept header so were now getting the default */* on the server side and getting json back. Modified: incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java Modified: incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java Fri Jan 25 10:37:58 2008 @@ -21,6 +21,8 @@ import java.io.IOException; import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Logger; import javax.activation.MimeType; @@ -41,7 +43,7 @@ import org.apache.cxf.phase.Phase; public class JAXRSOutInterceptor extends AbstractOutDatabindingInterceptor { - private static final Logger LOG = LogUtils.getL7dLogger(JAXRSInInterceptor.class); + private static final Logger LOG = LogUtils.getL7dLogger(JAXRSOutInterceptor.class); public JAXRSOutInterceptor() { super(Phase.MARSHAL); @@ -111,16 +113,31 @@ String[] methodMimeTypes = exchange.get(OperationResourceInfo.class).getProduceMimeTypes(); String acceptContentType = (String)exchange.get(Message.ACCEPT_CONTENT_TYPE); + List types = new ArrayList(); if (acceptContentType != null) { - try { - MimeType mt = new MimeType(acceptContentType); - acceptContentType = mt.getBaseType(); - } catch (MimeTypeParseException e) { - // ignore + while (acceptContentType.length() > 0) { + String tp = acceptContentType; + if (acceptContentType.contains(",")) { + tp = acceptContentType.substring(0, acceptContentType.indexOf(',')); + acceptContentType = acceptContentType + .substring(acceptContentType.indexOf(',') + 1).trim(); + } else { + acceptContentType = ""; + } + try { + MimeType mt = new MimeType(tp); + types.add(mt.getBaseType()); + } catch (MimeTypeParseException e) { + // ignore + } } } + if (types.isEmpty()) { + types.add("*/*"); + } - return JAXRSUtils.intersectMimeTypes(methodMimeTypes, acceptContentType); + return JAXRSUtils.intersectMimeTypes(methodMimeTypes, + types.toArray(new String[types.size()])); } private String computeFinalContentTypes(String[] requestContentTypes, EntityProvider provider) { Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java (original) +++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java Fri Jan 25 10:37:58 2008 @@ -19,11 +19,9 @@ package org.apache.cxf.transport.http_jetty; import java.io.IOException; -import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.security.GeneralSecurityException; -import java.security.Principal; import java.util.logging.Level; import java.util.logging.Logger; @@ -34,17 +32,12 @@ import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.common.util.StringUtils; -import org.apache.cxf.helpers.HttpHeaderHelper; import org.apache.cxf.message.ExchangeImpl; -import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageImpl; -import org.apache.cxf.security.SecurityContext; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.ConduitInitiator; import org.apache.cxf.transport.http.AbstractHTTPDestination; import org.apache.cxf.transport.http.HTTPSession; -import org.apache.cxf.transport.https.SSLUtils; import org.apache.cxf.transports.http.QueryHandler; import org.apache.cxf.transports.http.QueryHandlerRegistry; import org.apache.cxf.transports.http.StemMatchingQueryHandler; @@ -172,7 +165,7 @@ return conduitInitiator; } - private String getBasePath(String addr) { + protected String getBasePathForFullAddress(String addr) { try { return new URL(addr).getPath(); } catch (MalformedURLException e) { @@ -193,7 +186,8 @@ // only update the EndpointAddress if the base path is equal // make sure we don't broke the get operation?parament query String address = removeTrailingSeparator(endpointInfo.getAddress()); - if (getBasePath(address).equals(removeTrailingSeparator(getStem(getBasePath(addr))))) { + if (getBasePathForFullAddress(address) + .equals(removeTrailingSeparator(getStem(getBasePathForFullAddress(addr))))) { endpointInfo.setAddress(addr); } return address; @@ -273,41 +267,9 @@ } MessageImpl inMessage = new MessageImpl(); - inMessage.setContent(InputStream.class, req.getInputStream()); - inMessage.put(HTTP_REQUEST, req); - inMessage.put(HTTP_RESPONSE, resp); - inMessage.put(HTTP_CONTEXT, context); - inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod()); - inMessage.put(Message.PATH_INFO, req.getContextPath() + req.getPathInfo()); - String normalizedEncoding = HttpHeaderHelper.mapCharset(req.getCharacterEncoding()); - if (normalizedEncoding == null) { - String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", - LOG, req.getCharacterEncoding()).toString(); - LOG.log(Level.WARNING, m); - throw new IOException(m); - } - inMessage.put(Message.ENCODING, normalizedEncoding); - inMessage.put(Message.QUERY_STRING, req.getQueryString()); - inMessage.put(Message.CONTENT_TYPE, req.getContentType()); - inMessage.put(Message.ACCEPT_CONTENT_TYPE, req.getHeader("Accept")); - if (!StringUtils.isEmpty(endpointInfo.getAddress())) { - inMessage.put(Message.BASE_PATH, new URL(endpointInfo.getAddress()).getPath()); - } - inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder()); - inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE); - inMessage.put(SecurityContext.class, new SecurityContext() { - public Principal getUserPrincipal() { - return req.getUserPrincipal(); - } - public boolean isUserInRole(String role) { - return req.isUserInRole(role); - } - }); + setupMessage(inMessage, context, req, resp); - setHeaders(inMessage); inMessage.setDestination(this); - - SSLUtils.propogateSecureSession(req, inMessage); ExchangeImpl exchange = new ExchangeImpl(); exchange.setInMessage(inMessage); Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original) +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Fri Jan 25 10:37:58 2008 @@ -20,9 +20,12 @@ package org.apache.cxf.transport.http; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.ServerSocket; +import java.net.URL; +import java.security.Principal; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; @@ -33,6 +36,7 @@ import java.util.logging.Level; import java.util.logging.Logger; +import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.namespace.QName; @@ -49,12 +53,14 @@ import org.apache.cxf.io.AbstractWrappedOutputStream; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; +import org.apache.cxf.security.SecurityContext; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.AbstractDestination; import org.apache.cxf.transport.AbstractMultiplexDestination; import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.ConduitInitiator; import org.apache.cxf.transport.http.policy.PolicyUtils; +import org.apache.cxf.transport.https.SSLUtils; import org.apache.cxf.transports.http.configuration.HTTPServerPolicy; import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.ws.policy.Assertor; @@ -225,6 +231,68 @@ } else { response.setContentType(ct); } + } + + protected void setupMessage(Message inMessage, + final ServletContext context, + final HttpServletRequest req, + final HttpServletResponse resp) throws IOException { + + inMessage.setContent(InputStream.class, req.getInputStream()); + inMessage.put(HTTP_REQUEST, req); + inMessage.put(HTTP_RESPONSE, resp); + inMessage.put(HTTP_CONTEXT, context); + inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod()); + String contextPath = req.getContextPath(); + if (contextPath == null) { + contextPath = ""; + } + inMessage.put(Message.PATH_INFO, contextPath + req.getPathInfo()); + + // work around a bug with Jetty which results in the character + // encoding not being trimmed correctly. + String enc = req.getCharacterEncoding(); + if (enc != null && enc.endsWith("\"")) { + enc = enc.substring(0, enc.length() - 1); + } + String normalizedEncoding = HttpHeaderHelper.mapCharset(enc); + if (normalizedEncoding == null) { + String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", + LOG, enc).toString(); + LOG.log(Level.WARNING, m); + throw new IOException(m); + } + + inMessage.put(Message.ENCODING, normalizedEncoding); + + inMessage.put(Message.QUERY_STRING, req.getQueryString()); + inMessage.put(Message.CONTENT_TYPE, req.getContentType()); + inMessage.put(Message.ACCEPT_CONTENT_TYPE, req.getHeader("Accept")); + String basePath = getBasePath(contextPath); + if (!StringUtils.isEmpty(basePath)) { + inMessage.put(Message.BASE_PATH, basePath); + } + inMessage.put(Message.FIXED_PARAMETER_ORDER, isFixedParameterOrder()); + inMessage.put(Message.ASYNC_POST_RESPONSE_DISPATCH, Boolean.TRUE); + inMessage.put(SecurityContext.class, new SecurityContext() { + public Principal getUserPrincipal() { + return req.getUserPrincipal(); + } + public boolean isUserInRole(String role) { + return req.isUserInRole(role); + } + }); + + setHeaders(inMessage); + + SSLUtils.propogateSecureSession(req, inMessage); + } + + protected String getBasePath(String contextPath) throws IOException { + if (StringUtils.isEmpty(endpointInfo.getAddress())) { + return ""; + } + return new URL(endpointInfo.getAddress()).getPath(); } protected static EndpointInfo getAddressValue(EndpointInfo ei) { Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties (original) +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties Fri Jan 25 10:37:58 2008 @@ -23,3 +23,4 @@ NULL_RESPONSE_MSG = Response object is null DECOUPLED_RESPONSE_FAILED_MSG = Decouple response failed MISSING_PATH_INFO = PATH_INFO not present in message context, multiplex id is unavailable. Ensure the portName passed to getCurrentEndpointReferenceId is correct if the service has multiple ports +INVALID_ENCODING_MSG = Invalid character set {0} in request. Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original) +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Fri Jan 25 10:37:58 2008 @@ -19,9 +19,7 @@ package org.apache.cxf.transport.servlet; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; -import java.security.Principal; import java.util.Collection; import java.util.Set; import java.util.logging.Level; @@ -34,15 +32,7 @@ import org.apache.cxf.Bus; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; -import org.apache.cxf.helpers.HttpHeaderHelper; -import org.apache.cxf.message.ExchangeImpl; -import org.apache.cxf.message.Message; -import org.apache.cxf.message.MessageImpl; -import org.apache.cxf.security.SecurityContext; import org.apache.cxf.service.model.EndpointInfo; -import org.apache.cxf.transport.http.AbstractHTTPDestination; -import org.apache.cxf.transport.http.HTTPSession; -import org.apache.cxf.transport.https.SSLUtils; import org.apache.cxf.transports.http.QueryHandler; import org.apache.cxf.transports.http.QueryHandlerRegistry; import org.xmlsoap.schemas.wsdl.http.AddressType; @@ -220,50 +210,13 @@ } try { - MessageImpl inMessage = new MessageImpl(); - inMessage.setContent(InputStream.class, request.getInputStream()); - inMessage.put(AbstractHTTPDestination.HTTP_REQUEST, request); - inMessage.put(AbstractHTTPDestination.HTTP_RESPONSE, response); - inMessage.put(AbstractHTTPDestination.HTTP_CONTEXT, cxfServlet.getServletContext()); - inMessage.put(Message.HTTP_REQUEST_METHOD, request.getMethod()); - inMessage.put(Message.PATH_INFO, request.getPathInfo()); - inMessage.put(Message.QUERY_STRING, request.getQueryString()); - inMessage.put(Message.CONTENT_TYPE, request.getContentType()); - inMessage.put(Message.BASE_PATH, d.getAddress().getAddress().getValue()); - inMessage.put(SecurityContext.class, new SecurityContext() { - public Principal getUserPrincipal() { - return request.getUserPrincipal(); - } - public boolean isUserInRole(String role) { - return request.isUserInRole(role); - } - }); - - // work around a bug with Jetty which results in the character - // encoding not being trimmed correctly. - String enc = request.getCharacterEncoding(); - if (enc != null && enc.endsWith("\"")) { - enc = enc.substring(0, enc.length() - 1); - } - - String normalizedEncoding = HttpHeaderHelper.mapCharset(enc); - if (normalizedEncoding == null) { - String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", - LOG, enc).toString(); - LOG.log(Level.WARNING, m); - throw new IOException(m); - } - - inMessage.put(Message.ENCODING, normalizedEncoding); - SSLUtils.propogateSecureSession(request, inMessage); - - ExchangeImpl exchange = new ExchangeImpl(); - exchange.setInMessage(inMessage); - exchange.setSession(new HTTPSession(request)); - - d.doMessage(inMessage); + d.invoke(cxfServlet.getServletContext(), request, response); } catch (IOException e) { throw new ServletException(e); + } finally { + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Finished servicing http request on thread: " + Thread.currentThread()); + } } } Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java (original) +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java Fri Jan 25 10:37:58 2008 @@ -20,17 +20,22 @@ package org.apache.cxf.transport.servlet; import java.io.IOException; -import java.util.logging.Level; import java.util.logging.Logger; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import org.apache.cxf.Bus; import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.MessageImpl; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.ConduitInitiator; import org.apache.cxf.transport.MessageObserver; import org.apache.cxf.transport.http.AbstractHTTPDestination; +import org.apache.cxf.transport.http.HTTPSession; public class ServletDestination extends AbstractHTTPDestination { @@ -69,20 +74,26 @@ } - protected void doMessage(MessageImpl inMessage) throws IOException { - try { - - setHeaders(inMessage); - - inMessage.setDestination(this); - - incomingObserver.onMessage(inMessage); - - } finally { - if (LOG.isLoggable(Level.FINE)) { - LOG.fine("Finished servicing http request on thread: " + Thread.currentThread()); - } - } + public void invoke(final ServletContext context, + final HttpServletRequest req, + final HttpServletResponse resp) throws IOException { + + MessageImpl inMessage = new MessageImpl(); + setupMessage(inMessage, + context, + req, + resp); + + ExchangeImpl exchange = new ExchangeImpl(); + exchange.setInMessage(inMessage); + exchange.setSession(new HTTPSession(req)); + inMessage.setDestination(this); + + incomingObserver.onMessage(inMessage); + + } + protected String getBasePath(String contextPath) throws IOException { + return contextPath + getAddress().getAddress().getValue(); } @Override Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Fri Jan 25 10:37:58 2008 @@ -22,6 +22,7 @@ import java.io.File; import java.io.InputStream; import java.net.URL; +import java.net.URLConnection; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.FileRequestEntity; @@ -47,7 +48,9 @@ String endpointAddress = "http://localhost:9080/bookstore/books/123"; URL url = new URL(endpointAddress); - InputStream in = url.openStream(); + URLConnection connect = url.openConnection(); + connect.addRequestProperty("Accept", "application/xml"); + InputStream in = connect.getInputStream(); assertNotNull(in); InputStream expected = getClass() @@ -61,7 +64,9 @@ String endpointAddress = "http://localhost:9080/bookstore/booksubresource/123/chapters/1"; URL url = new URL(endpointAddress); - InputStream in = url.openStream(); + URLConnection connect = url.openConnection(); + connect.addRequestProperty("Accept", "application/xml"); + InputStream in = connect.getInputStream(); assertNotNull(in); InputStream expected = getClass() @@ -153,7 +158,9 @@ // Verify result endpointAddress = "http://localhost:9080/bookstore/books/123"; URL url = new URL(endpointAddress); - InputStream in = url.openStream(); + URLConnection connect = url.openConnection(); + connect.addRequestProperty("Accept", "application/xml"); + InputStream in = connect.getInputStream(); assertNotNull(in); InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt"); @@ -227,7 +234,9 @@ // Verify result endpointAddress = "http://localhost:9080/bookstore/books/123"; URL url = new URL(endpointAddress); - InputStream in = url.openStream(); + URLConnection connection = url.openConnection(); + connection.addRequestProperty("Accept", "application/xml"); + InputStream in = connection.getInputStream(); assertNotNull(in); InputStream expected = getClass().getResourceAsStream("resources/expected_update_book.txt"); Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedOutsideBookTest.java Fri Jan 25 10:37:58 2008 @@ -24,6 +24,7 @@ import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; +import java.net.URLConnection; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.io.CachedOutputStream; @@ -44,7 +45,9 @@ String endpointAddress = "http://localhost:9080/bookstore/books/123"; URL url = new URL(endpointAddress); - InputStream in = url.openStream(); + URLConnection connect = url.openConnection(); + connect.addRequestProperty("Accept", "application/xml"); + InputStream in = connect.getInputStream(); assertNotNull(in); InputStream expected = getClass() Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java?rev=615303&r1=615302&r2=615303&view=diff ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringBookTest.java Fri Jan 25 10:37:58 2008 @@ -21,6 +21,7 @@ import java.io.InputStream; import java.net.URL; +import java.net.URLConnection; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.io.CachedOutputStream; @@ -32,7 +33,8 @@ @BeforeClass public static void startServers() throws Exception { - assertTrue("server did not launch correctly", launchServer(BookServerResourceCreatedOutside.class)); + assertTrue("server did not launch correctly", + launchServer(BookServerResourceCreatedOutside.class)); } @Test @@ -41,7 +43,9 @@ String endpointAddress = "http://localhost:9080/bookstore/books/123"; URL url = new URL(endpointAddress); - InputStream in = url.openStream(); + URLConnection connect = url.openConnection(); + connect.addRequestProperty("Accept", "application/xml"); + InputStream in = connect.getInputStream(); assertNotNull(in); InputStream expected = getClass()