-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
83 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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,14 @@ | ||
package poc.resources | ||
|
||
import com.sun.jersey.api.view.ImplicitProduces | ||
|
||
|
||
/** | ||
* Defines the default representations to be used on resources | ||
* | ||
* @version $Revision: 1.1 $ | ||
*/ | ||
@ImplicitProduces(Array("text/html;qs=5")) | ||
abstract class DefaultRepresentations { | ||
|
||
} |
This file contains 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,7 @@ | ||
package poc.resources | ||
|
||
/** | ||
* @version $Revision: 1.1 $ | ||
*/ | ||
case class Item(id: String, name: String) extends DefaultRepresentations { | ||
} |
This file contains 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,9 @@ | ||
package poc.resources | ||
|
||
case class Timetable ( | ||
year: String, | ||
week: String, | ||
name: String | ||
) extends DefaultRepresentations { | ||
} | ||
|
This file contains 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 |
---|---|---|
@@ -1,32 +1,34 @@ | ||
package poc.resources | ||
|
||
import com.sun.jersey.api.view.ImplicitProduces | ||
import javax.ws.rs.Path | ||
import javax.ws.rs.PathParam | ||
import javax.ws.rs.GET | ||
import javax.ws.rs.Produces | ||
import com.sun.jersey.api.view.Viewable | ||
import poc.dto.TimetableDTO | ||
|
||
@Path("/timetable") | ||
@ImplicitProduces(Array("text/html;qs=5")) | ||
class TimetableResource { | ||
class TimetableResource extends DefaultRepresentations { | ||
|
||
def blip() = { | ||
new TimetableDTO("year", "week", "name") | ||
@GET | ||
def get() = new Viewable("index", this) | ||
|
||
@Path("{year}/{week}/{name}") | ||
def timetable( | ||
@PathParam("year") year: String, | ||
@PathParam("week") week: String, | ||
@PathParam("name") name: String | ||
)= { | ||
Timetable(year, week, name) | ||
} | ||
|
||
@GET | ||
/*@Path("/") | ||
def cashierTimetable() = { | ||
*/ | ||
@Path("/{year}/{week}/{name}") | ||
|
||
|
||
@Path("{year}") | ||
def cashierTimetable( | ||
@PathParam("year") year:String, | ||
@PathParam("week") week:String, | ||
@PathParam("name") name:String) = { | ||
@PathParam("year") year:String | ||
) = { | ||
println("cashier timetable") | ||
new Viewable("index", blip) | ||
// new TimetableDTO("2011", "34", "Blip") | ||
Item(year, "Name of Item: " + year) | ||
} | ||
|
||
} | ||
} |
This file contains 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,26 @@ | ||
<%-- | ||
|
||
Copyright (C) 2009-2011 the original author or authors. | ||
See the notice.md file distributed with this work for additional | ||
information regarding copyright ownership. | ||
|
||
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 | ||
|
||
http://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. | ||
|
||
--%> | ||
<%@ import val it: Item %> | ||
<h1>Item!</h1> | ||
|
||
<p>Hello from a Item!</p> | ||
|
||
<p>The item id is <b><%= id %></b></p> | ||
<p>The item name is <b><%= name %></b></p> |
This file contains 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,6 @@ | ||
-@import val it: Timetable | ||
|
||
%html | ||
%body | ||
%h1 Timetable #{name} #{year} #{week} | ||
|
This file contains 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 |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
|
||
%html | ||
%body | ||
%h1 Timetable #{it.blip.name} | ||
|
||
%h1 Timetable index | ||
|
6 changes: 0 additions & 6 deletions
6
src/main/webapp/WEB-INF/poc/resources/TimetableResource.path.scaml
This file was deleted.
Oops, something went wrong.