Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid closing entityStream in JsonBProvider
This is required by the spec (see MBW's javadoc) that we must not close the entity stream in the writeTo method. The toJson(obj, stream) method will always close the stream, so this cannot be used. This commit includes a test case that verifies that the client response filter is only called once per response. The prior behavior invoked the filter twice - once as a result of the toJson(obj, stream) method closing the stream and again when the response was actually processed.
- Loading branch information
Showing
9 changed files
with
155 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...e.rest.client_fat/test-applications/basicRemoteApp/src/remoteApp/basic/LoggingFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
*******************************************************************************/ | ||
package remoteApp.basic; | ||
|
||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
|
||
import javax.ws.rs.container.ContainerRequestContext; | ||
import javax.ws.rs.container.ContainerRequestFilter; | ||
import javax.ws.rs.container.ContainerResponseContext; | ||
import javax.ws.rs.container.ContainerResponseFilter; | ||
import javax.ws.rs.ext.Provider; | ||
|
||
@Provider | ||
public class LoggingFilter implements ContainerRequestFilter, ContainerResponseFilter { | ||
|
||
private static Logger LOG = Logger.getLogger(LoggingFilter.class.getName()); | ||
|
||
@Override | ||
public void filter(ContainerRequestContext arg0) throws IOException { | ||
LOG.info("incoming request " + arg0.getMethod() + " " + arg0.getUriInfo().getPath()); | ||
} | ||
|
||
@Override | ||
public void filter(ContainerRequestContext arg0, ContainerResponseContext arg1) throws IOException { | ||
LOG.info("outgoing response " + arg0.getMethod() + " " + arg0.getUriInfo().getPath() + " " + | ||
arg1.getStatus() + " " + arg1.getEntity()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters