Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

uploading text files

artem ruzhov
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its my test task for job junior java can you help me how i must do that i cant understand what i must do upload file or what

As a Product Owner i would like to have Servlet WEB API that will allow me to query/filter
information from text files over web so that
- Any person would have access to file without uploading it on local box
- I can do basic query/filter operations online without using text editor or grep/awk/..
API should have following query params:
- limit: integer which represents max number of chars in text that API should return. If
parameter is blank or missing return max 10000 chars.
- q: string which represents text to search in file, i.e. if it q=java - API should return all
strings which equals to ‘java’ or containing it. If q is blank or missing - API should return
all text from file

Example of API call/response:
Such call should return all strings that contains ‘Java’ with length <= 5 with total length <=
1000. Additionally metadata will be included.
Example JSON response:
"fileCreationDate":"January 23, 1996 at 12: 52PM"

L Foster
Ranch Hand
Posts: 177
Android Java Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@artem, Hello.
Obviously, I cannot post a solution to this. However, I may be able to help. And please consider my response carefully, because I am not in your shoes: I have not seen the assignment, or talked with the person. Maybe my interpretation is off a bit. But I will but in 2 cents, because we have had debates at my organization, for years, about whether something like (what I think this) is, should even be done. Here goes.

I think the really confusing, single word here, is "uploading". This is phrased as "uploading it to local box". If that had been phrased, "any person would have access without downloading it to local box", would you be at all confused? When you visit a site and want to get something locally, like a nice image, do you ever "upload it to your local computer"?

Now, think: why would anyone need a servlet like this? Hint: there are two machines involved, separated by miles of space, talking over a network, with very different capabilities (local desktop with limited space and CPU, and remote server with lots of memory and storage and fast CPU(s)).

Finally, a decent place to work would likely allow you to ask questions, and get clarification. This is Saturday after Christmas, so nobody is in, but you should be able to ask at some point. And if not, I think you are on the right track reading posts here at Code Ranch. Reading about technical things, where knowledgeable people post solutions, etc., can also "build intuition".
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic