This accidently has two files related to the javascript project mixed in to the 2.0.4-ish http header fixes.
> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Monday, December 03, 2007 7:44 PM > To: [EMAIL PROTECTED] > Subject: svn commit: r600749 - in /incubator/cxf/trunk: > common/common/src/main/java/org/apache/cxf/helpers/ > common/common/src/test/java/org/apache/cxf/helpers/ > rt/javascript/src/main/java/org/apache/cxf/javascript/ > rt/javascript/src/test/resources/ rt/transport... > > Author: bimargulies > Date: Mon Dec 3 16:44:10 2007 > New Revision: 600749 > > URL: http://svn.apache.org/viewvc?rev=600749&view=rev > Log: > Fix 1227 some more, and don't just ignore bogus charsets. Complain. > > Added: > > incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf > /javascript/JavascriptPrefix.java > Modified: > > incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf > /helpers/HttpHeaderHelper.java > > incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf > /helpers/HttpHeaderHelperTest.java > > incubator/cxf/trunk/rt/javascript/src/test/resources/logging.p > roperties > > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org /apache/cxf/transport/http_jetty/JettyHTTPDestination.java > > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org > /apache/cxf/transport/http_jetty/Messages.properties > > incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org /apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java > > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/http/HTTPConduit.java > > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/http/Messages.properties > > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/servlet/Messages.properties > > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/servlet/ServletController.java > > Modified: > incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf > /helpers/HttpHeaderHelper.java > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common > /src/main/java/org/apache/cxf/helpers/HttpHeaderHelper.java?re > v=600749&r1=600748&r2=600749&view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf > /helpers/HttpHeaderHelper.java (original) > +++ > incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpe > +++ rs/HttpHeaderHelper.java Mon Dec 3 16:44:10 2007 > @@ -74,6 +74,10 @@ > if (enc == null) { > return null; > } > + // Charsets can be quoted. But it's quite certain > that they can't have escaped quoted or > + // anything like that. > + enc = enc.replace("\"", ""); > + enc = enc.replace("'", ""); > String newenc = encodings.get(enc); > if (newenc == null) { > try { > > Modified: > incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf > /helpers/HttpHeaderHelperTest.java > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common > /src/test/java/org/apache/cxf/helpers/HttpHeaderHelperTest.jav > a?rev=600749&r1=600748&r2=600749&view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf > /helpers/HttpHeaderHelperTest.java (original) > +++ > incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/helpe > +++ rs/HttpHeaderHelperTest.java Mon Dec 3 16:44:10 2007 > @@ -36,6 +36,10 @@ > assertEquals(Charset.forName("utf-8").name(), cs); > cs = HttpHeaderHelper.mapCharset(null); > assertNull(cs); > + cs = HttpHeaderHelper.mapCharset("\"utf-8\""); > + assertEquals(Charset.forName("utf-8").name(), cs); > + cs = HttpHeaderHelper.mapCharset("'utf-8'"); > + assertEquals(Charset.forName("utf-8").name(), cs); > } > > } > > Added: > incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf > /javascript/JavascriptPrefix.java > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript > /src/main/java/org/apache/cxf/javascript/JavascriptPrefix.java > ?rev=600749&view=auto > ============================================================== > ================ > --- > incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf > /javascript/JavascriptPrefix.java (added) > +++ > incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javas > +++ cript/JavascriptPrefix.java Mon Dec 3 16:44:10 2007 > @@ -0,0 +1,40 @@ > +/** > + * Licensed to the Apache Software Foundation (ASF) under one > + * or more contributor license agreements. See the NOTICE file > + * distributed with this work for additional information > + * regarding copyright ownership. The ASF licenses this file > + * to you under the Apache License, Version 2.0 (the > + * "License"); you may not use this file except in compliance > + * with the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, > + * software distributed under the License is distributed on an > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > + * KIND, either express or implied. See the License for the > + * specific language governing permissions and limitations > + * under the License. > + */ > + > +package org.apache.cxf.javascript; > + > +import java.lang.annotation.ElementType; import > +java.lang.annotation.Retention; import > +java.lang.annotation.RetentionPolicy; > +import java.lang.annotation.Target; > + > +/** > + * Use this annotation to control the names of Javascript > objects associated with this package. > + * Use this with a JAXB XmlSchema annotation or the equivalent for > +another data binding to associate > + * a namespace with the package. > + */ > [EMAIL PROTECTED](RetentionPolicy.RUNTIME) > [EMAIL PROTECTED](ElementType.PACKAGE) > +public @interface JavascriptPrefix { > + /** > + * The name prefix for this package's namespace. > + * @return > + */ > + String prefix() default ""; > +} > > Modified: > incubator/cxf/trunk/rt/javascript/src/test/resources/logging.p > roperties > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript > /src/test/resources/logging.properties?rev=600749&r1=600748&r2 > =600749&view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/rt/javascript/src/test/resources/logging.p > roperties (original) > +++ > incubator/cxf/trunk/rt/javascript/src/test/resources/logging.propert > +++ ies Mon Dec 3 16:44:10 2007 > @@ -23,8 +23,8 @@ > .level= INFO > java.util.logging.ConsoleHandler.level = FINEST > java.util.logging.ConsoleHandler.formatter = > java.util.logging.SimpleFormatter > -org.apache.cxf.javascript.service.ServiceJavascriptBuilder.le > vel=FINEST > -org.apache.cxf.javascript.types.SchemaJavascriptBuilder.level=FINEST > +#org.apache.cxf.javascript.service.ServiceJavascriptBuilder.l > evel=FINES > +T > #org.apache.cxf.javascript.types.SchemaJavascriptBuilder.level=FINEST > #org.apache.cxf.javascript.JavascriptTestUtilities.level=FINE > #org.apache.cxf.javascript.JsXMLHttpRequest.level = FINE > #org.apache.cxf.javascript.service.DocLitWrappedTest.level=FINE > > 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=600749&r1=600748&r2=600749&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/apach > +++ e/cxf/transport/http_jetty/JettyHTTPDestination.java Mon Dec 3 > +++ 16:44:10 2007 > @@ -255,7 +255,14 @@ > inMessage.put(HTTP_RESPONSE, resp); > inMessage.put(Message.HTTP_REQUEST_METHOD, > req.getMethod()); > inMessage.put(Message.PATH_INFO, > req.getContextPath() + req.getPathInfo()); > - inMessage.put(Message.ENCODING, > HttpHeaderHelper.mapCharset(req.getCharacterEncoding())); > + 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()); > if (!StringUtils.isEmpty(endpointInfo.getAddress())) { > > Modified: > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org > /apache/cxf/transport/http_jetty/Messages.properties > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports > /http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ > Messages.properties?rev=600749&r1=600748&r2=600749&view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org > /apache/cxf/transport/http_jetty/Messages.properties (original) > +++ > incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apach > +++ e/cxf/transport/http_jetty/Messages.properties Mon Dec 3 > 16:44:10 > +++ 2007 > @@ -24,3 +24,4 @@ > CAN_NOT_FIND_HANDLER_MSG = Could not find the handler to > remove for context url {0} FAILED_TO_SHUTDOWN_ENGINE_MSG = > Failed to shutdown Jetty server on port {0,number,####0} > because it is still in use UNKNOWN_CONNECTOR_MSG = Unknown > connector type {0}, can't set the socket reuseAddress flag. > +INVALID_ENCODING_MSG = Invalid character set {0} in request. > \ No newline at end of file > > Modified: > incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org /apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports > /http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/ > JettyHTTPServerEngineTest.java?rev=600749&r1=600748&r2=600749& > view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org /apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java (original) > +++ > incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apach > +++ e/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java > Mon Dec 3 > +++ 16:44:10 2007 > @@ -123,7 +123,7 @@ > engine.setPort(9000); > try { > engine.finalizeConfig(); > - fail("We should get the connector not set with > TSLServerParament exception "); > + fail("We should get the connector not set with > + TSLServerParameter exception."); > } catch (Exception ex) { > // expect the excepion > } > @@ -135,9 +135,9 @@ > engine.setPort(9000); > try { > engine.finalizeConfig(); > - fail("We should get the connector not set right > port exception "); > + fail("We should get the connector not set right port > + exception."); > } catch (Exception ex) { > - // expect the excepion > + // expect the exception > } > > engine = new JettyHTTPServerEngine(); @@ -146,15 +146,9 @@ > engine.setConnector(conn); > engine.setPort(9003); > engine.setTlsServerParameters(new TLSServerParameters()); > - try { > - engine.finalizeConfig(); > - } catch (Exception ex) { > - fail("We should not throw exception here"); > - } > + engine.finalizeConfig(); > } > > - > - > @Test > public void testaddServants() throws Exception { > String urlStr = "http://localhost:9234/hello/test"; > @@ -165,28 +159,16 @@ > JettyHTTPTestHandler handler2 = new > JettyHTTPTestHandler("string2"); > engine.addServant(new URL(urlStr), handler1); > String response = null; > - try { > - response = getResponse(urlStr); > - } catch (Exception ex) { > - fail("Can't get the response from the server " + ex); > - } > + response = getResponse(urlStr); > assertEquals("The jetty http handler did not take > effect", response, "string1"); > > engine.addServant(new URL(urlStr), handler2); > - try { > - response = getResponse(urlStr); > - } catch (Exception ex) { > - fail("Can't get the response from the server " + ex); > - } > + response = getResponse(urlStr); > assertEquals("The jetty http handler did not take > effect", response, "string1string2"); > engine.addServant(new URL(urlStr2), handler2); > engine.removeServant(new URL(urlStr)); > engine.shutdown(); > - try { > - response = getResponse(urlStr2); > - } catch (Exception ex) { > - fail("Server should still work, even if we call > the shutdown" + ex); > - } > + response = getResponse(urlStr2); > assertEquals("The jetty http handler did not take > effect", response, "string2"); > // set the get request > factory.destroyForPort(9234); > @@ -256,5 +238,4 @@ > IOUtils.copy(in, buffer); > return buffer.toString(); > } > - > } > > Modified: > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/http/HTTPConduit.java > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports > /http/src/main/java/org/apache/cxf/transport/http/HTTPConduit. > java?rev=600749&r1=600748&r2=600749&view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/http/HTTPConduit.java (original) > +++ > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/ > +++ transport/http/HTTPConduit.java Mon Dec 3 16:44:10 2007 > @@ -1927,8 +1927,17 @@ > enc = enc.substring(0, enc.indexOf(";")); > } > } > - inMessage.put(Message.ENCODING, > HttpHeaderHelper.mapCharset(enc)); > > + 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); > + > if (maintainSession) { > String cookieStr = > connection.getHeaderField("Set-Cookie"); > sessionCookies = > Cookie.handleSetCookie(sessionCookies, cookieStr); > > Modified: > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/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.pro > perties?rev=600749&r1=600748&r2=600749&view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/http/Messages.properties (original) > +++ > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/ > +++ transport/http/Messages.properties Mon Dec 3 16:44:10 2007 > @@ -19,6 +19,7 @@ > # > # > UNEXPECTED_RESPONSE_TYPE_MSG = Unexpected response type {0} > +INVALID_ENCODING_MSG = Invalid character set {0} in request. > 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 > > Modified: > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/servlet/Messages.properties > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports > /http/src/main/java/org/apache/cxf/transport/servlet/Messages. > properties?rev=600749&r1=600748&r2=600749&view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/servlet/Messages.properties (original) > +++ > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/ > +++ transport/servlet/Messages.properties Mon Dec 3 16:44:10 2007 > @@ -26,3 +26,4 @@ > UNEXPECTED_RESPONSE_TYPE_MSG = Unexpected response type {0} > DECOUPLED_RESPONSE_FAILED_MSG = Decouple response failed > FAILED_TO_LOAD_SPRING_BUS = Failed to load the spring bus: {0} > +INVALID_ENCODING_MSG = Invalid character set {0} in request. > > Modified: > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/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/ServletCo > ntroller.java?rev=600749&r1=600748&r2=600749&view=diff > ============================================================== > ================ > --- > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apach > e/cxf/transport/servlet/ServletController.java (original) > +++ > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/ > +++ transport/servlet/ServletController.java Mon Dec 3 16:44:10 2007 > @@ -245,8 +245,16 @@ > 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, > HttpHeaderHelper.mapCharset(enc)); > + inMessage.put(Message.ENCODING, normalizedEncoding); > SSLUtils.propogateSecureSession(request, inMessage); > > ExchangeImpl exchange = new ExchangeImpl(); > > >
