use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class SchemaResourceResolver method resolveResource.
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
Message msg = new Message("RESOLVE_SCHEMA", LOG, namespaceURI, systemId, baseURI);
LOG.log(Level.FINE, msg.toString());
if (NSFILEMAP.containsKey(namespaceURI)) {
return loadLSInput(namespaceURI);
}
LSInput lsin = null;
String resURL = null;
if (systemId != null) {
String schemaLocation = "";
if (baseURI != null) {
schemaLocation = baseURI.substring(0, baseURI.lastIndexOf('/') + 1);
}
if (systemId.indexOf("http://") < 0) {
resURL = schemaLocation + systemId;
} else {
resURL = systemId;
}
} else if (namespaceURI != null) {
resURL = namespaceURI;
}
if (resURL == null) {
return null;
}
String localFile = resURL;
if (resURL.startsWith("http://")) {
String filename = NSFILEMAP.get(resURL);
if (filename != null) {
localFile = ToolConstants.CXF_SCHEMAS_DIR_INJAR + filename;
}
}
try {
msg = new Message("RESOLVE_FROM_LOCAL", LOG, localFile);
LOG.log(Level.FINE, msg.toString());
@SuppressWarnings("resource") final URIResolver resolver = new URIResolver(localFile);
if (resolver.isResolved()) {
lsin = new LSInputImpl();
lsin.setSystemId(localFile);
lsin.setByteStream(resolver.getInputStream());
}
} catch (IOException e) {
return null;
}
return lsin;
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class UndertowHTTPServerEngine method addServant.
@Override
public void addServant(URL url, UndertowHTTPHandler handler) {
if (shouldCheckUrl(handler.getBus())) {
checkRegistedContext(url);
}
if (server == null) {
try {
// create a new undertow server instance if there is no server there
String contextName = HttpUriMapper.getContextName(url.getPath());
servletContext = buildServletContext(contextName);
handler.setServletContext(servletContext);
server = createServer(url, handler);
server.start();
} catch (Exception e) {
LOG.log(Level.SEVERE, "START_UP_SERVER_FAILED_MSG", new Object[] { e.getMessage(), port });
// problem starting server
try {
server.stop();
} catch (Exception ex) {
// ignore - probably wasn't fully started anyway
}
server = null;
throw new Fault(new Message("START_UP_SERVER_FAILED_MSG", LOG, e.getMessage(), port), e);
}
} else {
String contextName = HttpUriMapper.getContextName(url.getPath());
try {
servletContext = buildServletContext(contextName);
} catch (ServletException e) {
throw new Fault(new Message("START_UP_SERVER_FAILED_MSG", LOG, e.getMessage(), port), e);
}
handler.setServletContext(servletContext);
if (handler.isContextMatchExact()) {
path.addExactPath(url.getPath(), handler);
} else {
path.addPrefixPath(url.getPath(), handler);
}
}
final String smap = HttpUriMapper.getResourceBase(url.getPath());
handler.setName(smap);
registedPaths.put(url.getPath(), handler);
servantCount = servantCount + 1;
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class NettyHttpServletHandler method channelRead.
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
HttpRequest request = (HttpRequest) msg;
if (HttpUtil.is100ContinueExpected(request)) {
ctx.write(new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE));
}
// find the nettyHttpContextHandler by lookup the request url
NettyHttpContextHandler nettyHttpContextHandler = pipelineFactory.getNettyHttpHandler(request.uri());
if (nettyHttpContextHandler != null) {
handleHttpServletRequest(ctx, request, nettyHttpContextHandler);
} else {
throw new RuntimeException(new Fault(new Message("NO_NETTY_SERVLET_HANDLER_FOUND", LOG, request.uri())));
}
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class WSPolicyFeature method resolveReference.
Policy resolveReference(PolicyReference ref, PolicyBuilder builder, Bus bus, DescriptionInfo i) {
final Policy p;
if (!ref.getURI().startsWith("#")) {
String base = i == null ? null : i.getBaseURI();
p = resolveExternal(ref, base, bus);
} else {
p = resolveLocal(ref, bus, i);
}
if (null == p) {
throw new PolicyException(new Message("UNRESOLVED_POLICY_REFERENCE_EXC", BUNDLE, ref.getURI()));
}
return p;
}
use of org.apache.cxf.common.i18n.Message in project cxf by apache.
the class AbstractTokenInterceptor method policyNotAsserted.
protected void policyNotAsserted(AbstractToken assertion, String reason, SoapMessage message) {
if (assertion == null) {
return;
}
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
Collection<AssertionInfo> ais = aim.get(assertion.getName());
if (ais != null) {
for (AssertionInfo ai : ais) {
if (ai.getAssertion() == assertion) {
ai.setNotAsserted(reason);
}
}
}
if (!assertion.isOptional()) {
throw new PolicyException(new Message(reason, LOG));
}
}
Aggregations