Refine search
private String getPathParamName(Annotation[] annotations) { for (Annotation a : annotations) { if (a instanceof PathParam) { return ((PathParam) a).value(); } } return null; }
@OnClose public void onClose(@PathParam("username") String username, Session session) { String sessionId = session.getId(); //当前的Session 移除 livingSessions.remove(sessionId); //并且通知其他人当前用户已经离开聊天室了 sendTextAll("用户[" + username + "] 已经离开聊天室了!"); }
indexPathParams.put( Integer.valueOf(i), new PojoPathParam(types[i], ((PathParam) paramAnnotation).value())); paramFound = true; break; maxMessageSize = m.getAnnotation(OnMessage.class).maxMessageSize();
@OnOpen public void openSession(@PathParam("username") String username, Session session) { String sessionId = session.getId(); livingSessions.put(sessionId, session); sendTextAll("欢迎用户[" + username + "] 来到聊天室!"); }
indexPathParams.put( Integer.valueOf(i), new PojoPathParam(types[i], ((PathParam) paramAnnotation).value())); paramFound = true; break; maxMessageSize = m.getAnnotation(OnMessage.class).maxMessageSize();
private String getPathParamName(Annotation[] annotations) { for (Annotation a : annotations) { if (a instanceof PathParam) { return ((PathParam) a).value(); } } return null; }
indexPathParams.put( Integer.valueOf(i), new PojoPathParam(types[i], ((PathParam) paramAnnotation).value())); paramFound = true; break; maxMessageSize = m.getAnnotation(OnMessage.class).maxMessageSize();
@GetMapping ResponseEntity<List<Withdrawal>> withdrawals(@PathParam("cardId") String cardId) { return ResponseEntity.ok().body(withdrawalRepository.findByCardId(cardId)); } }
protected String getPathParamName(Annotation[] annotations) { for (Annotation a : annotations) { if (a instanceof PathParam) { return ((PathParam) a).value(); } else if (a instanceof javax.ws.rs.PathParam) { return ((javax.ws.rs.PathParam) a).value(); } } return null; } }
indexPathParams.put( Integer.valueOf(i), new PojoPathParam(types[i], ((PathParam) paramAnnotation).value())); paramFound = true; break; maxMessageSize = m.getAnnotation(OnMessage.class).maxMessageSize();
@GetMapping ResponseEntity<List<Withdrawal>> withdrawals(@PathParam("cardId") String cardId) { return ResponseEntity.ok().body(withdrawalRepository.findByCardId(UUID.fromString(cardId))); } }
private void handleError(Throwable throwable, PatternPathRouter.RoutableDestination<Object> routableEndpoint, Session session) { Object webSocketEndpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Optional<Method> methodOptional = new EndpointDispatcher().getOnErrorMethod(webSocketEndpoint); methodOptional.ifPresent(method -> { List<Object> parameterList = new LinkedList<>(); Arrays.stream(method.getParameters()).forEach(parameter -> { if (parameter.getType() == Throwable.class) { parameterList.add(throwable); } else if (parameter.getType() == Session.class) { parameterList.add(session); } else if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam != null) { parameterList.add(paramValues.get(pathParam.value())); } } else { parameterList.add(null); } }); executeMethod(method, webSocketEndpoint, parameterList, session); }); }
indexPathParams.put( Integer.valueOf(i), new PojoPathParam(types[i], ((PathParam) paramAnnotation).value())); paramFound = true; break; maxMessageSize = m.getAnnotation(OnMessage.class).maxMessageSize();
/** * 关闭连接时候触发 */ @OnClose public void onClose(Session session, @PathParam("username") String username) { Constant.nameAndSession.remove(username); }