Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Java - Web Service

Have Programming Question? Ask it here!
 
 
 


mydocumentsandmails
Java - Web Service
1 Answer(s)      2 years and 2 months ago
Posted in : Java Beginners


Hi,

I wanted a simple java program for web services development as per below:

------ IN REQUEST ------ <FileName>

FileName - Path of the file (For example: C/text.txt)

------ IN RESPONSE --------

<FileName> <Size> <Type> <ReadAccess> <WriteAccess> <LastModified>

FileName: This should be filename same as input. Size: size of the file in KB. Type: Type of the file i.e. Java File, ..or anything like. ReadAccess and WriteAccess: Boolean - True or false depending upon access rights. LastModified - Timestamp in the format ddMMyyyy'T'hhmmss

Please help me to get this done.

Thanks


Advertisement
View Answers

May 12, 2012 at 4:17 PM


The given code allow the user to input file name with path. The code will then determine the size of file, name of file, last modified date of file. It also check whether the given file is readable or writable.

import javax.swing.*;
import java.util.*;
import java.text.*;
import java.io.*;

public class FileOperations{
    public static void main(String[]args){
       File f=new File("c:/data.txt");
       long size=f.length();
       String name=f.getName();
       JFileChooser chooser = new JFileChooser();
       String fileType= chooser.getTypeDescription(f);
       boolean check1=f.canRead();
       boolean check2=f.canWrite();
       long s=f.lastModified();
       Date d=new Date(s);
       SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
       String lastmodified=sdf.format(d);

       System.out.println("File Name: "+name);
       System.out.println("File Type: "+fileType);
       System.out.println("Is file Readable: "+check1);
       System.out.println("Is file Writable: "+check2);
       System.out.println("Last Modified Date: "+lastmodified);
    }
}


Related Tutorials/Questions & Answers:
Fax service in Java application.
Fax service in Java application.  Hello, I want to develop a Java application to send fax to any destination fax numbers. Anyone who knows about this, please tell how I can do this. Is there any free libraries
Running Java Applications as a Windows Service
Running Java Applications as a Windows Service  sample code for "Run a Java application as a Windows Service
Advertisements
Servlet service method - Java Beginners
Servlet service method  Hi EveryOne , I have a simple... and the other one is normal java class ,What i want to do is that i want to send path... java class) i want to get this path, i wrote the code for stand alone
minor project on service center management in core java
minor project on service center management in core java  I need a minor project on service center management in core java...If u have then plz send me
Java Message Service(JMS)
Java Message Service(JMS)       JMS (Java Message Service) is a Java API that allows java... other. Java package "javax.jms" provides JMS api. To use JMS, one
java program for Denial of Service (DoS) attacks detection - Swing AWT
java program for Denial of Service (DoS) attacks detection  i want a simple program to generate and detect a Denial of Service (DoS) attacks. using java program
Need simple java code to start and stop the remote windows service.
Need simple java code to start and stop the remote windows service.  Hi, I Need simple java code to start and stop the remote windows service... is running on Server A,I want to close that service i.e notepad.exe from my remote
Apache Tomcat service error - Java Server Faces Questions
Apache Tomcat service error  Hello Sir,While i am starting the tomcat service i am getting the following error please give me solution. ERROR... information,review the system event log.If this is a non-Microsoft service, contact
servlet Service
servlet Service  Defined servlet Service
Mocking a service that calls another service
Mocking a service that calls another service  I have a method, say m1 in class, say C1. Method m1 calls a method, say m2 from another service class, say C2. So I mock m2 in junit test-cases for m1. However, m2 itself calls
unable to open the service tomcat5
unable to open the service tomcat5  While trying to run tomcat server getting "unable to open the service tomcat5" error after installed tomcat
MongoDB uninstall windows service
the MongoDB on my Winodws Computer as service. Now I want to uninstall the mongodb from windows service. Can any one tell me How to uninstall the MongoDB from windows server? Thanks   Hi, You can remove the MongoBD service using
Creating a service - JSP-Servlet
the results.The DAO Is written using Hibernate Then I should create a service which...) to get the data back from the database.(Service is a seperate class not like webservice ect) Can anyone tell me how to create a service.   
creating windows service - RMI
service for this server so that it can start/stop at any time. please help me
Doctors Answering Service
Open source forum software in Java/Spring  Open source forum software in Java/Spring
What is the default cache service of hibernate?
What is the default cache service of hibernate?  Hi, What is the default cache service of hibernate? Thanks
Fetch Gmail Contacts through its service - Java Beginners
Fetch Gmail Contacts through its service  Hello All i want to fetch gmail contacts through there web service in java how can i do. please give me sample code .. Thanking You... Vikram
GPS Mobile Tracking Service
GPS Mobile Tracking Service The mobile tracking system is currently.... In this response, several companies have begin the mobile tracking service... Global Positioning System (GPS) based mobile tracking service at nominal charges
OS service via bluetooth socket
OS service via bluetooth socket  through bluetooth socket i want to send instructions to the OS, where i dont want any server code for this on my PC or Laptop. My instructions should be handled by the OS inbuilt bluetooth
Difference between httpService and Data Service
Difference between httpService and Data Service  Hi.. Please tell me What is the difference between httpService and Data Service? Thanks  Solution: When we use flex Data Services we have to need
Fed Ex service (tracking number)
Java Application Server  Java Application Server
service mysql restart: cPanel MYSQL 5.1 to 5.5
service mysql restart: cPanel MYSQL 5.1 to 5.5  service mysql restart: cPanel MYSQL 5.1 to 5.5
Data Service and Query Builder Tool
Data Service and Query Builder Tool       Data Service is more than data manager or data organization, it is data service perspective. It will be able to manage
courier management service (using servlets,jsp,jdbc)
courier management service (using servlets,jsp,jdbc)   is anyone having information about courier management service ? plz share it .its urgent THANKING YOU IN ADVANCE
Service Oriented Architecture
Service Oriented Architecture          Service Oriented Architecture or SOA for short is a new.... In fact service-oriented architecture is collection of many services
clarify bt/w service() and doget/dopost()
clarify bt/w service() and doget/dopost()   Dear friends, i ve question regarding service()and doget/dopost.. the container calls service() where it does the service for the request so then wat is the role of doget/dopost plz
Flex as a Service
Flex as a service? please give me an example if possible Thanks  Ans: Flex is not a server. It is the pert of your web application. you can use flex at server you will use the tomcat or any other web server
Fleet tracking service
There are many fleet tracking service available in the market one can choose... their fleet and maintaining their security. Fleet tracking service acts, as life... whenever the need be. Fleet tracking service have become the spine of fleet
What is software as a service(SaaS)?
for software as a service, means typical software application that is being provided as a service to the clients. Cloud storage is one prominent example of SaaS... distributed to clients as an ongoing service is called as Software as a Service
Service Apartments in Gurgaon
Service Apartments in Gurgaon The city of Gurgaon is one of the upcoming... periods. To provide them with quality accommodation there are some good service... hubs of the city. These service apartments in this high-tech city in the NCR
sample jsp-servlet-service-db program
sample jsp-servlet-service-db program  <%@ page language="java...; <%@ page language="java" contentType="text/html; charset...; <%@ page language="java" contentType="text/html; charset=ISO-8859-1
Leading VoIP Service Providers
. The top rated VoIP service providers worldwide are mainly focused at households... service providers which provides the equipments for free. In addition... lower. It has emerged as an top most VoIP service providers due to its excellent
BI: Improving performance in financial service
BI: Improving performance in financial service       FINANCIAL SERVICE INDUSTRY generally includes..., detecting fraud, interpreting transaction pattern and efficient customer service
VoIP Service
VoIP Service VoIP Service Provider Solutions Emergent Network Solutions mission is to provide real, deliverable VoIP service provider solutions. Our suite of VoIP service provider solutions software combines the best of proven
GPS Fleet Control Management Service
GPS Fleet Control Management Service A real time GPS Fleet Control Management service plays a crucial role in tracking and controlling assets real time... management service are used in most transportation industries including road
Mobile Software Testing Services, Mobile Application Software Testing Service RoseIndia
mobile software testing according to the type and version of software like Java.... We offer mobile application software testing, mobile software testing service... testing department, can contact to us for getting world class service at most
Java Around the Globe
Java Around the Globe         Sony Ericsson Virtual Lab will provide Java developers an online testing service to test and monitor Java applications
Cheapest Fleet Management Service India
of the cheapest fleet management service to small to large transportation... and most advanced fleet management service solution containing all essential... take our service? The answer is: first look at the characteristics of our fleet
Location Based Service (LBS) in Tourism
Location Based Service (LBS) in Tourism   ... say that it is a service that determines where a mobile device and its user... is the nearby attraction? Where is the nearest service? etc. and the answer
Java Help Center
Java Help Center       Welcome to Java help Center service of RoseIndia.net, a renowned Java tutorial website that provides you the latest and up
Find Suitable Service Provider, How to Find a Suitable Company for Outsourcing
, there are factors like client satisfaction and good service that have to be considered. There has to be a balance between quality service and pricing. Training cost should... while considering selecting the off shore service provider. Geographically, too
Java Naming and Directory Interface (JNDI)
Java Naming and Directory Interface (JNDI)       The Java Naming and Directory Interface (JNDI) is a directory service based API to allow the clients to discover and lookup data
Security and Privacy Issues in Location Based Service (LBS)
Security and Privacy Issues in Location Based Service (LBS)       Location Based Service (LBS) is primarily based on user’s location to provide other value added services
Data Provider or other service returned an E_FAIL status Error
Data Provider or other service returned an E_FAIL status Error       In was developing a form in Visual Basic and got the error "Data Provider or other service returned an E_FAIL status
EJB3.0,web-service,websphere using eclipse
EJB3.0,web-service,websphere using eclipse  I have to make an ejb3.0 application a web-service using websphere6.1 and eclipse.Can I do it configuring...,then deploy on the server,then convert it into web-service?Any Idea/help
java swings - Java Beginners
java swings  Hi, I have two listboxes.If i select first value................ jboss.mq:service=DestinationManager jboss.mq:service=SecurityManager jboss.mq:service
java swings - Java Beginners
java swings  Hi, I have two listboxes.If i select first value................ jboss.mq:service=DestinationManager jboss.mq:service=SecurityManager jboss.mq:service
java swings - Java Beginners
java swings   Hi, I already posted the question for three times... code............. jboss.mq:service=DestinationManager jboss.mq:service=SecurityManager
 

 

 

DMCA.com