appName = $appName;
$this->request = $request;
// default responders
$this->responders = [
'json' => function ($data) {
if ($data instanceof DataResponse) {
$response = new JSONResponse(
$data->getData(),
$data->getStatus()
);
$dataHeaders = $data->getHeaders();
$headers = $response->getHeaders();
// do not overwrite Content-Type if it already exists
if (isset($dataHeaders['Content-Type'])) {
unset($headers['Content-Type']);
}
$response->setHeaders(array_merge($dataHeaders, $headers));
if ($data->getETag() !== null) {
$response->setETag($data->getETag());
}
if ($data->getLastModified() !== null) {
$response->setLastModified($data->getLastModified());
}
if ($data->isThrottled()) {
$response->throttle($data->getThrottleMetadata());
}
return $response;
}
return new JSONResponse($data);
}
];
}
/**
* Parses an HTTP accept header and returns the supported responder type
* @param string $acceptHeader
* @param string $default
* @return string the responder type
* @since 7.0.0
* @since 9.1.0 Added default parameter
*/
public function getResponderByHTTPHeader($acceptHeader, $default = 'json') {
$headers = explode(',', $acceptHeader);
// return the first matching responder
foreach ($headers as $header) {
$header = strtolower(trim($header));
$responder = str_replace('application/', '', $header);
if (array_key_exists($responder, $this->responders)) {
return $responder;
}
}
// no matching header return default
return $default;
}
/**
* Registers a formatter for a type
* @param string $format
* @param \Closure $responder
* @since 7.0.0
*/
protected function registerResponder($format, \Closure $responder) {
$this->responders[$format] = $responder;
}
/**
* Serializes and formats a response
* @param mixed $response the value that was returned from a controller and
* is not a Response instance
* @param string $format the format for which a formatter has been registered
* @throws \DomainException if format does not match a registered formatter
* @return Response
* @since 7.0.0
*/
public function buildResponse($response, $format = 'json') {
if (array_key_exists($format, $this->responders)) {
$responder = $this->responders[$format];
return $responder($response);
}
throw new \DomainException('No responder registered for format '
. $format . '!');
}
}
ions'>fop-0_14_0_regions
Apache XML Graphics FOP: https://github.com/apache/xmlgraphics-fop
<?xml version="1.0" encoding="UTF-8"?><!-- 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.--><!-- $Id$ --><testcase><info><p>Thistestchecksmarkersandfont-sizeinheritance.
Thisiscurrentlyincorrectlyhandledinthatforrelativefontsizes
thebasevalueofthefo:markercontextisusedandnotthefontsize
fromthefo:retrieve-markercontext.
</p></info><fo><fo:rootxmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:layout-master-set><fo:simple-page-mastermaster-name="normal"page-width="5in"page-height="5in"><fo:region-bodymargin-top="1in"margin-bottom="1in"/><fo:region-beforeextent="1in"/><fo:region-afterextent="1in"/></fo:simple-page-master></fo:layout-master-set><fo:page-sequencemaster-reference="normal"><fo:static-contentflow-name="xsl-region-before"><fo:blockbackground-color="yellow"font-size="16pt">1.Marker<fo:retrieve-markerretrieve-class-name="m1"retrieve-boundary="page"retrieve-position="first-starting-within-page"/></fo:block></fo:static-content><fo:static-contentflow-name="xsl-region-after"><fo:blockbackground-color="yellow"font-size="10pt">2.Marker<fo:retrieve-markerretrieve-class-name="m2"/></fo:block></fo:static-content><fo:flowflow-name="xsl-region-body"><fo:blockbackground-color="red"><fo:markermarker-class-name="m1"><fo:blockfont-size=".5em">Firstmarkerwithsmallfont</fo:block></fo:marker></fo:block><fo:blockbackground-color="green"><fo:markermarker-class-name="m2"><fo:blockfont-size="2em">Secondmarkerbigfont
</fo:block></fo:marker></fo:block></fo:flow></fo:page-sequence></fo:root></fo><checks><!-- font-size relative to the retrieve-marker context? --><evalexpected="8000"xpath="//regionBefore/block[1]/block/lineArea/text/@font-size"/><evalexpected="20000"xpath="//regionAfter/block[1]/block/lineArea/text/@font-size"/></checks></testcase>