Abhijeet,
Pi4J itself just allows your Java code to communicate with the hardware. You have yo add your own code to expose it over the network.
However, last year I gave a talk at Devoxx where I demonstrated using Pi4J and a Raspberry Pi to communicate sensor data via MQTT over the network to both a JavaFx application and an Android app on a mobile device.
Check out this page for the slides and links:
The following projects are the ones I am talking about.
If you like the MQTT route, you may also want to check out the node-red project. (
http://nodered.org/)
With node-red you can install on a Pi and visually wire up (via the web gui) GPIOs to MQTT topics. This could eliminate you having to write any code on the Pi. ;-)