This repository was archived by the owner on Jul 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Update servlets to handle IngredientInput #95
Open
tgomezzzz
wants to merge
13
commits into
main-cool-ingredients
Choose a base branch
from
update-servlets
base: main-cool-ingredients
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7123aed
add images to recipes
tgomezzzz 3027c6c
correct package statement
tgomezzzz dedc827
add support for additional recipe data
tgomezzzz 69466b3
add support for spin-offs pre-loading new recipe data and image
tgomezzzz 921e37a
delete TestDisplayRecipesServlet
tgomezzzz 93a5c7e
Merge branch 'create-recipe-html' into create-recipe-images
tgomezzzz 59e11bf
Remove debugging print statements
tgomezzzz 25fcc64
Remove spin-off tester input
tgomezzzz b78e172
change image uploading so Blobstore won't crash on live server
tgomezzzz 3cbdf21
Merge branch 'create-recipe-images' of https://github.com/googleinter…
tgomezzzz 73db65f
change doPost to support cool ingredients
tgomezzzz 1004b14
clarify javadoc
tgomezzzz 0c498c9
Merge branch 'main-cool-ingredients' into update-servlets
tgomezzzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ public class Ingredient { | |
| public Ingredient() { | ||
|
|
||
| } | ||
|
|
||
| public Ingredient(EmbeddedEntity entity) { | ||
|
|
||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/shef/servlets/RecipeImageUploadUrlServlet.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package shef.servlets; | ||
|
|
||
| import com.google.appengine.api.blobstore.BlobInfo; | ||
| import com.google.appengine.api.blobstore.BlobInfoFactory; | ||
| import com.google.appengine.api.blobstore.BlobKey; | ||
| import com.google.appengine.api.blobstore.BlobstoreService; | ||
| import com.google.appengine.api.blobstore.BlobstoreServiceFactory; | ||
| import com.google.appengine.api.images.ImagesService; | ||
| import com.google.appengine.api.images.ImagesServiceFactory; | ||
| import com.google.appengine.api.images.ServingUrlOptions; | ||
| import java.net.MalformedURLException; | ||
| import java.net.URL; | ||
| import java.io.IOException; | ||
| import javax.servlet.annotation.WebServlet; | ||
| import javax.servlet.http.HttpServlet; | ||
| import javax.servlet.http.HttpServletRequest; | ||
| import javax.servlet.http.HttpServletResponse; | ||
| import java.util.Map; | ||
| import java.util.List; | ||
|
|
||
| /** Gets the Blobstore URL to send the recipe creation form to. */ | ||
| @WebServlet("/recipe-image-upload-url") | ||
| public class RecipeImageUploadUrlServlet extends HttpServlet { | ||
|
|
||
| @Override | ||
| public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { | ||
| BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); | ||
| String uploadUrl = blobstoreService.createUploadUrl("/new-recipe"); | ||
| response.setContentType("text/html"); | ||
| response.getWriter().println(uploadUrl); | ||
| } | ||
| } |
60 changes: 0 additions & 60 deletions
60
src/main/java/shef/servlets/TestDisplayRecipesServlet.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do any of the other constructors also need these fields?
For the future: we should have used constructor chaining here, but don't worry about it now.