/** * @return the whiteList configured on this policy instance. */ public String getWhiteList() { return StringUtil.joinStringList(whiteList, ","); }
/** * @return the blackList configured on this policy instance. */ public String getBlackList() { return StringUtil.joinStringList(blackList, ","); }
/** * @return the blackList configured on this policy instance. */ public String getBlackList() { return StringUtil.joinStringList(blackList, ","); }
/** * @return the whiteList configured on this policy instance. */ public String getWhiteList() { return StringUtil.joinStringList(whiteList, ","); }
/** * @return the blackList configured on this policy instance. */ public String getBlackList() { return StringUtil.joinStringList(blackList, ","); }
/** * @return the whiteList configured on this policy instance. */ public String getWhiteList() { return StringUtil.joinStringList(whiteList, ","); }
/** * @return the whiteList configured on this policy instance. */ public String getWhiteList() { return StringUtil.joinStringList(whiteList, ","); }
/** * @return the whiteList configured on this policy instance. */ public String getWhiteList() { return StringUtil.joinStringList(whiteList, ","); }
/** * @return the blackList configured on this policy instance. */ public String getBlackList() { return StringUtil.joinStringList(blackList, ","); }
/** * @return the whiteList configured on this policy instance. */ public String getWhiteList() { return StringUtil.joinStringList(whiteList, ","); }
/** * @return the blackList configured on this policy instance. */ public String getBlackList() { return StringUtil.joinStringList(blackList, ","); }
/** * @return the whiteList configured on this policy instance. */ public String getWhiteList() { return StringUtil.joinStringList(whiteList, ","); }
/** * @return the blackList configured on this policy instance. */ public String getBlackList() { return StringUtil.joinStringList(blackList, ","); }
/** * @return the blackList configured on this policy instance. */ public String getBlackList() { return StringUtil.joinStringList(blackList, ","); }
private void addRoles(String username, String[] roles) { for (String role : roles) { List<String> users = roleConfig.getList(String.class, role); if (users == null) { users = new ArrayList<>(); } users.add(username); roleConfig.setProperty(role, StringUtil.joinStringList(users, ",")); } }
private void addRoles(String username, String[] roles) { for (String role : roles) { List<String> users = roleConfig.getList(String.class, role); if (users == null) { users = new ArrayList<>(); } users.add(username); roleConfig.setProperty(role, StringUtil.joinStringList(users, ",")); } }
@Override public JsonObjectBuilder toJson(RemotingConnection connection) { List<ServerSession> sessions = server.getSessions(connection.getID().toString()); Set<String> users = new HashSet<>(); String jmsSessionClientID = null; for (ServerSession session : sessions) { String username = session.getUsername() == null ? "" : session.getUsername(); users.add(username); //for the special case for JMS if (session.getMetaData(ClientSession.JMS_SESSION_IDENTIFIER_PROPERTY) != null) { jmsSessionClientID = session.getMetaData("jms-client-id"); } } return JsonLoader.createObjectBuilder().add("connectionID", toString(connection.getID())) .add("remoteAddress", toString(connection.getRemoteAddress())) .add("users", StringUtil.joinStringList(users, ",")) .add("creationTime", new Date(connection.getCreationTime()).toString()) .add("implementation", toString(connection.getClass().getSimpleName())) .add("protocol", toString(connection.getProtocolName())) .add("clientID", toString(connection.getClientID() != null ? connection.getClientID() : jmsSessionClientID)) .add("localAddress", toString(connection.getTransportLocalAddress())) .add("sessionCount", server.getSessions(connection.getID().toString()).size()); }
@Test public void testJoinStringList() throws Exception { List<String> strList = new ArrayList<>(); strList.add("a"); strList.add("bc"); strList.add("def"); String result = StringUtil.joinStringList(strList, ","); assertEquals("a,bc,def", result); List<String> newList = StringUtil.splitStringList(result, ","); assertEquals(strList.size(), newList.size()); String result2 = StringUtil.joinStringList(newList, ","); assertEquals(result, result2); }
private void handleHttpRequest(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception { // Allow only GET methods. if (req.method() != GET) { sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, FORBIDDEN)); return; } // Handshake String supportedProtocolsCSV = StringUtil.joinStringList(supportedProtocols, ","); WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(this.getWebSocketLocation(req), supportedProtocolsCSV, false, maxFramePayloadLength); this.httpRequest = req; this.handshaker = wsFactory.newHandshaker(req); if (this.handshaker == null) { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { ChannelFuture handshake = this.handshaker.handshake(ctx.channel(), req); handshake.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { // we need to insert an encoder that takes the underlying ChannelBuffer of a StompFrame.toActiveMQBuffer and // wrap it in a binary web socket frame before letting the wsencoder send it on the wire future.channel().pipeline().addAfter("wsencoder", "binary-websocket-encoder", BINARY_WEBSOCKET_ENCODER); } else { // Handshake failed, fire an exceptionCaught event future.channel().pipeline().fireExceptionCaught(future.cause()); } } }); } }
@Test public void testSplitStringList() throws Exception { String listStr = "white,blue,yellow,green"; List<String> result = StringUtil.splitStringList(listStr, ","); assertEquals(4, result.size()); assertEquals("white", result.get(0)); assertEquals("blue", result.get(1)); assertEquals("yellow", result.get(2)); assertEquals("green", result.get(3)); String result2 = StringUtil.joinStringList(result, ","); assertEquals(listStr, result2); } }