BEIJING — Western journalists have lately been tolerated in China, if grudgingly, but the spread of revolution in the Middle East has prompted the authorities here to adopt a more familiar tack: suddenly, foreign reporters are being tracked and detained in the same manner — though hardly as roughly — as political dissidents.

On Sunday, about a dozen European and Japanese journalists in Shanghai were herded into an underground bunkerlike room and kept for two hours after they sought to monitor the response to calls on an anonymous Internet site for Chinese citizens to conduct a “strolling” protest against the government outside the Peace Cinema, near People’s Square in Shanghai.

In Beijing, several plainclothes officers planted themselves on Saturday night outside the home of an American correspondent who was severely beaten by security officers the previous week as he sought to cover a similar Internet-inspired protest there. Seven officers in two separate cars then trailed the reporter to a basketball game on Sunday, recording his trip on video the entire time, correspondents said.

At least a dozen other journalists and photographers were visited in their homes over the weekend and repeatedly warned not to cause trouble — or, as one officer put it, try to “topple the party.”