Source:
<code>public Void writeContent(HttpServletRequest req, HttpServletResponse resp) { Maybe<ApplicationConfiguration> possibleConfig; try { possibleConfig = appConfigFetcher.configurationFor(req); } catch (ApiKeyNotFoundException | RevokedApiKeyException | InvalidIpForApiKeyException e1) { return error(resp, HttpStatusCode.FORBIDDEN.code()); } if (possibleConfig.isNothing()) { return error(resp, HttpStatus.UNAUTHORIZED.value()); } Topic topic; try { topic = complexify(deserialize(new InputStreamReader(req.getInputStream()))); } catch (IOException ioe) { log.error("Error reading input for request " + req.getRequestURL(), ioe); return error(resp, HttpStatusCode.SERVER_ERROR.code()); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); return error(resp, HttpStatusCode.BAD_REQUEST.code()); } if (!possibleConfig.requireValue().canWrite(topic.getPublisher())) { return error(resp, HttpStatusCode.FORBIDDEN.code()); } if (Strings.isNullOrEmpty(topic.getNamespace()) || Strings.isNullOrEmpty(topic.getValue())) { return error(resp, HttpStatusCode.BAD_REQUEST.code()); } try { topic = merge(resolveExisting(topic), topic); store.write(topic); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); return error(resp, HttpStatusCode.SERVER_ERROR.code()); } String hostName = Configurer.get("local.host.name").get(); resp.setHeader( HttpHeaders.LOCATION, hostName <START> + "/3.0/content.json?id=" <END> + codec.encode(BigInteger.valueOf(topic.getId()))); resp.setStatus(HttpStatusCode.OK.code()); resp.setContentLength(0); return null; }</code><technical_language>topic</technical_language>

Target:
public Void writeContent(HttpServletRequest req, HttpServletResponse resp) { Maybe<ApplicationConfiguration> possibleConfig; try { possibleConfig = appConfigFetcher.configurationFor(req); } catch (ApiKeyNotFoundException | RevokedApiKeyException | InvalidIpForApiKeyException e1) { return error(resp, HttpStatusCode.FORBIDDEN.code()); } if (possibleConfig.isNothing()) { return error(resp, HttpStatus.UNAUTHORIZED.value()); } Topic topic; try { topic = complexify(deserialize(new InputStreamReader(req.getInputStream()))); } catch (IOException ioe) { log.error("Error reading input for request " + req.getRequestURL(), ioe); return error(resp, HttpStatusCode.SERVER_ERROR.code()); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); return error(resp, HttpStatusCode.BAD_REQUEST.code()); } if (!possibleConfig.requireValue().canWrite(topic.getPublisher())) { return error(resp, HttpStatusCode.FORBIDDEN.code()); } if (Strings.isNullOrEmpty(topic.getNamespace()) || Strings.isNullOrEmpty(topic.getValue())) { return error(resp, HttpStatusCode.BAD_REQUEST.code()); } try { topic = merge(resolveExisting(topic), topic); store.write(topic); } catch (Exception e) { log.error("Error reading input for request " + req.getRequestURL(), e); return error(resp, HttpStatusCode.SERVER_ERROR.code()); } String hostName = Configurer.get("local.host.name").get(); resp.setHeader( HttpHeaders.LOCATION, hostName + "/3.0/topic.json?id=" + codec.encode(BigInteger.valueOf(topic.getId()))); resp.setStatus(HttpStatusCode.OK.code()); resp.setContentLength(0); return null; }