/** * Create {@link DeploymentException} with message concatenated from collected exceptions. * * @return comprehensive exception. */ public DeploymentException composeComprehensiveException() { StringBuilder sb = new StringBuilder(); for (Exception exception : exceptionsToPublish) { sb.append(exception.getMessage()); sb.append("\n"); } return new DeploymentException(sb.toString()); }
private void checkPublic(Method m) throws DeploymentException { if (!Modifier.isPublic(m.getModifiers())) { throw new DeploymentException(sm.getString( "pojoMethodMapping.methodNotPublic", m.getName())); } }
private void checkPublic(Method m) throws DeploymentException { if (!Modifier.isPublic(m.getModifiers())) { throw new DeploymentException(sm.getString( "pojoMethodMapping.methodNotPublic", m.getName())); } }
private void parseStatus(String line) throws DeploymentException { // This client only understands HTTP 1.1 // RFC2616 is case specific if (!line.startsWith("HTTP/1.1 101")) { throw new DeploymentException(sm.getString( "wsWebSocketContainer.invalidStatus", line)); } }
private void parseStatus(String line) throws DeploymentException { // This client only understands HTTP 1.1 // RFC2616 is case specific if (!line.startsWith("HTTP/1.1 101")) { throw new DeploymentException(MESSAGES.invalidHttpStatus(line)); } }
private void checkPublic(Method m) throws DeploymentException { if (!Modifier.isPublic(m.getModifiers())) { throw new DeploymentException(sm.getString( "pojoMethodMapping.methodNotPublic", m.getName())); } }
private void checkPublic(Method m) throws DeploymentException { if (!Modifier.isPublic(m.getModifiers())) { throw new DeploymentException(MESSAGES.methodNotPublic(m.getName())); } }
private void checkPublic(Method m) throws DeploymentException { if (!Modifier.isPublic(m.getModifiers())) { throw new DeploymentException(sm.getString( "pojoMethodMapping.methodNotPublic", m.getName())); } }
private static void validateEncoders(Class<? extends Encoder>[] encoders) throws DeploymentException { for (Class<? extends Encoder> encoder : encoders) { // Need to instantiate decoder to ensure it is valid and that deployment can be failed if it is not @SuppressWarnings("unused") Encoder instance; try { encoder.getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new DeploymentException(sm.getString("serverContainer.encoderFail", encoder.getName()), e); } } }
private ServerApplicationConfig getServerApplicationConfig(ClientEndpointConfig clientEndpointConfig) throws DeploymentException { final Object o = clientEndpointConfig.getUserProperties().get(SERVER_CONFIG); if (o != null && o instanceof ServerApplicationConfig) { return (ServerApplicationConfig) o; } throw new DeploymentException("ServerApplicationConfig not present."); }
private SocketAddress getServerAddress(URI uri) throws DeploymentException { int port = Utils.getWsPort(uri); try { return new InetSocketAddress(uri.getHost(), port); } catch (IllegalArgumentException e) { throw new DeploymentException(e.getMessage(), e); } }
@Override public Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException { Object pojo; try { pojo = annotatedEndpointClass.newInstance(); } catch (InstantiationException e) { throw new DeploymentException(MESSAGES.endpointCreateFailed(annotatedEndpointClass.getName()), e); } catch (IllegalAccessException e) { throw new DeploymentException(MESSAGES.endpointCreateFailed(annotatedEndpointClass.getName()), e); } return connectToServer(pojo, path); }
@Override public Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException { Object pojo; try { pojo = annotatedEndpointClass.getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new DeploymentException(sm.getString( "wsWebSocketContainer.endpointCreateFail", annotatedEndpointClass.getName()), e); } return connectToServer(pojo, path); }
@Override public Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException { Object pojo; try { pojo = annotatedEndpointClass.getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new DeploymentException(sm.getString( "wsWebSocketContainer.endpointCreateFail", annotatedEndpointClass.getName()), e); } return connectToServer(pojo, path); }
@Override public Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException { Object pojo; try { pojo = annotatedEndpointClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new DeploymentException(sm.getString( "wsWebSocketContainer.endpointCreateFail", annotatedEndpointClass.getName()), e); } return connectToServer(pojo, path); }
private void checkOnMessageReturnType(Method method) { Class<?> returnType = method.getReturnType(); if (returnType != void.class && returnType != String.class && returnType != ByteBuffer.class && returnType != byte[].class && !returnType.isPrimitive() && checkEncoders(returnType) && !PrimitivesToWrappers.isPrimitiveWrapper(returnType)) { logDeploymentException(new DeploymentException( LocalizationMessages.CLASS_CHECKER_FORBIDDEN_RETURN_TYPE(annotatedClass.getName(), method.getName()) )); } }
private void checkOnMessageReturnType(Method method) { Class<?> returnType = method.getReturnType(); if (returnType != void.class && returnType != String.class && returnType != ByteBuffer.class && returnType != byte[].class && !returnType.isPrimitive() && checkEncoders(returnType) && !PrimitivesToWrappers.isPrimitiveWrapper(returnType)) { logDeploymentException(new DeploymentException( LocalizationMessages.CLASS_CHECKER_FORBIDDEN_RETURN_TYPE(annotatedClass.getName(), method.getName()) )); } }
private void checkPath(WebSocketApplication app) throws DeploymentException { for (WebSocketApplication webSocketApplication : applications) { if (Match.isEquivalent(app.getPath(), webSocketApplication.getPath())) { throw new DeploymentException(String.format( "Found Equivalent paths. Added path: '%s' is equivalent with '%s'.", app.getPath(), webSocketApplication.getPath())); } } }
private void checkPath(TyrusEndpointWrapper endpoint) throws DeploymentException { for (TyrusEndpointWrapper endpointWrapper : endpointWrappers) { if (Match.isEquivalent(endpoint.getEndpointPath(), endpointWrapper.getEndpointPath())) { throw new DeploymentException(LocalizationMessages.EQUIVALENT_PATHS(endpoint.getEndpointPath(), endpointWrapper.getEndpointPath())); } } }
private void checkPath(TyrusEndpointWrapper endpoint) throws DeploymentException { for (TyrusEndpointWrapper endpointWrapper : endpointWrappers) { if (Match.isEquivalent(endpoint.getEndpointPath(), endpointWrapper.getEndpointPath())) { throw new DeploymentException(LocalizationMessages.EQUIVALENT_PATHS(endpoint.getEndpointPath(), endpointWrapper.getEndpointPath())); } } }