Skip to content

Commit

Permalink
CXF-8894: Unimplemented getRequestCharacterEncoding() - use org.eclip…
Browse files Browse the repository at this point in the history
…se.jetty.servlet.ServletContextHandler
  • Loading branch information
reta committed Sep 22, 2023
1 parent 2b8a745 commit 176e469
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* 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.transport.http_jetty;

import org.eclipse.jetty.server.handler.ContextHandler;

/**
* The Jetty-specific ContextHandler
*/
class JettyContextHandler extends ContextHandler {
JettyContextHandler() {
super(null, null, null);
_scontext = new JettyContext();
}

class JettyContext extends Context {
@Override
public String getRequestCharacterEncoding() {
return getDefaultRequestCharacterEncoding();
}

@Override
public void setRequestCharacterEncoding(String encoding) {
if (!isStarting()) {
throw new IllegalStateException();
}

setDefaultRequestCharacterEncoding(encoding);
}

@Override
public String getResponseCharacterEncoding() {
return getDefaultResponseCharacterEncoding();
}

@Override
public void setResponseCharacterEncoding(String encoding) {
if (!isStarting()) {
throw new IllegalStateException();
}

setDefaultResponseCharacterEncoding(encoding);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public JettyHTTPHandler(JettyHTTPDestination jhd, boolean cmExact) {
contextMatchExact = cmExact;
jettyHTTPDestination = jhd;
}

public JettyHTTPHandler(Bus bus) {
this.bus = bus;
}
Expand Down Expand Up @@ -84,7 +85,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
}

public ContextHandler createContextHandler() {
return new ContextHandler();
return new JettyContextHandler();
}

public Bus getBus() {
Expand Down

0 comments on commit 176e469

Please sign in to comment.