Skip to content

Commit

Permalink
Update PetStoreAssistantBot.java
Browse files Browse the repository at this point in the history
  • Loading branch information
chtrembl committed Jan 3, 2024
1 parent 2d92660 commit e2f25aa
Showing 1 changed file with 43 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,54 @@ protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
if(text.equals("variables"))
{
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();

String debug = requestAttributes.toString();

if (requestAttributes instanceof ServletRequestAttributes) {

HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();

try
{
debug += " headers: "+request.getHeaderNames().toString();
}
catch(Exception e)
{

}

try
{
debug += " attributes: "+request.getAttributeNames().toString();
}
catch(Exception e)
{

}

try
{
debug += " parameters: "+request.getParameterNames().toString();
}
catch(Exception e)
{

}

try
{
debug += " session attributes: "+request.getSession().getAttributeNames().toString();
}
catch(Exception e)
{

}

return turnContext.sendActivity(
MessageFactory.text("url: "+request.getHeader("url")+"|"+request.getParameter("url")+"|"+request.getAttribute("url")+" headers: "+request.getHeaderNames())).thenApply(sendResult -> null);
MessageFactory.text("debug: "+debug)).thenApply(sendResult -> null);
}else{
return turnContext.sendActivity(
MessageFactory.text("no request attributes")+requestAttributes.toString()).thenApply(sendResult -> null);
MessageFactory.text("no request data " + debug)).thenApply(sendResult -> null);
}
}

Expand Down

0 comments on commit e2f25aa

Please sign in to comment.