CN104137073B - A kind of method and apparatus for obtaining file - Google Patents

A kind of method and apparatus for obtaining file Download PDF

Info

Publication number
CN104137073B
CN104137073B CN201280003352.1A CN201280003352A CN104137073B CN 104137073 B CN104137073 B CN 104137073B CN 201280003352 A CN201280003352 A CN 201280003352A CN 104137073 B CN104137073 B CN 104137073B
Authority
CN
China
Prior art keywords
file
application
source
filesystem
virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201280003352.1A
Other languages
Chinese (zh)
Other versions
CN104137073A (en
Inventor
王嗣琛
周皓隽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN104137073A publication Critical patent/CN104137073A/en
Application granted granted Critical
Publication of CN104137073B publication Critical patent/CN104137073B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

The invention discloses a kind of method and apparatus for obtaining file, this method is applied to the file system filesystem based on sandbox sandbox mechanism, and this method includes:Browser receives the file that the first file system API filesystem API that the first application is provided by the browser are initiated and preserves request;Preserved and asked according to the file, the file that first application need to preserve is saved in file system filesystem;The instruction with the acquisition file of described first the second not homologous applications trigger of application is received, the instruction carries the path of the file;The path of the file is obtained, and the file is obtained from the filesystem according to the path of the file, the file is supplied to second application.Using the embodiment of the present invention, across the source access in filesystem is realized.

Description

A kind of method and apparatus for obtaining file
Technical field
The present invention relates to communication technical field, more particularly to a kind of method and apparatus for obtaining file.
Background technology
With the development of Internet service, the use of WWW web applications is more and more extensive.Web applications are that one kind passes through Web API (application programming interface, API) is called browser is performed the web Using the application program of required order or action.Wherein, web API are one of browser opening to weblication Calling interface.Currently, browser provides one group of API on file system filesystem in the open API for giving application. Using application data being write into filesystem by calling these filesystem api interfaces.Filesysem is to be based on The file system of sandbox sandbox mechanism, it is to judge that unit follows the principle whose acquisition who preserves with source (origin), it is not homologous Application can not obtain the data of other side.Using the calling by filesystem api interfaces, instruction browser distributes for it A certain size file system memory spaces, for preserving the data of application, and in the customized filesystem of application Read and write-in file and catalogue.
Source (origin) is URL subset, and each web applications have a URL.Source is by the rule in the URL that applies (scheme) part, main frame (host) partly form with port (port) part.Because rule is different (such as https and http), So https://www.hello.com the pages and http:The source of the //www.hello.com pages is different.The concept in source Do not consider path, such as http://www.hello.com/index.html and http://www.hello.com/pages.html There is identical source.
For example, following source is not homologous:
http://example.com/
http://example.com:8080/
http://www.example.com/
https://example.com:80/
https://example.com/
http://example.org/
Following source is homologous:
http://example.com/
http://example.com:80/
http://example.com/path/file
In the prior art, using the file automatically saved by browser, directly it is saved in by browser on user equipment Filesystem in, and only this browser can directly operate the file of preservation before (such as change, read).Due to Filesystem is the file system based on sandbox mechanism, therefore, can only be by using the file automatically saved by browser Obtaining with this using homologous application by the browser, not homologous application can not then get this document with the application, I.e. source A Web applications can not obtain source B application and be stored in file in filesystem.
The content of the invention
The embodiment of the present invention provides a kind of method and apparatus for obtaining file, is obtained with realizing in filesystem mid-spans source File.
In a first aspect, the method for file is obtained, applied to the file system based on sandbox sandbox mechanism Filesystem, this method include:
First is received using the first file system API provided by the browser in browser The file that filesystem API are initiated preserves request;
Preserved and asked according to the file, the file that first application need to preserve is saved in file system In filesystem;
The instruction with the acquisition file of described first the second not homologous applications trigger of application is received, the instruction is taken Path with the file;
The path of the file is obtained, and the text is obtained from the filesystem according to the path of the file Part, the file is supplied to second application.
In the first possible implementation of first aspect, this method also includes:
The establishment source of the file is recorded, the establishment source is the source for the first application for preserving the file;
Receive the mandate source of the file that first application is specified, the mandate source for be authorized to can obtain it is described The source of file;
The mandate source of the file is recorded, the mandate source includes the source of second application.
With reference to the first possible implementation of first aspect, in second of possible implementation, the basis The path of the file obtains the file from the file system of the described first application, and the file is supplied into described second Using specifically including:
The file is searched in the filesyetem according to the path of the file;
After the file is found, the establishment source and mandate source of second source applied and the file are carried out Matching, when it is determined that the source of second application is the mandate source of the file, the file is supplied to second application.
Second with reference to the possible implementation of the first of first aspect or first aspect or first aspect is possible Implementation, in the third possible implementation, the reception applies the second not homologous applications trigger with described first The instruction of the acquisition file include:
The 2nd filesystem API that browser described in second application call provides are received to obtain the file Call instruction.
With reference to the third possible implementation of first aspect, in the 4th kind of possible implementation, this method is also Including:
Receive the described first path for applying the file sent after the file is preserved to the described second application;
The path of the file is transmitted to second application, so that the described second application is according to the path of the file Initiate the call instruction.
With reference to the 4th kind of possible implementation of first aspect, in the 5th kind of possible implementation, the file Path carry described first application to second application send across document communication message postMessage in, or, carry exist In the HTTP HTTP message that first application is sent to the second application.
With reference to the first possible implementation of first aspect, in the 6th kind of possible implementation, methods described Also include:
Browser receives the file acquisition that second application is initiated by file API and asked, the file acquisition request Instruction browser obtains file by the way of user selects;
Browser asks to open file selection interface according to the file acquisition, and shows in the file selection interface Optional file in filesystem;
The reception and the instruction of the acquisition file of described first the second not homologous applications trigger of application include:Connect User is received in the file selection interface, selects the instruction of the file.
It is described in institute in the 7th kind of possible implementation with reference to the 6th kind of possible implementation of first aspect Stating the optional file showed in file selection interface in filesystem includes:
Browser determines the optional file that can be obtained in filesystem by the described second application, is given birth to for each optional file The virtual file associated into one, using the path of the optional file as the information associated with the virtual file, and will be raw Into virtual file be presented in the file selection interface, so as to the user by the virtual file come select with it is described The file of virtual file association.
With reference to the 6th kind of possibility of first aspect or the 7th kind of possible implementation of first aspect, in the 8th kind of possibility Implementation in, before the optional file in filesystem is showed in the file selection interface, in addition to:Generation Filesystem virtual folders, and the filesystem virtual folders are presented in the file as system disk and selected In interface, performed after the operation of user's selection filesystem virtual folders is received described in file selection Show the operation of the optional file in filesystem in interface.
It is described to browse in the 9th kind of possible implementation with reference to the 8th kind of possible implementation of first aspect When device determines the optional file that can be obtained in filesystem by the described second application, in addition to:Determine the optional file Establishment source, and the virtual folder in each establishment source is generated respectively;
The described virtual file of generation is presented in the file selection interface specifically includes:By the void in the establishment source Intend file to put as the sub-folder in the filesystem virtual folders, and by the virtual file of the optional file In the virtual folder in corresponding establishment source, show as the subfile in the virtual folder in the establishment source.
With reference to the 6th kind of possibility of first aspect or the 7th kind of possible or first aspect the 8th kind of possibility of first aspect Or the 9th kind of possible implementation of first aspect, in the tenth kind of possible implementation, the browser determines It can be specifically included in filesystem by the optional file that the described second application obtains:
The source of establishment is included to the file in the source of the described second application, and authorizes the text in source of the source including the described second application Part is defined as the optional file that can be obtained in filesystem by the described second application.
Second aspect, a kind of device for obtaining file, applied to the file system based on sandbox sandbox mechanism Filesystem, described device include:
Interface unit, for providing the first file system API filesystem API;
Requesting processing, the first filesystem API provided for receiving the first application by the interface unit The file of initiation preserves request;
Storage unit, the file for being received according to the requesting processing preserve request, described first are applied The file that need to be preserved is saved in file system filesystem;
Event handling unit, for receiving the acquisition described first with described first the second not homologous applications trigger of application Using the instruction of the file of preservation, the instruction carries the path of the file;
Acquiring unit, for obtaining the path of the file in the instruction that is received from the event handling unit, and according to The path of the file obtains the file from the filesystem;
Unit is provided, the file for the acquiring unit to be obtained is supplied to second application.
In the first possible implementation of second aspect, the requesting processing, it is additionally operable to receive described The mandate source for the file that one application is specified, the mandate source can obtain the source of the file to be authorized to;
The storage unit, it is additionally operable to record the establishment source of the file and the mandate source of the file, the establishment source To preserve the source of the first of the file the application;The mandate source includes the source of second application.
With reference to the first possible implementation of second aspect, in second of possible implementation, the acquisition Unit specifically includes:
Subelement is obtained, for obtaining the path of the file in the instruction that is received from the event handling unit;
Subelement is searched, for the path obtained according to the acquisition subelement, institute is searched in the filesystem State file;
Authenticate subelement, for it is described lookup subelement find the file after, by second source applied with The establishment source and mandate source of the file are matched, when it is determined that the source of second application is the mandate source of the file, Notify the offer unit that the file that the searching modul is found is sent into second application.
Second with reference to the possible implementation of the first of second aspect or second aspect or second aspect is possible Implementation, in the third possible implementation, the interface unit also provides for the 2nd filesystem API and connect Mouthful;
The 2nd filesystem API that the event handling unit is provided by the interface unit receive described second The call instruction of the acquisition file of applications trigger.
With reference to the third possible implementation of second aspect, in the 4th kind of possible implementation, described device Also include:
Retransmission unit, applied for receiving described first after the file is preserved to described in the described second application transmission The path of file;And the path of the file is transmitted to second application, so that the described second application is according to the file Path initiate the call instruction.
With reference to the 4th kind of possible implementation of second aspect, in the 5th kind of possible implementation, the file Path carry described first application to second application send across document communication message postMessage in, or, carry exist In the HTTP HTTP message that first application is sent to the second application.
With reference to the first possible implementation of second aspect, in the 6th kind of possible implementation, the interface Unit, also provide for file API;
The event handling unit specifically includes:
Receiving subelement, the text initiated for receiving the file API that second application is provided by the interface unit Part obtains request, and the file acquisition request instruction obtains file by the way of user selects;
File selection interface is opened in interaction subelement, the file acquisition request for being received according to the receiving subelement, Optional file in showing filesystem in the file selection interface, and user is received in the file selection interface In, select the instruction of the file of the first application preservation.
With reference to the 6th kind of possible implementation of second aspect, in the 7th kind of possible implementation, the interaction Subelement specifically includes:
File selection interface is opened in interface module, the file acquisition request for being received according to the receiving subelement;
Content module, for the optional file for determining to be obtained by the described second application in filesystem;
Generation module, each optional file for being determined for content module generates the virtual file of an association, with institute The path of optional file is stated as the information associated with the virtual file,
Display module, the virtual file for generation module to be generated are presented in the file selection that the interface module is opened In interface, so that the user selects the file associated with the virtual file by the virtual file;
Event module, for receiving user in the file selection interface, select the file of the first application preservation Instruction.
With reference to the 6th kind of possibility of second aspect or the 7th kind of possible implementation of second aspect, in the 8th kind of possibility Implementation in, the generation module, be additionally operable to generate filesystem virtual folders;
The display module, the filesystem virtual folders using the generation submodule generation are additionally operable to as system Disk is presented in the file selection interface;
The event module is additionally operable to receive the operation of user's selection filesystem virtual folders, and is receiving Indicated after to the operation display module perform described in show in the file selection interface in filesystem can The operation of selection part.
With reference to the 8th kind of possible implementation of second aspect, in the 9th kind of possible implementation, the content Module, it is additionally operable to determine the establishment source of the optional file;
The generation module, it is additionally operable to generate the virtual folder in each establishment source that the content module determines respectively;
The display module specifically includes:
First shows submodule, for the filesystem virtual folders that generate the generation module as system disk It is presented in the file selection interface;
Second shows submodule, for the virtual folder in the establishment source that generates the generation module as described in Sub-folder in filesystem virtual folders shows;
3rd shows submodule, and the virtual file of the optional file for the generation module to be generated is placed on correspondingly Establishment source virtual folder in, show as the subfile in the virtual folder in the establishment source.
With reference to the 6th kind of possibility of second aspect or the 7th kind of possible or second aspect the 8th kind of possibility of second aspect Or the 9th kind of possible implementation of second aspect, can in the filesystem in the tenth kind of possible implementation Included by the optional file that the described second application obtains:Establishment source includes the file in the source of the described second application, and authorizes source The file in the source including the described second application.
The embodiment of the present invention, it can be provided not to browser in the file system filesystem based on sandbox mechanism The path for the file that homologous application preserves, it is achieved thereby that the file acquisition across source.
Brief description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below by embodiment it is required use it is attached Figure is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for this area For those of ordinary skill, on the premise of not paying creative work, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is the method flow diagram of the acquisition file of the embodiment of the present invention;
Fig. 2 provides the method flow diagram for obtaining file for another embodiment of the present invention;
Fig. 3 provides the method flow diagram for obtaining file for another embodiment of the present invention;
Fig. 4 provides the method flow diagram that file is obtained under application scenarios for the embodiment of the present invention;
Fig. 5 obtains the flow chart of another embodiment of the method for file under application scenarios;
Fig. 6 is the interface schematic diagram of filesystem virtual folders provided in an embodiment of the present invention;
Fig. 7 provides the displaying interface schematic diagram of the virtual folder in establishment source for the embodiment of the present invention;
Fig. 8 provides the displaying interface schematic diagram of virtual file for the embodiment of the present invention;
Fig. 9 provides a kind of structural representation for the device for obtaining file for the embodiment of the present invention;
Figure 10 provides a kind of structural representation for the device for obtaining file for another embodiment of the present invention;
Figure 11 is a kind of structural representation for the device for obtaining file of another embodiment of the present invention;
Figure 12 provides a kind of distinguishing hierarchy structure chart for the device for obtaining file for the embodiment of the present invention;
Figure 13 provides a kind of hardware architecture diagram for the device for obtaining file for the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
Source in the embodiment of the present invention include Rule section in the uniform resource locator URL of application, host machine part with And port section.
Fig. 1 is the method flow diagram of acquisition file provided in an embodiment of the present invention, and this method can be applied to be based on sandbox The file system filesystem of sandbox mechanism.As illustrated, the method for file is obtained in the embodiment to be included:
S100, browser receive the first file system API that the first application is provided by the browser The file that filesystem API are initiated preserves request.
Wherein, the first application is the application run in a browser, and e.g., web is applied.
First file system API filesystem API can include at least one filesystem API. Specifically, the first application can be protected by calling getFile API and the Write API in filesystem API to initiate file Deposit request.Wherein, getFile is used to obtain document entry, and Write is used to write data to be saved into file.That is, first Using first acquisition filesystem files, then data to be saved is write in file.Obtaining file can be:
GetFile (" DOMString path ", { create:true});
Wherein, " DOMString path " are file path.In filesystem, the application preserved by initiation file refers to Determine the storing path of file, and carry out unique mark this document using the path as file identifier.For example, getFile ("/ BenPicture/Ben.jpg ", { create:true});Wherein, "/BenPicture/Ben.jpg " can be considered the mark of file Symbol, by the way that "/BenPicture/Ben.jpg " can get the entrance for the file to be preserved.{create:True } represent if This document is not present, then creates this document.
It should be noted that different applications can apply for the filesystem spaces of oneself in filesystem.Institute So that first applies when initiating file preservation request, may call upon the requestFileSystem in filesystem API API distributes a certain size file system memory spaces to indicate browser as it, for preserving the file of the first application.
Due to, using having applied for the filesystem spaces of oneself, so same source there may be it is different Filesystem situation.But application applies for filesystem spaces by requestfilesystem every time, browser all can Application of unique object to request being returned, for each filesystem of unique mark, during using preserving file, can also protected Deposit and filesystem marks are carried in request.S102, preserved and asked according to the file, first application need to be preserved File is saved in file system filesystem.
Specifically, browser found in filesystem in getFile " file that DOMString path " are specified, And write first using data to be saved in this document, this document write after data is the text that the first application preserves Part.If be not present in filesystem " file that DOMString path " are specified, this document is created, then will preserve Data are write in this document.
S104, the instruction with the acquisition file of described first the second not homologous applications trigger of application is received, this refers to Order carries the path of the file.
Second application is the application run in a browser.The source of the second application is would know that by the URL of the second application.
In the case where each application application has the filesystem spaces of oneself, the instruction can also carry this Filesystem is identified.
S106, the path of the file is obtained, and institute is obtained from the filesystem according to the path of the file File is stated, and the file is supplied to the second application.
Specifically, browser can obtain the path of file from the instruction of reception.
Optionally, when filesystem marks are carried in instruction, browser is specified from filesystem marks The file is obtained in filesystem.
Above-described embodiment, it can be provided in the file system filesystem based on sandbox mechanism to browser different The path for the file that the application in source preserves, it is achieved thereby that the file acquisition across source.
In the embodiment of the present invention, when the second application will obtain first using the file being stored in filesystem, it can adopt Browser is notified with following two ways:
Mode one:Second application can call the 2nd filesystem API that browser provides to indicate browser from first File is obtained in the filesystem of application, and the path for the file to be obtained is specified when calling filesystem API.
Mode two:The file API that second application can call browser to provide initiate file acquisition request, such as<input Type=" file ">, request instruction browser is obtained by this document and provides file selection interface to user, makes user in file Selection will be supplied to the file of the second application in selection interface.
Which kind of, it should be noted that no matter above-mentioned mode used, it is intended to be triggered by the second application.
Realized in employing mode one in embodiments of the invention, the reception in step 104 and the first application be not homologous The instruction of the acquisition file of second applications trigger specifically may include:The second of second application call browser offer is provided Filesystem API come obtain first application preserve file call instruction.Wherein, the second application is supplied to browser Routing information, can first apply and be sent to the second application after this document is preserved.Specific handling process can be found in figure 2。
Fig. 2 indicates the method flow diagram of browser acquisition file for employing mode one, as shown in Fig. 2 this method includes:
S200, browser receive the first file system API that the first application is provided by the browser The file that filesystem API are initiated preserves request.
S202, preserved and asked according to the file, the file that first application need to preserve is saved in file system In filesystem.
Step S200-S202 specific implementation refers to embodiment illustrated in fig. 1, repeats no more here.
S204, after the first application preserves file, browser receives this document that the first application is sent to the second application Path;And the path of this document is transmitted to the second application, initiating calling according to the path of the file so as to the second application refers to Order.
Specifically, the first application can be sent the storage information of file by across document communication message postMessage To the second application, and indicate that the second application obtains file from filesystem.
PostMessage message format is as follows:
postMessage(“filesystemRetrieve:DOMString path ", " second applies URL ");
Wherein " filesystemRetrieve:DOMString path " are message content fields, FilesystemRetrieve expressions ":" " file indicated by DOMString path " will obtain from filesystem afterwards;Emit After number " DOMString path " are storing path of the file in filesystem, can be used for as the identifier of file Unique mark and this document is found in filesystem;" URL " of the second application is message destination field.
It is of course also possible to by other means, filesystemRetrieve for example is independently arranged into a field, represent File is obtained from filesystem, and " DOMString path " are then placed in message content field, and form is as follows:
PostMessage (" DOMString path ", " URL " of the second application, " filesystemRetrieve ");
Optionally, first application can also by HTTP (Hypertext Transfer Protocol, HTTP the storage information of file) is sent to the second application.For example, can be when the first application be directed to the second application, first Increase " file path " and " filesystemRetrieve " two marks using the GET message for being sent to the second application, specifically Form is as follows:
GET http:The URL/ of // the second applicationFilesystemRetrieve=" DOMString path " head;
Wherein, filesystemRetrieve represents "=" " file represented by DOMString path " will be from afterwards Filesystem is obtained;After equal sign " DOMString path " are storing path of the file in filesystem;" second should URL " represents to be directed to the second application.
S206, receive the 2nd filesystem API that the second application call browser provides and preserved to obtain the first application File call instruction.
Second applies after the file storage information that the first application is sent is received, and knows that needs obtain from filesystem File is taken, therefore, calls the 2nd filesystem API that browser provides to obtain file, and carry and be somebody's turn to do in call instruction The path of file.
Wherein, the 2nd filesystem API can include at least one filesystem API, and can include the Filesystem API in one filesystem API, for example, the second application can call getfile API and FileReaderAPI come indicate browser obtain file.Wherein, getFile is used to obtain document entry, and FileReader is used for Data are read in the file found from getFile.Second application carries the path of the file received from the first application In getFile, e.g., getFile (" DOMString path ").
S208, the path of the file is obtained, and institute is obtained from the filesystem according to the path of the file File is stated, by the file to the second application.
First application is stored in by above-described embodiment by the interaction message between the application of extension first and the second application The path of file in filesystem is sent to the second application so that the second application can get first by the path should With the file being stored in filesystem, so as to realize across source access.
Optionally, in order to increase the security in across source access process, the embodiment of the present invention can also allow for first to answer With specified mandate source, other sources only can just obtain the file that the first application preserves in the mandate source that the first application is specified.
Specifically, it can further include before step S206:Record the establishment source of the file, the establishment source To preserve the source of the first of the file the application;The mandate source for the file that the first application is specified is received, the mandate source is The source of the file can be obtained by being authorized to;The mandate source of the file is recorded, the mandate source of the file includes described The source of two applications.
Wherein, browser can extend following filesystem API, the first application is passed through following filesystem API specifies mandate source, such as:
A. browser can extend getFile API, allow this API that the first application is provided using browser in S202 File preserve request in specify mandate source.Such as:
void getFile(DOMString path,{create:true},…,optional DOMString Pemissions);
Wherein, " DOMString path " are file path, for the file in unique mark filesystem, " DOMString Pemissions " are new field, represent mandate source.Such as:getFile(“/BenPicture/ Ben.jpg ", { create:Ture }, " * .drawing.com "), then it represents that picture/BenPicture/Ben.jpg can be by * .drawing.com source obtains.
B. browser can extend requestFileSystem API, make first this API provided using browser Mandate source is specified when filesystem spaces are obtained, this authorizes source all raw to the All Files under filesystem spaces Effect.Such as:
void requestFileSystem(…,optional DOMString Pemissions);
Wherein, " DOMString Pemissions " are new field, represent mandate source.
C. browser can extend a new API, make first to provide this newly-increased API specified file using browser Mandate source.Such as:
createFilePermissions(DOMString path,DOMString Pemissions);
Wherein, createFilePermissions is newly-increased API, and " DOMString path " are file path, for only File in one mark filesystem, " DOMString Pemissions " are mandate source.
It should be noted that one or more mandate sources can be specified, browser can create relation table and carry out log file With creating source and authorizing the relation in source, as shown in table 1:
Table 1
Filename Establishment source Mandate source
/BenPicture/Ben.jpg http://www.paizhao.com/ *.drawing.com
Optionally, the path according to file in step 208 obtains the file from the file system of the first application, will The file is supplied to second application specifically to may include:The text is searched in filesyetem according to the path of file Part;After the file is found, the source of the second application is matched with the establishment source of the file and mandate source, true When the source of fixed second application is the mandate source of the file, the file is supplied to the second application.
Wherein, browser can first judge whether request source (source of the i.e. second application) is homologous with creating source, if not homologous, Judge whether request source is mandate source again, can also both judge that specific judgement is sequentially in embodiments of the present invention not simultaneously Limit.
Optionally, at specified mandate source, the authority in mandate source can also be further specified that.Specifically, it will can be used to refer to Surely " DOMString Pemissions " are expressed as " authority to the field in mandate source:Mandate source ".Wherein, authority can be:
access:Can be with operation file, such as upload server, modification;
read:File can only be read;
By taking the getFile of extension as an example, when specifying mandate source authority, getFile ("/BenPicture/ are represented by Ben.jpg ", " read:*.drawing.com”);Represent that * .drawing.com can obtain file/BenPicture/ Ben.jpg, but be only capable of reading file, it is impossible to make an amendment.
The embodiment of the present invention for file by specifying mandate source so that and only authorize the application in source just to obtain this document, Add the security in across source access process.
Indicated in employing mode two in the embodiment of browser acquisition file, the reception in step 104 and the first application The instruction of the acquisition file of the second not homologous applications trigger includes:User is received in file selection interface, selects institute State the instruction of file.Specific handling process can be found in Fig. 3.
Fig. 3 indicates the method flow diagram of browser acquisition file for employing mode two, and this method includes:
S300, browser receive the first file system API that the first application is provided by the browser The file that filesystem API are initiated preserves request.
S302, preserved and asked according to the file, the file that first application need to preserve is saved in file system In filesystem.
Step S300-S302 specific implementation refers to embodiment illustrated in fig. 1, repeats no more here.
S304, browser receive the file acquisition that the second application is initiated by file API and asked, and this document obtains request Instruction browser obtains file by the way of user selects;
Specifically, second application can by browser provide file API in<Input type=" file ">Hair Play file acquisition request.Wherein,<Input type=" file ">Represent to input the selection file to be obtained by user.
S306, browser obtains request according to this document and opens file selection interface, and shows in file selection interface Optional file in filesystem.
Browser is receiving<Input type=" file ">Afterwards, the file in filesystem is presented in file selection Selected in interface for user.
It should be noted that in file selection interface in addition to showing the optional file in filesystem, can also open up Existing other system disks, such as C disks, the file under D disks.
S308, user is received in file selection interface, select the instruction of the file of the first application preservation.
User can be by the operation such as click select file in file selection interface, when the application of user's selection first preserves File when, browser can receive the instruction that the selection triggered is operated by this, and pass through the road that file is carried in the instruction The instruction user file to be selected is carried out in footpath.
S310, the path of the file is obtained, and institute is obtained from the filesystem according to the path of the file File is stated, by the file to the second application.
Because in some filesystem using big document storage mode, file only has that browser is visible, Yong Hutong It is not independent monofile form to cross the file that file selection interface is seen, so as to be entered by user by file selection interface Part of composing a piece of writing selects.
Therefore, in an alternative embodiment of the invention, browser can be by the file in filesystem with virtual file Form is presented to user's selection.Specifically, in step 306 show in file selection interface in filesystem can selection Part includes:Browser determines the optional file that can be obtained in filesystem by the second application, for each optional file generation one The virtual file of individual association, using the path of the optional file as the information associated with the virtual file, and by generation Virtual file is presented in file selection interface, so that the user selects what is associated with the virtual file by virtual file File.Wherein, the path of this document is attached to virtual file by browser when generating virtual file, and the virtual file is associated To corresponding optional file.
The embodiment of the present invention for each optional one virtual file of file generated by being presented to user so that Yong Huxuan Select a virtual file and may be correlated to an independent monofile, so as in the filesystem of big document storage mode Realize across the source access using user's select file mode.
It should be noted that in the not high system of security requirement, can be obtained in filesystem by the second application Optional file can be the All Files in filesystem.
Optionally, also can be to the visit of the file in filesystem in order to increase the security in across source access process Ask that authority controls.The first application can be allowed to specify mandate source, other sources ability only in the mandate source that the first application is specified The file that the first application preserves can be obtained.It can be only included and be awarded by the optional file that the second application obtains in filesystem Weigh the file that can be obtained.Specifically, it can also include before S304:Record the establishment source of the file, the establishment source To preserve the source of the first of the file the application;Receive the mandate source for the file that first application is specified, the mandate Source can obtain the source of the file to be authorized to;The mandate source of the file is recorded, the mandate source of the file includes institute State the source of the second application.Wherein, the first application specifies the mode in mandate source to refer to the embodiment shown in Fig. 2, browser record The mode in establishment source and mandate source can also refer to the table 1 in embodiment illustrated in fig. 2, repeat no more here.
Accordingly, browser determines to be specifically included by the optional file that the second application obtains in filesystem:Will wound Building source includes the file in source of the described second application, and authorizes source to include the file in the described second source applied and be defined as The optional file that can be obtained in filesystem by the described second application.
In order to improve the ease for operation of file selection interface, the embodiment of the present invention can also be carried out in file selection interface Layering shows.Specifically, before showing optional file in file selection interface, in addition to:Generate filesystem virtual files Folder, and be presented in using the filesystem virtual folders as system disk in file selection interface, receiving user's selection Show the operation of optional file described in being performed after the operation of the filesystem virtual folders in file selection interface.
For example, browser can show together using filesystem virtual folders as system disk and C disks, D disks etc., work as inspection When measuring user and clicking on the operation of filesystem virtual folders, determine in filesystem can be obtained by the second application can Selection part, and corresponding virtual file is generated, using the virtual file of generation as the subfile in filesystem virtual folders Show.
In order to further improve the ease for operation of file selection interface, the embodiment of the present invention can not only show Filesystem virtual file interlayers, establishment active layer can also be showed, create many levels such as source host layer.To show establishment source Layer exemplified by, browser when determining optional file, in addition to:The establishment source of optional file is determined, generates each establishment source respectively Virtual folder.Wherein, the virtual file of generation is presented in file selection interface and specifically included:By the virtual of the source of establishment File is placed on corresponding wound as the sub-folder in filesystem virtual folders, and by the virtual file of optional file Build in the virtual folder in source, show as the subfile for creating source virtual folder.It should be noted that current embodiment require that Establishment source corresponding to pre-recorded file, specifically can in step 302 browser preserve file when record this document Establishment source.
The scheme of the embodiment of the present invention is done further with reference to specific application scenarios in figures 4 and 5 below It is bright.Assuming that application scenarios are as follows:User is in photograph website http://www.paizhao.com/ has been clapped using camera applications Photo, want the professional website http using processing photo:Drawing applications in //www.drawing.com/ come to this photo Carry out post-processing.Wherein, the first application is camera, source http://www.paizhao.com/, the second application are Drawing, source http://www.drawing.com/.
Fig. 4 be in application scenarios employing mode one come indicate browser obtain file method flow diagram, such as Fig. 4 institutes Show, this method includes:
S400, the camera run in a browser apply the first filesystem API provided by the browser to send out The file risen preserves request, and specifies mandate source in file preserves request.
Specifically, browser execution camera is applied, realized and taken pictures using the camera function of camera applications, such as camera Using can by call browser provide following A PI:<Input type=" file " accept=" image/* " Capture=" camera ">To indicate that browser calls lower level operations system interface, communicate, realize with hardware (e.g., camera) Camera function.
When user, which clicks on, preserves function, following filesystem API of camera application calls browser offer: Fs.getFile ("/camera/Mike ' s head.jpg ", { create:Ture }, " * .drawing.com ") initiate file guarantor Request is deposited to browser, wherein " storing path that/camera/Mike ' s head.jpg " specify for camera applications, and conduct The identifier of unique mark this document, " * .drawing.com " are mandate source, and " * " is asterisk wildcard, can represent one or more Character.Fs is the mark for pointing to camera applications filesystem.
S402, browser are preserved according to this document and asked, and the file that camera applications need to preserve is saved in into file system In filesystem, and record the establishment source and mandate source of this document.
Camera applications can apply for filesystem skies beforehand through requestfilesystem in filesystem Between, it is saved in so as to the file that will be preserved in the filesystem of its own.
In the present embodiment, browser is according to " filesystems of/camera/Mike ' the s head.jpg " in camera Middle acquisition file, if without this document, this document is created in camera filesystem, picture data is saved in and obtained In the file taken.
S404-S406, camera apply the request for being sent to browser and being directed to drawing applications, and by the guarantor of file Deposit path and drawing applications are sent to by browser.
Specifically, user can click on " going to edit to drawing applications " button shown by camera five application pages, i.e., Initiate to be directed to the request that drawing is applied, and the file path that will preserve photo is carried in the request.Such as:GET http://www.drawing.com/FilesystemRetrieve=filesystemname:/camera/Mike’s Head, wherein " www.drawing.com " be drawing application host address, " filesystemRetrieve " instruction from File is obtained in filesystem, filesystmename is filesystem object oriented, unique to specify one Filesystem spaces."/camera/Mike ' s head " are path of the file in filesystem.Browser please according to this Ask and open iframe or Tab or new window, the page of www.drawing.com websites is loaded into wherein, and photo will be preserved File path pass in the page drawing application.
The present embodiment is only illustrated exemplified by using and being directed to drawing applications from camera applications.In another implementation In example, it can not also use from camera applications and be directed to drawing application modes, but drawing is opened by user oneself Using.After browser execution drawing applications, camera is applied by across document communication message postMessage, by file Path is sent to drawing applications, and indicates that drawing is applied from the local filesystem of user and obtain this file data. Such as:PostMessage (" filesystemRetrieve=filesystemname:/camera/Mike’s head”, “http://www.drawing.com”)。
S408, drawing apply to be determined after need to obtaining file from filesystem according to the file path received, is adjusted The file that camera applications preserve is obtained with the filesystem API of browser offer, and will be got from camera applications Parameter of the file path as the API called.
Drawing application call filesystem API can send call instruction to browser, and call format is such as: filesystemname.getFi le(“/camera/Mike’s head.jpg”)。
S410, browser judge whether request source is the establishment source of file or authorizes source, if the source of establishment or mandate source, then S412 is performed, is supplied to drawing to apply file;If neither the source of establishment is nor the source of mandate, performs S414, return obtains Take failure response.
Wherein, source is asked as source corresponding to the application of acquisition request file.Browser is specified in filesystemname In file system spaces according to file path "/camera/Mike ' s head.jpg " search pre-recorded establishment source and Mandate source, the establishment source for determining this document are " http://www.paizhao.com/ ", mandate source are " * .drawing.com ". And the source of the drawing applications of acquisition request this document is " http://www.drawing.com/ ", therefore, perform step S412。
Fig. 5 be in application scenarios employing mode two come indicate browser obtain file method flow diagram, such as Fig. 5 institutes Show, this method includes:
S500, the camera run in a browser apply the first filesystem API provided by the browser to send out The file risen preserves request, and specifies mandate source in file preserves request.
Step S400 in Fig. 4 specifically is referred to, is repeated no more here.
S502, browser are preserved according to this document and asked, and the file that camera applications need to preserve is saved in into file system In filesystem, and record the establishment source and mandate source of this document.
Step S402 in Fig. 4 specifically is referred to, is repeated no more here.
The file API that S504, drawing application call browser provide initiate file acquisition request.
For example, when user clicks on " upper transmitting file " button in drawing applications, drawing applications pass through<input Type=" file ">Request browser provides the file that selection can be browsed by user, and determines to treat according to the input of five application page The file of processing.Here input and not only finger keyboard typewriting input, but a generalized concept, can be that user clicks on file Etc. input mode.
S506, browser obtains request according to this document and opens file selection interface, and it is virtually literary to generate filesystem Part presss from both sides, and is presented in using the filesystem virtual folders as system disk in file selection interface.
Fig. 6 is the display interface schematic diagram of filesystem virtual folders, wherein, " web page source " file is Filesystem virtual folders,
S508, browser receive the operation that user selects the filesystem virtual folders in file selection interface.
After user clicks on filesystem virtual folders in file selection interface, browser receives the selection of the user Operation.
S510-516, browser determine in filesystem the optional file that can be obtained by the second application and described optional The establishment source of file, generation create source folder and the virtual file associated with optional file, by the virtual file in the source of establishment Folder is placed on corresponding establishment source as the sub-folder in filesystem virtual folders, and by the virtual file of optional file Virtual folder in, as create source virtual folder subfile show.
Browser can be according to the establishment source and mandate source of pre-recorded file, it is determined that can be obtained by the second application optional The establishment source of file and optional file.Specifically, browser can travel through each file in filesyste, drawing is judged Whether the source of application is in the establishment source of this file or mandate source, so that it is determined that going out the establishment of retrievable file and this document Source.
When generating the virtual folder in establishment source, create source for identical and generate a virtual folder, such as Fig. 7 institutes Show, Fig. 7 is the displaying interface schematic diagram of the virtual folder in establishment source.
Browser can be the virtual text that each optional file generates an association when generating virtual file for optional file Part, as shown in figure 8, Fig. 8 is the displaying interface schematic diagram of virtual file.Wherein, browser can first show the virtual of establishment source File, when receiving the operation of virtual folder in user's selection establishment source, regenerate virtual file and simultaneously show.
S518, receive the operation of the virtual file corresponding to the file that user selects camera applications to preserve.
When user selects virtual file, the related information of virtual file can be sent to browser by the operation.
S520, it is supplied to drawing to apply the file corresponding to the virtual file of user's selection.
Browser can according to the related information (i.e. file path) of virtual file obtain corresponding to file.
In embodiments of the present invention, application can get the storage information of not homologous application, e.g., file path, gram Take in the file system filesystem based on sandbox mechanism, the file that not homologous application preserves is sightless mutually to ask Topic, realizes the file acquisition across source.
Fig. 9 is that the embodiment of the present invention provides a kind of example logic structural representation for the device for obtaining file.The device Applied to the file system filesystem based on sandbox sandbox mechanism.As shown in figure 9, the device includes:Interface unit 901, requesting processing 902, storage unit 903, event handling unit 904, acquiring unit 905 and provide unit 906.
Interface unit 901, for providing the first file system API filesystem API.
Wherein, the first file system API filesystem API can include at least one filesystem API, such as getFile API and Write API.
Requesting processing 902, first provided for receiving the first application by the interface unit 901 The file that filesystem API are initiated preserves request
Requesting processing 902 can obtain document entry by getFile API, and by Write API to obtaining Data to be saved is write in the file taken.Specific processing refers to the step S100 of embodiment illustrated in fig. 1, no longer superfluous here State.
If it should be noted that when initiating file preservation request, the first application is also not previously allocated filesystem Memory space, first applies when initiating file preservation request, may call upon in filesystem API RequestFileSystem API distribute a certain size file system memory spaces to indicate browser as it, for protecting Deposit the file of the first application.The request for the distribution filesystem memory spaces that first application is initiated is by requesting processing 902 Handled.
Storage unit 903, the file for being received according to the requesting processing 902 preserve request, should by first It is saved in the file that need to be preserved in file system filesystem.
Specifically, storage unit 903 found in filesystem in getFile " DOMString path " are specified File, and first is write in this document using data to be saved, this document write after data is that the first application preserves File." file that DOMString path " are specified, this document is created if be not present in filesystem, then will protected The data deposited are write in this document.
Event handling unit 904, for receiving with described first using described in the acquisition of the second not homologous applications trigger The instruction for the file that first application preserves, the instruction carry the path of the file.
Acquiring unit 905, for obtaining the path of the file in the instruction that is received from the event handling unit 904, And the file is obtained from the filesystem according to the path of the file;
Unit 906 is provided, the file for the acquiring unit 905 to be obtained is supplied to second application.
The specific implementation of above each unit refers to the explanation of embodiment of the method part.
During specific implementation, the second applications trigger that event handling unit 904 can be received by following two modes Acquisition first application preserve file instruction:
Mode one:Receive finger of second application by the 2nd filesystem API of the calling acquisition files initiated Order.During using this mode, interface unit 901 also provides for the 2nd filesystem API;Event handling unit 904 is by connecing The 2nd filesystem API that mouth unit 901 provides receive the call instruction of the acquisition file of the second applications trigger.
Mode two:User is received in file selection interface, selects the instruction of the file of the first application preservation.Using this side During formula, interface unit 901 also provides for file API;Event handling unit 904 is additionally operable to the application of reception second and passes through interface The file acquisition request that the file API that unit 901 provides are initiated, this document obtain request instruction by the way of user selects Obtain file.Event handling unit 904 obtains request according to this document and opens file selection interface, in the file selection interface In show optional file in filesystem, so that user is in file selection interface, the file that selects the first application to preserve.
Which kind of, it should be noted that no matter above-mentioned mode used, it is intended to be triggered by the second application.
Realized in employing mode one in embodiments of the invention, retransmission unit can also be included by obtaining the device of file 1001, as shown in Figure 10, Figure 10 is that another embodiment of the present invention provides a kind of example logic structure for the device for obtaining file Schematic diagram.
Wherein, retransmission unit 1001 is applied after the file is preserved to described in the second application transmission for receiving first The path of file;And the path of the file is transmitted to the second application, so that the second application is sent out according to the path of the file Act the call instruction for calling the 2nd filesystem API.
In specific implementation, the path of file is carried in across the document communication message that the first application is sent to the second application In postMessage, or, carry in the HTTP HTTP message that the first application is sent to the second application.In detail Illustrate to can be found in the step 204 in embodiment of the method.
Interface unit 901 also provides for the 2nd filesystem API.
The 2nd filesystem API that event handling unit 904 is provided by interface unit 901 receive the second application and touched The call instruction of the acquisition file of hair.
Optionally, in order to improve the security accessed across source, requesting processing 902 is additionally operable to receive first application The mandate source for the file specified, the mandate source can obtain the source of the file to be authorized to.Specific implementation can be found in Embodiment of the method part shown in Fig. 2.
Storage unit 903, is additionally operable to record the establishment source of the file and the mandate source of the file, and the establishment source is Preserve the source of the first application of the file;The mandate source includes the source of second application.Specific recording mode can Table 1 in reference method embodiment.
Acquiring unit 905 specifically includes:
Subelement 1002 is obtained, for obtaining the path of the file in the instruction that is received from event handling unit 904;
Subelement 1003 is searched, for the path obtained according to the acquisition subelement 1002, is looked into filesystem Look for the file;
Subelement 1004 is authenticated, for after the lookup subelement 1003 finds the file, second to be applied Source is matched with the establishment source of the file and mandate source, when it is determined that the source of the second application is the mandate source of the file, Notice provides unit 906 and the file that the searching modul 1003 is found is sent into the second application.
The specific implementation of each function refers to the detailed description of embodiment of the method part shown in Fig. 1, Fig. 2 and Fig. 4 above.
Above-described embodiment is sent to the second application by the path for the file that the first application is stored in filesystem, So that the second application can get the file that the first application is stored in filesystem by the path, so as to realize across source Access.And by specifying mandate source for file so that only authorize the application in source just to obtain this document, add across source Security in access process.
Realized in employing mode two in embodiments of the invention, on the basis of embodiment illustrated in fig. 9, interface unit 901 also provide for file API;Event handling unit 904 specifically may include receiving subelement 1101 and interaction subelement 1102.As shown in figure 11, Figure 11 is that another embodiment of the present invention provides a kind of example logic structure for the device for obtaining file Schematic diagram.
Wherein, receiving subelement 1101, initiated for receiving the file API that the second application is provided by interface unit 901 File acquisition request, this document obtain request instruction using user selection by the way of obtain file;
File choosing is opened in interaction subelement 1102, the file acquisition request for being received according to the receiving subelement 1101 Interface is selected, the optional file in filesystem is showed in file selection interface, and receives user and selects boundary in the file In face, the instruction of the file of the first application preservation is selected.
The embodiment of the present invention for each optional one virtual file of file generated by being presented to user so that Yong Huxuan Select a virtual file and may be correlated to an independent monofile, so as in the filesystem of big document storage mode Realize across the source access using user's select file mode.
It should be noted that in the not high system of security requirement, can be obtained in filesystem by the second application Optional file can be the All Files in filesystem.
Optionally, also can be to the visit of the file in filesystem in order to increase the security in across source access process Ask that authority controls.The first application can be allowed to specify mandate source, other sources ability only in the mandate source that the first application is specified The file that the first application preserves can be obtained.Therefore, requesting processing 902 be additionally operable to receive first application specify it is described The mandate source of file, the mandate source can obtain the source of the file to be authorized to.Specific implementation can be found in the side shown in Fig. 2 Method embodiment part.
Storage unit 903, is additionally operable to record the establishment source of the file and the mandate source of the file, and the establishment source is Preserve the source of the first application of the file;The mandate source includes the source of second application.Specific recording mode can Table 1 in reference method embodiment.
The embodiment of the present invention for file by specifying mandate source so that and only authorize the application in source just to obtain this document, Add the security in across source access process.
Optionally, when the device to be used to preserve the filesystem of file with big document storage mode, interaction is single Member 1102 specifically may include:
File choosing is opened in interface module 11021, the file acquisition request for being received according to the receiving subelement 1101 Select interface;
Content module 11022, for the optional file for determining to be obtained by the described second application in filesystem;
Generation module 11023, each optional file generation one for being determined for content module 11022 associate virtual File, using the path of the optional file as the information associated with the virtual file,
Display module 11024, the virtual file for generation module 11023 to be generated are presented in the interface module In the 11021 file selection interfaces opened, so that the user selects to close with the virtual file by the virtual file The file of connection;
Event module 11025, for receiving user in the file selection interface, select what first application preserved The instruction of file.
Optionally, in order to strengthen the operability of file selection interface, generation module 11023, it is additionally operable to generate Filesystem virtual folders;
Display module 11024, it is additionally operable to make the filesystem virtual folders that the generation submodule 11023 generates It is presented in for system disk in the file selection interface;
Event module 11025, is additionally operable to receive the operation of user's selection filesystem virtual folders, and is connecing Indicated after receiving the operation, display module 11024 perform show in file selection interface in filesystem can selection The operation of part.
Optionally, can also be real in file selection interface in order to further strengthen the operability of file selection interface Now show at many levels, for example establishment active layer can also be showed, create many levels such as source host layer.Using show create active layer as Example, content module 11022, it is additionally operable to determine the establishment source of the optional file;
Generation module 11023, it is additionally operable to generate the virtual folder in each establishment source of the determination of content module 11022 respectively;
Display module 11024 specifically includes:
First shows submodule 110241, for the filesystem virtual files for generating the generation module 11023 Folder is presented in the file selection interface as system disk;
Second shows submodule 110242, for the virtual text in the establishment source for generating the generation module 11023 Part folder shows as the sub-folder in the filesystem virtual folders;
3rd shows submodule 110243, for the virtual of the optional file that generates the generation module 11023 File is placed in the virtual folder in corresponding establishment source, is showed as the subfile in the virtual folder in the establishment source.
It should be noted that need to create source corresponding to pre-recorded file in the embodiment showed at many levels is realized, The establishment source of this document can be specifically recorded when file is preserved by storage unit 903.
The specific implementation of each function refers to the detailed description of embodiment of the method part shown in Fig. 1, Fig. 3 and Fig. 5 above.
Device described in Fig. 9, Figure 10 and Figure 11 can include browser, and including running needed for the browser The device of hardware configuration, the device can include computer, tablet personal computer, personal digital assistant (Personal Digital Assistant, PDA), mobile terminal etc..Figure 12 is the distinguishing hierarchy structure chart of the device.Wherein, the device includes application 1201, browser 1202, operating system 1203 and hardware 1204.
Wherein, using 1201 applications to be run in browser 1202, obtained using the API of the opening of browser 1202 The business or capacity of equipment that browser 1202 opens, provide the user miscellaneous service;Using can be based on Web, by Browser is run, and is the product of browser/server (i.e. B/S) framework, and each application has corresponding URL.
Browser 1202, for being communicated with operating system, the API provided by call operation system obtains lower hardware Ability;And provide environment to operate in the operation of the application 1201 in browser 1202;
Operating system:Containing hardware driver, with hardware communications, the input signal as caused by hardware is received and handled;
Hardware:Such as processor, memory, communication interface can be included.
Wherein, Figure 13 is the hardware architecture diagram in the device, and as shown in figure 13, the device may include processor 1301st, memory 1302, communication interface 1303 and bus 1304.Wherein, processor 1301, memory 1302 and communication interface 1303 are communicated to connect by bus 1304.
Processor 1301 can use general central processing unit (Central Processing Unit, CPU), micro- place Reason device, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one Or multiple integrated circuits, for performing relative program, to realize technical scheme that the embodiment of the present invention is provided, wherein, browse Device can be run in processor 1301, to realize above method embodiment and the function described by device embodiment.
Memory 1302 can be read-only storage (Read Only Memory, ROM), static storage device, dynamically deposit Store up equipment or random access memory (Random Access Memory, RAM).Memory 1302 can store an operating system And other applications.When by software or firmware to realize technical scheme provided in an embodiment of the present invention, for realizing The program code of technical scheme provided in an embodiment of the present invention, such as the application program of browser, it is stored in memory 1302, and Performed by processor 1301.
Communication interface 1303 comes realization device and other equipment using a kind of R-T unit of such as, but not limited to transceiver Or communication network (such as, but not limited to Ethernet, wireless access network (Radio Access Network, RAN), WLAN (Wireless Local Area Network, WLAN) etc.) between communication.
Bus 1304 may include a path, and in device all parts, (such as processor 1301, memory 1302 and communication connect Mouth 1303) between transmit information.
It should be noted that although the hardware shown in Figure 13 illustrate only processor 1301, memory 1302, communication interface 1303 And bus 1304, but during specific implementation, realized just it should be apparent to a person skilled in the art that the device also includes Often other devices necessary to operation.Meanwhile according to specific needs, it should be apparent to a person skilled in the art that can also include real The hardware device of other existing functions.
Through the above description of the embodiments, it is apparent to those skilled in the art that the present invention can be with Realized with hardware, or firmware is realized, or combinations thereof mode is realized.When implemented in software, can be by above-mentioned function It is stored in computer-readable medium or is transmitted as one or more instructions on computer-readable medium or code.Meter Calculation machine computer-readable recording medium includes computer-readable storage medium and communication media, and wherein communication media includes being easy to from a place to another Any medium of individual place transmission computer program.Storage medium can be any usable medium that computer can access.With Exemplified by this but it is not limited to:Computer-readable medium can include RAM, ROM, EEPROM, CD-ROM or other optical disc storages, disk Storage medium or other magnetic storage apparatus or can be used in carrying or store with instruction or data structure form expectation Program code and can be by any other medium of computer access.In addition.Any connection can be suitably turn into computer Computer-readable recording medium.For example, if software is using coaxial cable, optical fiber cable, twisted-pair feeder, Digital Subscriber Line (DSL) or such as The wireless technology of infrared ray, radio and microwave etc is transmitted from website, server or other remote sources, then coaxial electrical The wireless technology of cable, optical fiber cable, twisted-pair feeder, DSL or such as infrared ray, wireless and microwave etc is included in affiliated medium In fixing.As used in the present invention, it is logical to include compression laser disc (CD), laser disc, laser disc, numeral for disk (Disk) and dish (disc) With laser disc (DVD), floppy disk and Blu-ray Disc, the replicate data of the usual magnetic of which disk, and dish is then with laser come optical duplication Data.Above combination above should also be as being included within the protection domain of computer-readable medium.
It is described above, it is only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, and it is any ripe Know those skilled in the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be covered Within protection scope of the present invention.Therefore, protection scope of the present invention should be defined by scope of the claims.

Claims (22)

  1. A kind of 1. method for obtaining file, it is characterised in that applied to the file system based on sandbox sandbox mechanism Filesystem, methods described include:
    Browser receives the first file system API filesystem that the first application is provided by the browser The file that API is initiated preserves request;
    Preserved and asked according to the file, the file that first application need to preserve is saved in file system filesystem In;
    The instruction with the acquisition file of described first the second not homologous applications trigger of application is received, the instruction carries institute State the path of file;
    The path of the file is obtained, and the file is obtained from the filesystem according to the path of the file, will The file is supplied to second application.
  2. 2. according to the method for claim 1, it is characterised in that also include:
    The establishment source of the file is recorded, the establishment source is the source for the first application for preserving the file;
    The mandate source for the file that first application is specified is received, the mandate source can obtain the file to be authorized to Source;
    The mandate source of the file is recorded, the mandate source includes the source of second application.
  3. 3. according to the method for claim 2, it is characterised in that applied from described first in the path according to the file File system in obtain the file, by the file be supplied to it is described second application specifically include:
    The file is searched in the filesyetem according to the path of the file;
    After the file is found, by the establishment source and the progress of mandate source of second source applied and the file Match somebody with somebody, when it is determined that the source of second application is the mandate source of the file, the file is supplied to second application.
  4. 4. according to the method described in claim any one of 1-3, it is characterised in that the reception is not homologous with first application The instruction of the acquisition file of the second applications trigger include:
    The 2nd filesystem API that browser described in second application call provides are received to obtain the tune of the file With instruction.
  5. 5. according to the method for claim 4, it is characterised in that also include:
    Receive the described first path for applying the file sent after the file is preserved to the described second application;
    The path of the file is transmitted to second application, so that the described second application is initiated according to the path of the file The call instruction.
  6. 6. according to the method for claim 5, it is characterised in that the path of the file is carried in the described first application to the In across the document communication message postMessage that two applications are sent, or, carry what is sent in the described first application to the second application In HTTP HTTP message.
  7. 7. according to the method for claim 2, it is characterised in that also include:
    Browser receives the file acquisition that second application is initiated by file API and asked, the file acquisition request instruction Browser obtains file by the way of user selects;
    Browser asks to open file selection interface according to the file acquisition, and shows in the file selection interface Optional file in filesystem;
    The reception and the instruction of the acquisition file of described first the second not homologous applications trigger of application include:Receive and use Family selects the instruction of the file in the file selection interface.
  8. 8. according to the method for claim 7, it is characterised in that described to show in the file selection interface Optional file in filesystem includes:
    Browser determines the optional file that can be obtained in filesystem by the described second application, for each optional file generation one The virtual file of individual association, using the path of the optional file as the information associated with the virtual file, and by generation Virtual file is presented in the file selection interface, so as to the user by the virtual file come select with it is described virtual The file of file association.
  9. 9. according to the method for claim 8, it is characterised in that show in the file selection interface in filesystem Optional file before, in addition to:Generate filesystem virtual folders, and using the filesystem virtual folders as System disk is presented in the file selection interface, is receiving the operation of user's selection filesystem virtual folders Show the operation of the optional file in filesystem described in performing afterwards in the file selection interface.
  10. 10. according to the method for claim 9, it is characterised in that the browser determines can be described in filesystem During the optional file that the second application obtains, in addition to:The establishment source of the optional file is determined, and generates each establishment source respectively Virtual folder;
    The described virtual file of generation is presented in the file selection interface specifically includes:By the virtual text in the establishment source Part is pressed from both sides as the sub-folder in the filesystem virtual folders, and the virtual file of the optional file is placed on pair In the virtual folder in the establishment source answered, show as the subfile in the virtual folder in the establishment source.
  11. 11. according to the method described in claim any one of 7-10, it is characterised in that the browser is determined in filesystem It can be specifically included by the optional file that the described second application obtains:
    The source of establishment is included to the file in the source of the described second application, and authorizes the file in source of the source including the described second application true It is set to the optional file that can be obtained in filesystem by the described second application.
  12. 12. a kind of device for obtaining file, it is characterised in that applied to the file system based on sandbox sandbox mechanism Filesystem, described device include:
    Interface unit, for providing the first file system API filesystem API;
    Requesting processing, initiated for receiving the first filesystem API that the first application is provided by the interface unit File preserve request;
    Storage unit, the file for being received according to the requesting processing preserve request, and the described first application is needed to protect The file deposited is saved in file system filesystem;
    Event handling unit, for receiving and the acquisition of described first the second not homologous applications trigger of application first application The instruction of the file of preservation, the instruction carry the path of the file;
    Acquiring unit, for obtaining the path of the file in the instruction that is received from the event handling unit, and according to described The path of file obtains the file from the filesystem;
    Unit is provided, the file for the acquiring unit to be obtained is supplied to second application.
  13. 13. device according to claim 12, it is characterised in that the requesting processing, be additionally operable to receive described The mandate source for the file that one application is specified, the mandate source can obtain the source of the file to be authorized to;
    The storage unit, is additionally operable to record the establishment source of the file and the mandate source of the file, and the establishment source is guarantor Deposit the source of the first application of the file;The mandate source includes the source of second application.
  14. 14. device according to claim 13, it is characterised in that the acquiring unit specifically includes:
    Subelement is obtained, for obtaining the path of the file in the instruction that is received from the event handling unit;
    Subelement is searched, for the path obtained according to the acquisition subelement, the text is searched in the filesystem Part;
    Authenticate subelement, for it is described lookup subelement find the file after, by second source applied with it is described The establishment source and mandate source of file are matched, when it is determined that the source of second application is the mandate source of the file, notice The file that the searching modul is found is sent to second application by the offer unit.
  15. 15. according to the device described in claim any one of 12-14, it is characterised in that the interface unit also provides for Two filesystem api interfaces;
    The 2nd filesystem API that the event handling unit is provided by the interface unit receive second application The call instruction of the acquisition file of triggering.
  16. 16. device according to claim 15, it is characterised in that also include:
    Retransmission unit, the file sent after the file is preserved to the described second application is applied for receiving described first Path;And the path of the file is transmitted to second application, so that the described second application is according to the road of the file Initiate the call instruction in footpath.
  17. 17. device according to claim 16, it is characterised in that the path of the file carry the described first application to In across the document communication message postMessage that second application is sent, or, carry and sent in the described first application to the second application HTTP HTTP message in.
  18. 18. device according to claim 13, it is characterised in that the interface unit, also provide for file API;
    The event handling unit specifically includes:
    Receiving subelement, obtained for receiving the file that the file API that second application is provided by the interface unit are initiated Request is taken, the file acquisition request instruction obtains file by the way of user selects;
    Interaction subelement, file selection interface is opened in the file acquisition request for being received according to the receiving subelement, in institute The optional file showed in file selection interface in filesystem is stated, and receives user in the file selection interface, is selected Select the instruction for the file that first application preserves.
  19. 19. device according to claim 18, it is characterised in that the interactive subelement specifically includes:
    File selection interface is opened in interface module, the file acquisition request for being received according to the receiving subelement;
    Content module, for the optional file for determining to be obtained by the described second application in filesystem;
    Generation module, the virtual file of an association is generated for each optional file for being determined for content module, with it is described can The path of selection part as the information associated with the virtual file,
    Display module, the virtual file for generation module to be generated are presented in the file selection interface that the interface module is opened In, so that the user selects the file associated with the virtual file by the virtual file;
    Event module, for receiving user in the file selection interface, select the finger of the file of the first application preservation Order.
  20. 20. device according to claim 19, it is characterised in that the generation module, be additionally operable to generate filesystem Virtual folder;
    The display module, the filesystem virtual folders using the generation submodule generation are additionally operable to as system disk exhibition In the present file selection interface;
    The event module is additionally operable to receive the operation that user selects the filesystem virtual folders, and receiving State indicate after operation the display module perform described in show in the file selection interface in filesystem can selection The operation of part.
  21. 21. device according to claim 20, it is characterised in that the content module, being additionally operable to can selection described in determination The establishment source of part;
    The generation module, it is additionally operable to generate the virtual folder in each establishment source that the content module determines respectively;
    The display module specifically includes:
    First shows submodule, and the filesystem virtual folders for the generation module to be generated show as system disk In the file selection interface;
    Second shows submodule, for the virtual folder in the establishment source that generates the generation module as described in Sub-folder in filesystem virtual folders shows;
    3rd shows submodule, and the virtual file of the optional file for the generation module to be generated is placed on corresponding wound Build in the virtual folder in source, show as the subfile in the virtual folder in the establishment source.
  22. 22. according to the device described in claim any one of 19-21, it is characterised in that can be described in the filesystem The optional file that second application obtains includes:Establishment source includes the file in the source of the described second application, and authorizes source to include institute State the file in the source of the second application.
CN201280003352.1A 2012-12-31 2012-12-31 A kind of method and apparatus for obtaining file Active CN104137073B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/088091 WO2014101208A1 (en) 2012-12-31 2012-12-31 Method and device for obtaining file

Publications (2)

Publication Number Publication Date
CN104137073A CN104137073A (en) 2014-11-05
CN104137073B true CN104137073B (en) 2017-11-21

Family

ID=51019803

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201280003352.1A Active CN104137073B (en) 2012-12-31 2012-12-31 A kind of method and apparatus for obtaining file

Country Status (2)

Country Link
CN (1) CN104137073B (en)
WO (1) WO2014101208A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9967210B2 (en) * 2015-11-17 2018-05-08 Juniper Networks, Inc. Network device data plane sandboxes for third-party controlled packet forwarding paths
CN109672710B (en) * 2017-10-17 2022-09-13 阿里巴巴集团控股有限公司 File uploading method, system and equipment
CN111897772B (en) * 2020-08-05 2024-02-20 光大兴陇信托有限责任公司 Large file data importing method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1617101A (en) * 2003-10-24 2005-05-18 微软公司 Operating system resource protection
CN1894667A (en) * 2003-12-18 2007-01-10 康泰克创新公司 System and method for allocating server resources
CN102770870A (en) * 2010-01-15 2012-11-07 苹果公司 Specialized network fileserver

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100146523A1 (en) * 2008-12-05 2010-06-10 Tripod Ventures Inc./ Entreprises Tripod Inc. Browser environment application and local file server application system
CN101515241A (en) * 2009-02-19 2009-08-26 北京安高科技有限公司 Intertask data communication control method and system
US8601363B2 (en) * 2009-07-20 2013-12-03 Facebook, Inc. Communicating information about a local machine to a browser application
US8850572B2 (en) * 2010-01-15 2014-09-30 Apple Inc. Methods for handling a file associated with a program in a restricted program environment
US8819586B2 (en) * 2011-05-27 2014-08-26 Microsoft Corporation File access with different file hosts

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1617101A (en) * 2003-10-24 2005-05-18 微软公司 Operating system resource protection
CN1894667A (en) * 2003-12-18 2007-01-10 康泰克创新公司 System and method for allocating server resources
CN102770870A (en) * 2010-01-15 2012-11-07 苹果公司 Specialized network fileserver

Also Published As

Publication number Publication date
CN104137073A (en) 2014-11-05
WO2014101208A1 (en) 2014-07-03

Similar Documents

Publication Publication Date Title
CN1559040B (en) Selection of content in response to communication environment
CN101689210B (en) Aggregating and searching profile data from multiple services
JP5214228B2 (en) Content distribution system
US20060265489A1 (en) Disaster management using an enhanced syndication platform
CN106998329A (en) File sharing method and device
US20140223570A1 (en) Information processing apparatus, information processing system, and license management method
MXPA04001931A (en) Method to initiate server based collaboration on e-mail attachments.
KR20120036831A (en) Integrating updates into a social-networking service
TW200905475A (en) Integrated sharing of electronic documents
US20110225505A1 (en) User Specific Focus Parameters
US20090249430A1 (en) Claim category handling
CN112632919A (en) Document editing method and device, computer equipment and storage medium
CN104137073B (en) A kind of method and apparatus for obtaining file
JP4660483B2 (en) Identity system for use in computing environments
CN105052105A (en) Utilizing x.509 authentication for single sign-on between disparate servers
US20080313287A1 (en) E-mail publishing of photos to photo albums
JP6012504B2 (en) Workflow management system, workflow management method and program
JP4016575B2 (en) Data management apparatus, storage medium storing data management program, storage medium storing usage certificate data, and data usage method
CN110008186A (en) For file management method, device, terminal and the medium of more ftp data sources
JP6742847B2 (en) Server device, detoxification method, and program
JP2006285714A (en) Web content browsing/editing system, web content browsing/editing method and web content browsing/editing program
CN115033920A (en) Object access method, device, electronic equipment, storage medium and program product
JP2009110241A (en) Electronic file management device
JP2006031267A (en) Information registration method, information management device, and advertisement display system
US20070130198A1 (en) Data management device, data management system and data management method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant