
com.adobe.aemds.guide.utils.GuideStringWriterResponse Maven / Gradle / Ivy
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2015 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/
package com.adobe.aemds.guide.utils;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* @pad.exclude Exclude from Published API.
* Wraps a {@link SlingHttpServletResponse} to buffer the output for further processing.
*/
// Todo to align this and submit utils CustomResponse
class GuideStringWriterResponse extends SlingHttpServletResponseWrapper {
private StringWriter stringWriter = new StringWriter();
private PrintWriter printWriter = new PrintWriter(stringWriter);
public GuideStringWriterResponse(SlingHttpServletResponse slingHttpServletResponse) {
super(slingHttpServletResponse);
}
public PrintWriter getWriter() {
return printWriter;
}
public String getString() {
return stringWriter.toString();
}
public void clearWriter() {
printWriter.close();
stringWriter = new StringWriter();
printWriter = new PrintWriter(stringWriter);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy